summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-12-30 19:02:48 +0000
committerpeter <peter@FreeBSD.org>1995-12-30 19:02:48 +0000
commit9e723d65b3dbe4a3c599923d35ce1e637e0d32e1 (patch)
tree392650eb6fe24a669868f9d9d63ff6af2040e501
parent252487f3dde38c3e41336534067ea6fe9c47d787 (diff)
downloadFreeBSD-src-9e723d65b3dbe4a3c599923d35ce1e637e0d32e1.zip
FreeBSD-src-9e723d65b3dbe4a3c599923d35ce1e637e0d32e1.tar.gz
recording cvs-1.6 file death
-rw-r--r--include/tzfile.h151
-rw-r--r--lib/libc/compat-43/setregid.293
-rw-r--r--lib/libc/compat-43/setregid.c62
-rw-r--r--lib/libc/compat-43/setreuid.291
-rw-r--r--lib/libc/compat-43/setreuid.c62
-rw-r--r--lib/libc/gen/ctime.3258
-rw-r--r--lib/libc/gen/ctime.c1381
-rw-r--r--lib/libc/gen/difftime.c45
-rw-r--r--lib/libc/gen/sigsetjmp.c61
-rw-r--r--lib/libc/i386/gen/_setjmp.s78
-rw-r--r--lib/libc/i386/gen/alloca.s57
-rw-r--r--lib/libc/i386/gen/divsi3.s46
-rw-r--r--lib/libc/i386/gen/fabs.s46
-rw-r--r--lib/libc/i386/gen/fixdfsi.s46
-rw-r--r--lib/libc/i386/gen/fixunsdfsi.s60
-rw-r--r--lib/libc/i386/gen/modf.s75
-rw-r--r--lib/libc/i386/gen/setjmp.s86
-rw-r--r--lib/libc/i386/gen/udivsi3.s46
-rw-r--r--lib/libc/i386/net/htonl.s50
-rw-r--r--lib/libc/i386/net/htons.s48
-rw-r--r--lib/libc/i386/net/ntohl.s50
-rw-r--r--lib/libc/i386/net/ntohs.s48
-rw-r--r--lib/libc/i386/stdlib/abs.s48
-rw-r--r--lib/libc/i386/string/bzero.s53
-rw-r--r--lib/libc/i386/sys/Ovfork.s70
-rw-r--r--lib/libc/i386/sys/brk.s65
-rw-r--r--lib/libc/i386/sys/cerror.s47
-rw-r--r--lib/libc/i386/sys/exect.s52
-rw-r--r--lib/libc/i386/sys/fork.s48
-rw-r--r--lib/libc/i386/sys/mount.s45
-rw-r--r--lib/libc/i386/sys/pipe.s48
-rw-r--r--lib/libc/i386/sys/ptrace.s51
-rw-r--r--lib/libc/i386/sys/reboot.s44
-rw-r--r--lib/libc/i386/sys/sbrk.s65
-rw-r--r--lib/libc/i386/sys/setlogin.s47
-rw-r--r--lib/libc/i386/sys/sigpending.s47
-rw-r--r--lib/libc/i386/sys/sigprocmask.s64
-rw-r--r--lib/libc/i386/sys/sigreturn.s54
-rw-r--r--lib/libc/i386/sys/sigsuspend.s54
-rw-r--r--lib/libc/i386/sys/syscall.s51
-rw-r--r--lib/libc/net/getnetbyname.c62
-rw-r--r--lib/libc/net/getnetent.c121
-rw-r--r--lib/libc/net/sethostent.c56
-rw-r--r--lib/libc/stdlib/free.381
-rw-r--r--lib/libc/stdlib/realloc.399
-rw-r--r--lib/libc/string/strftime.3186
-rw-r--r--lib/libc/string/strftime.c292
-rw-r--r--lib/libcompat/regexp/regexp.h21
-rw-r--r--lib/libedit/histedit.h172
-rw-r--r--lib/libedit/termcap.h52
-rw-r--r--lib/librpc/DISCLAIMER28
-rw-r--r--lib/librpc/Makefile30
-rw-r--r--lib/librpc/README233
-rw-r--r--lib/librpc/demo/Makefile25
-rw-r--r--lib/librpc/demo/dir/Makefile26
-rw-r--r--lib/librpc/demo/dir/dir.x37
-rw-r--r--lib/librpc/demo/dir/dir_proc.c55
-rw-r--r--lib/librpc/demo/dir/rls.c81
-rw-r--r--lib/librpc/demo/msg/Makefile36
-rw-r--r--lib/librpc/demo/msg/msg.x9
-rw-r--r--lib/librpc/demo/msg/msg_proc.c28
-rw-r--r--lib/librpc/demo/msg/printmsg.c43
-rw-r--r--lib/librpc/demo/msg/rprintmsg.c74
-rw-r--r--lib/librpc/demo/sort/Makefile36
-rw-r--r--lib/librpc/demo/sort/rsort.c43
-rw-r--r--lib/librpc/demo/sort/sort.x19
-rw-r--r--lib/librpc/demo/sort/sort_proc.c27
-rw-r--r--lib/librpc/doc/Makefile84
-rw-r--r--lib/librpc/doc/nfs.rfc.ms1372
-rw-r--r--lib/librpc/doc/rpc.prog.ms2684
-rw-r--r--lib/librpc/doc/rpc.rfc.ms1302
-rw-r--r--lib/librpc/doc/rpcgen.ms1299
-rw-r--r--lib/librpc/doc/xdr.nts.ms1966
-rw-r--r--lib/librpc/doc/xdr.rfc.ms1058
-rw-r--r--lib/librpc/etc/Makefile74
-rw-r--r--lib/librpc/etc/getopt.c75
-rw-r--r--lib/librpc/etc/portmap.c481
-rw-r--r--lib/librpc/etc/rpc33
-rw-r--r--lib/librpc/etc/rpcinfo.c665
-rw-r--r--lib/librpc/man/man1/rpcgen.1197
-rw-r--r--lib/librpc/man/man1/rstat.157
-rw-r--r--lib/librpc/man/man3/bindresvport.3n27
-rw-r--r--lib/librpc/man/man3/getrpcent.3n109
-rw-r--r--lib/librpc/man/man3/getrpcport.3r31
-rw-r--r--lib/librpc/man/man3/rpc.3n1729
-rw-r--r--lib/librpc/man/man3/xdr.3n823
-rw-r--r--lib/librpc/man/man5/rpc.571
-rw-r--r--lib/librpc/man/man8/portmap.8c53
-rw-r--r--lib/librpc/man/man8/rpcinfo.8c183
-rw-r--r--lib/librpc/man/man8/rstat_svc.8c21
-rw-r--r--lib/librpc/rpc/auth.h166
-rw-r--r--lib/librpc/rpc/auth_none.c133
-rw-r--r--lib/librpc/rpc/auth_unix.c337
-rw-r--r--lib/librpc/rpc/auth_unix.h72
-rw-r--r--lib/librpc/rpc/authunix_prot.c66
-rw-r--r--lib/librpc/rpc/bindresvport.c79
-rw-r--r--lib/librpc/rpc/clnt.h331
-rw-r--r--lib/librpc/rpc/clnt_generic.c110
-rw-r--r--lib/librpc/rpc/clnt_perror.c302
-rw-r--r--lib/librpc/rpc/clnt_raw.c238
-rw-r--r--lib/librpc/rpc/clnt_simple.c112
-rw-r--r--lib/librpc/rpc/clnt_tcp.c466
-rw-r--r--lib/librpc/rpc/clnt_udp.c442
-rw-r--r--lib/librpc/rpc/get_myaddress.c96
-rw-r--r--lib/librpc/rpc/getrpcent.c235
-rw-r--r--lib/librpc/rpc/getrpcport.c55
-rw-r--r--lib/librpc/rpc/pmap_clnt.c115
-rw-r--r--lib/librpc/rpc/pmap_clnt.h65
-rw-r--r--lib/librpc/rpc/pmap_getmaps.c84
-rw-r--r--lib/librpc/rpc/pmap_getport.c87
-rw-r--r--lib/librpc/rpc/pmap_prot.c57
-rw-r--r--lib/librpc/rpc/pmap_prot.h94
-rw-r--r--lib/librpc/rpc/pmap_prot2.c116
-rw-r--r--lib/librpc/rpc/pmap_rmt.c395
-rw-r--r--lib/librpc/rpc/pmap_rmt.h53
-rw-r--r--lib/librpc/rpc/rpc.h80
-rw-r--r--lib/librpc/rpc/rpc_callmsg.c190
-rw-r--r--lib/librpc/rpc/rpc_commondata.c41
-rw-r--r--lib/librpc/rpc/rpc_dtablesize.c46
-rw-r--r--lib/librpc/rpc/rpc_msg.h187
-rw-r--r--lib/librpc/rpc/rpc_prot.c289
-rw-r--r--lib/librpc/rpc/svc.c479
-rw-r--r--lib/librpc/rpc/svc.h280
-rw-r--r--lib/librpc/rpc/svc_auth.c114
-rw-r--r--lib/librpc/rpc/svc_auth.h42
-rw-r--r--lib/librpc/rpc/svc_auth_unix.c134
-rw-r--r--lib/librpc/rpc/svc_raw.c166
-rw-r--r--lib/librpc/rpc/svc_run.c72
-rw-r--r--lib/librpc/rpc/svc_simple.c143
-rw-r--r--lib/librpc/rpc/svc_tcp.c419
-rw-r--r--lib/librpc/rpc/svc_udp.c477
-rw-r--r--lib/librpc/rpc/types.h63
-rw-r--r--lib/librpc/rpc/xdr.c576
-rw-r--r--lib/librpc/rpc/xdr.h270
-rw-r--r--lib/librpc/rpc/xdr_array.c153
-rw-r--r--lib/librpc/rpc/xdr_float.c267
-rw-r--r--lib/librpc/rpc/xdr_mem.c184
-rw-r--r--lib/librpc/rpc/xdr_rec.c583
-rw-r--r--lib/librpc/rpc/xdr_reference.c132
-rw-r--r--lib/librpc/rpc/xdr_stdio.c189
-rw-r--r--lib/librpc/rpcgen/Makefile60
-rw-r--r--lib/librpc/rpcgen/rpc_clntout.c126
-rw-r--r--lib/librpc/rpcgen/rpc_cout.c350
-rw-r--r--lib/librpc/rpcgen/rpc_hout.c370
-rw-r--r--lib/librpc/rpcgen/rpc_main.c433
-rw-r--r--lib/librpc/rpcgen/rpc_parse.c419
-rw-r--r--lib/librpc/rpcgen/rpc_parse.h157
-rw-r--r--lib/librpc/rpcgen/rpc_scan.c473
-rw-r--r--lib/librpc/rpcgen/rpc_scan.h101
-rw-r--r--lib/librpc/rpcgen/rpc_svcout.c275
-rw-r--r--lib/librpc/rpcgen/rpc_util.c436
-rw-r--r--lib/librpc/rpcgen/rpc_util.h114
-rw-r--r--lib/librpc/rpcsvc/Makefile80
-rw-r--r--lib/librpc/rpcsvc/bootparam_prot.x97
-rw-r--r--lib/librpc/rpcsvc/klm_prot.x132
-rw-r--r--lib/librpc/rpcsvc/mount.x161
-rw-r--r--lib/librpc/rpcsvc/nfs_prot.x355
-rw-r--r--lib/librpc/rpcsvc/nlm_prot.x179
-rw-r--r--lib/librpc/rpcsvc/rex.x229
-rw-r--r--lib/librpc/rpcsvc/rnusers.x86
-rw-r--r--lib/librpc/rpcsvc/rquota.x61
-rw-r--r--lib/librpc/rpcsvc/rstat.c85
-rw-r--r--lib/librpc/rpcsvc/rstat.x145
-rw-r--r--lib/librpc/rpcsvc/rstat_proc.c352
-rw-r--r--lib/librpc/rpcsvc/sm_inter.x116
-rw-r--r--lib/librpc/rpcsvc/spray.x84
-rw-r--r--lib/librpc/rpcsvc/yp.x291
-rw-r--r--lib/librpc/rpcsvc/yppasswd.x63
-rw-r--r--lib/librpc/secure_rpc/README92
-rw-r--r--lib/librpc/secure_rpc/bin/Makefile50
-rw-r--r--lib/librpc/secure_rpc/bin/chkey.c302
-rw-r--r--lib/librpc/secure_rpc/bin/keylogin.c66
-rw-r--r--lib/librpc/secure_rpc/demo/Makefile28
-rw-r--r--lib/librpc/secure_rpc/demo/rme.c96
-rw-r--r--lib/librpc/secure_rpc/demo/whoami.x33
-rw-r--r--lib/librpc/secure_rpc/demo/whoami_proc.c95
-rw-r--r--lib/librpc/secure_rpc/des/des.h68
-rw-r--r--lib/librpc/secure_rpc/des/des_crypt.c138
-rw-r--r--lib/librpc/secure_rpc/des/des_crypt.h101
-rw-r--r--lib/librpc/secure_rpc/des/des_soft.c67
-rw-r--r--lib/librpc/secure_rpc/doc/Makefile40
-rw-r--r--lib/librpc/secure_rpc/doc/nfs.secure.ms934
-rw-r--r--lib/librpc/secure_rpc/keyserv/Makefile49
-rw-r--r--lib/librpc/secure_rpc/keyserv/detach.c69
-rw-r--r--lib/librpc/secure_rpc/keyserv/keyenvoy.c213
-rw-r--r--lib/librpc/secure_rpc/keyserv/keyserv.c458
-rw-r--r--lib/librpc/secure_rpc/keyserv/mp.c145
-rw-r--r--lib/librpc/secure_rpc/keyserv/setkey.c514
-rw-r--r--lib/librpc/secure_rpc/man/chkey.119
-rw-r--r--lib/librpc/secure_rpc/man/des_crypt.3126
-rw-r--r--lib/librpc/secure_rpc/man/keyenvoy.8c22
-rw-r--r--lib/librpc/secure_rpc/man/keylogin.132
-rw-r--r--lib/librpc/secure_rpc/man/keyserv.8c52
-rw-r--r--lib/librpc/secure_rpc/man/publickey.3r44
-rw-r--r--lib/librpc/secure_rpc/man/publickey.537
-rw-r--r--lib/librpc/secure_rpc/man/rpc_secure.3n330
-rw-r--r--lib/librpc/secure_rpc/man/rtime.3n43
-rw-r--r--lib/librpc/secure_rpc/rpc/Makefile109
-rw-r--r--lib/librpc/secure_rpc/rpc/auth_des.c411
-rw-r--r--lib/librpc/secure_rpc/rpc/auth_des.h105
-rw-r--r--lib/librpc/secure_rpc/rpc/authdes_prot.c82
-rw-r--r--lib/librpc/secure_rpc/rpc/key_call.c228
-rw-r--r--lib/librpc/secure_rpc/rpc/key_prot.c165
-rw-r--r--lib/librpc/secure_rpc/rpc/key_prot.h114
-rw-r--r--lib/librpc/secure_rpc/rpc/key_prot.x151
-rw-r--r--lib/librpc/secure_rpc/rpc/netname.c239
-rw-r--r--lib/librpc/secure_rpc/rpc/openchild.c133
-rw-r--r--lib/librpc/secure_rpc/rpc/publickey.c129
-rw-r--r--lib/librpc/secure_rpc/rpc/rtime.c141
-rw-r--r--lib/librpc/secure_rpc/rpc/svc_auth.c116
-rw-r--r--lib/librpc/secure_rpc/rpc/svcauth_des.c519
-rw-r--r--lib/librpc/secure_rpc/rpc/xcrypt.c183
-rw-r--r--lib/libtelnet/auth-proto.h96
-rw-r--r--lib/libtelnet/auth.c658
-rw-r--r--lib/libtelnet/auth.h87
-rw-r--r--lib/libtelnet/enc-proto.h125
-rw-r--r--lib/libtelnet/enc_des.c724
-rw-r--r--lib/libtelnet/encrypt.c999
-rw-r--r--lib/libtelnet/encrypt.h108
-rw-r--r--lib/libtelnet/kerberos.c554
-rw-r--r--lib/libtelnet/kerberos5.c762
-rw-r--r--lib/libtelnet/key-proto.h71
-rw-r--r--lib/libtelnet/krb4encpwd.c446
-rw-r--r--lib/libtelnet/read_password.c145
-rw-r--r--lib/libtelnet/rsaencpwd.c492
-rw-r--r--lib/libtelnet/spx.c588
-rw-r--r--lib/libterm/TEST/tc1.c63
-rw-r--r--lib/libterm/TEST/tc2.c90
-rw-r--r--lib/libterm/TEST/tc3.c112
-rw-r--r--lib/libterm/pathnames.h36
-rw-r--r--lib/libterm/termcap.3254
-rw-r--r--lib/libterm/termcap.c208
-rw-r--r--lib/libterm/tgoto.c207
-rw-r--r--lib/libterm/tputs.c123
-rw-r--r--libexec/bugfiler/bug.h92
-rw-r--r--libexec/bugfiler/bugfiler.8290
-rw-r--r--libexec/bugfiler/bugfiler.c167
-rw-r--r--libexec/bugfiler/bugformat32
-rw-r--r--libexec/bugfiler/error.c89
-rw-r--r--libexec/bugfiler/extern.h41
-rw-r--r--libexec/bugfiler/gethead.c165
-rw-r--r--libexec/bugfiler/pathnames.h38
-rw-r--r--libexec/bugfiler/process.c115
-rw-r--r--libexec/bugfiler/redist.c131
-rw-r--r--libexec/bugfiler/reply.c118
-rw-r--r--libexec/bugfiler/sendbug.185
-rw-r--r--libexec/bugfiler/sendbug.sh66
-rw-r--r--libexec/getty/ttydefaults.c54
-rw-r--r--libexec/kpasswdd/kpasswdd.860
-rw-r--r--libexec/kpasswdd/kpasswdd.c271
-rw-r--r--libexec/telnetd/authenc.c91
-rw-r--r--sbin/disklabel/disklabel.5.5384
-rw-r--r--sbin/fastboot/fastboot.869
-rw-r--r--sbin/scsiformat/scsiformat.c664
-rw-r--r--secure/usr.bin/telnet/krb4-proto.h207
-rw-r--r--share/doc/psd/00.contents191
-rw-r--r--share/doc/psd/Title131
-rw-r--r--share/doc/smm/00.contents161
-rw-r--r--share/doc/smm/Title203
-rw-r--r--share/doc/usd/00.contents262
-rw-r--r--share/doc/usd/Title120
-rw-r--r--share/man/man8/adduser.8115
-rw-r--r--share/tabset/31011
-rw-r--r--share/tabset/98371
-rw-r--r--share/tabset/aa1
-rw-r--r--share/tabset/aed5121
-rw-r--r--share/tabset/beehive2
-rw-r--r--share/tabset/diablo3
-rw-r--r--share/tabset/dtc3821
-rw-r--r--share/tabset/hp700-wybin105 -> 0 bytes
-rw-r--r--share/tabset/ibm31011
-rw-r--r--share/tabset/std1
-rw-r--r--share/tabset/stdcrt1
-rw-r--r--share/tabset/tandem6531
-rw-r--r--share/tabset/teleray1
-rw-r--r--share/tabset/vt1001
-rw-r--r--share/tabset/vt100-w1
-rw-r--r--share/tabset/wyse-adds3
-rw-r--r--share/tabset/xerox17201
-rw-r--r--share/tabset/zenith291
-rw-r--r--share/tmac/README145
-rw-r--r--share/tmac/doc3456
-rw-r--r--share/tmac/doc-common432
-rw-r--r--share/tmac/doc-ditroff269
-rw-r--r--share/tmac/doc-nroff225
-rw-r--r--share/tmac/doc-syms238
-rw-r--r--share/tmac/strip.sed44
-rw-r--r--share/tmac/tmac.andoc54
-rw-r--r--share/tmac/tmac.doc.old1833
-rw-r--r--share/tmac/tmac.e41
-rw-r--r--share/tmac/tmac.s41
-rw-r--r--share/tmac/tmac.sU46
-rw-r--r--usr.bin/apropos/Makefile7
-rw-r--r--usr.bin/apropos/apropos.1120
-rw-r--r--usr.bin/apropos/apropos.c223
-rw-r--r--usr.bin/ar/ar.5.5145
-rw-r--r--usr.bin/bdes/Makefile5
-rw-r--r--usr.bin/bdes/bdes.1304
-rw-r--r--usr.bin/bdes/bdes.c1046
-rw-r--r--usr.bin/bdes/bdes.ps2945
-rw-r--r--usr.bin/compress/zcat.sh37
-rw-r--r--usr.bin/diff/diff/diff.1387
-rw-r--r--usr.bin/diff/diff3/diff3.1172
-rw-r--r--usr.bin/grep/egrep/egrep.c924
-rw-r--r--usr.bin/grep/egrep/grep.1250
-rw-r--r--usr.bin/grep/egrep/pathnames.h40
-rw-r--r--usr.bin/ld/Makefile7
-rw-r--r--usr.bin/ld/cplus-dem.c970
-rw-r--r--usr.bin/ld/ld.c4718
-rw-r--r--usr.bin/ld/symseg.h358
-rw-r--r--usr.bin/m4/serv.c475
-rw-r--r--usr.bin/man/Makefile8
-rw-r--r--usr.bin/man/config.c174
-rw-r--r--usr.bin/man/config.h57
-rw-r--r--usr.bin/man/man.1188
-rw-r--r--usr.bin/man/man.c712
-rw-r--r--usr.bin/man/man.conf46
-rw-r--r--usr.bin/man/man.conf.5195
-rw-r--r--usr.bin/man/pathnames.h39
-rw-r--r--usr.bin/mklocale/Japanese158
-rw-r--r--usr.bin/passwd/kpasswd_proto.h54
-rw-r--r--usr.bin/passwd/krb_passwd.c319
-rw-r--r--usr.bin/patch/EXTERN.h15
-rw-r--r--usr.bin/patch/INTERN.h15
-rw-r--r--usr.bin/patch/config.h16
-rw-r--r--usr.bin/patch/patchlevel.h1
-rw-r--r--usr.bin/patch/version.c28
-rw-r--r--usr.bin/patch/version.h9
-rw-r--r--usr.bin/ranlib/ranlib.5.570
-rw-r--r--usr.bin/rlogin/des_rw.c203
-rw-r--r--usr.bin/sccs/Makefile5
-rw-r--r--usr.bin/sccs/PSD.doc/Makefile10
-rw-r--r--usr.bin/sccs/PSD.doc/sccs.me1608
-rw-r--r--usr.bin/sccs/PSD.doc/spell.ok77
-rw-r--r--usr.bin/sccs/pathnames.h51
-rw-r--r--usr.bin/sccs/sccs.1398
-rw-r--r--usr.bin/sccs/sccs.c1621
-rw-r--r--usr.bin/tip/acu.c196
-rw-r--r--usr.bin/tip/aculib/biz22.c187
-rw-r--r--usr.bin/tip/aculib/biz31.c248
-rw-r--r--usr.bin/tip/aculib/courier.c380
-rw-r--r--usr.bin/tip/aculib/df.c132
-rw-r--r--usr.bin/tip/aculib/dn11.c142
-rw-r--r--usr.bin/tip/aculib/hayes.c305
-rw-r--r--usr.bin/tip/aculib/t3000.c408
-rw-r--r--usr.bin/tip/aculib/v3451.c214
-rw-r--r--usr.bin/tip/aculib/v831.c259
-rw-r--r--usr.bin/tip/aculib/ventel.c251
-rw-r--r--usr.bin/tip/acutab.c97
-rw-r--r--usr.bin/tip/cmds.c888
-rw-r--r--usr.bin/tip/cmdtab.c64
-rw-r--r--usr.bin/tip/cu.c132
-rw-r--r--usr.bin/tip/hunt.c93
-rw-r--r--usr.bin/tip/log.c86
-rw-r--r--usr.bin/tip/partab.c58
-rw-r--r--usr.bin/tip/remcap.c426
-rw-r--r--usr.bin/tip/remote.c226
-rw-r--r--usr.bin/tip/tip.1451
-rw-r--r--usr.bin/tip/value.c353
-rw-r--r--usr.bin/tip/vars.c112
-rw-r--r--usr.bin/uucp/acucntrl/acucntrl.c814
-rw-r--r--usr.bin/uucp/uupoll/uupoll.8111
-rw-r--r--usr.bin/uucp/uupoll/uupoll.c129
-rw-r--r--usr.bin/uucp/uuq/Makefile9
-rw-r--r--usr.bin/uucp/uuq/uuq.1126
-rw-r--r--usr.bin/uucp/uuq/uuq.c435
-rw-r--r--usr.bin/uucp/uusend/Makefile6
-rw-r--r--usr.bin/uucp/uusend/uusend.196
-rw-r--r--usr.bin/uucp/uusend/uusend.c403
-rw-r--r--usr.bin/uucp/uusnap/uusnap.880
-rw-r--r--usr.bin/uucp/uusnap/uusnap.c348
-rw-r--r--usr.bin/whatis/Makefile7
-rw-r--r--usr.bin/whatis/whatis.1105
-rw-r--r--usr.bin/whatis/whatis.c218
-rw-r--r--usr.sbin/arp/arp4.4124
-rw-r--r--usr.sbin/sliplogin/slip.hosts11
-rw-r--r--usr.sbin/sliplogin/slip.login12
-rw-r--r--usr.sbin/update/Makefile6
-rw-r--r--usr.sbin/update/update.874
-rw-r--r--usr.sbin/update/update.c75
380 files changed, 0 insertions, 89372 deletions
diff --git a/include/tzfile.h b/include/tzfile.h
deleted file mode 100644
index 246e6a7..0000000
--- a/include/tzfile.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Arthur David Olson of the National Cancer Institute.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)tzfile.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _TZFILE_H_
-#define _TZFILE_H_
-
-/*
- * Information about time zone files.
- */
- /* Time zone object file directory */
-#define TZDIR "/usr/share/zoneinfo"
-#define TZDEFAULT "/etc/localtime"
-#define TZDEFRULES "posixrules"
-
-/*
-** Each file begins with. . .
-*/
-
-struct tzhead {
- char tzh_reserved[24]; /* reserved for future use */
- char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
- char tzh_leapcnt[4]; /* coded number of leap seconds */
- char tzh_timecnt[4]; /* coded number of transition times */
- char tzh_typecnt[4]; /* coded number of local time types */
- char tzh_charcnt[4]; /* coded number of abbr. chars */
-};
-
-/*
-** . . .followed by. . .
-**
-** tzh_timecnt (char [4])s coded transition times a la time(2)
-** tzh_timecnt (unsigned char)s types of local time starting at above
-** tzh_typecnt repetitions of
-** one (char [4]) coded GMT offset in seconds
-** one (unsigned char) used to set tm_isdst
-** one (unsigned char) that's an abbreviation list index
-** tzh_charcnt (char)s '\0'-terminated zone abbreviations
-** tzh_leapcnt repetitions of
-** one (char [4]) coded leap second transition times
-** one (char [4]) total correction after above
-** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
-** time is standard time, if FALSE,
-** transition time is wall clock time
-** if absent, transition times are
-** assumed to be wall clock time
-*/
-
-/*
-** In the current implementation, "tzset()" refuses to deal with files that
-** exceed any of the limits below.
-*/
-
-/*
-** The TZ_MAX_TIMES value below is enough to handle a bit more than a
-** year's worth of solar time (corrected daily to the nearest second) or
-** 138 years of Pacific Presidential Election time
-** (where there are three time zone transitions every fourth year).
-*/
-#define TZ_MAX_TIMES 370
-
-#define NOSOLAR /* 4BSD doesn't currently handle solar time */
-
-#ifndef NOSOLAR
-#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
-#else
-#define TZ_MAX_TYPES 10 /* Maximum number of local time types */
-#endif
-
-#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
-
-#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
-
-#define SECSPERMIN 60
-#define MINSPERHOUR 60
-#define HOURSPERDAY 24
-#define DAYSPERWEEK 7
-#define DAYSPERNYEAR 365
-#define DAYSPERLYEAR 366
-#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
-#define MONSPERYEAR 12
-
-#define TM_SUNDAY 0
-#define TM_MONDAY 1
-#define TM_TUESDAY 2
-#define TM_WEDNESDAY 3
-#define TM_THURSDAY 4
-#define TM_FRIDAY 5
-#define TM_SATURDAY 6
-
-#define TM_JANUARY 0
-#define TM_FEBRUARY 1
-#define TM_MARCH 2
-#define TM_APRIL 3
-#define TM_MAY 4
-#define TM_JUNE 5
-#define TM_JULY 6
-#define TM_AUGUST 7
-#define TM_SEPTEMBER 8
-#define TM_OCTOBER 9
-#define TM_NOVEMBER 10
-#define TM_DECEMBER 11
-
-#define TM_YEAR_BASE 1900
-
-#define EPOCH_YEAR 1970
-#define EPOCH_WDAY TM_THURSDAY
-
-/*
-** Accurate only for the past couple of centuries;
-** that will probably do.
-*/
-
-#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
-
-#endif /* !_TZFILE_H_ */
diff --git a/lib/libc/compat-43/setregid.2 b/lib/libc/compat-43/setregid.2
deleted file mode 100644
index bf2624da..0000000
--- a/lib/libc/compat-43/setregid.2
+++ /dev/null
@@ -1,93 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)setregid.2 8.2 (Berkeley) 4/16/94
-.\"
-.Dd April 16, 1994
-.Dt SETREGID 2
-.Os BSD 4.2
-.Sh NAME
-.Nm setregid
-.Nd set real and effective group ID
-.Sh SYNOPSIS
-.Fd #include <unistd.h>
-.Ft int
-.Fn setregid "gid_t rgid" "gid_t egid"
-.Sh DESCRIPTION
-The real and effective group ID's of the current process
-are set to the arguments.
-Unprivileged users may change the real group
-ID to the effective group ID and vice-versa; only the super-user may
-make other changes.
-.Pp
-Supplying a value of -1 for either the real or effective
-group ID forces the system to substitute the current
-ID in place of the -1 parameter.
-.Pp
-The
-.Fn setregid
-function was intended to allow swapping
-the real and effective group IDs
-in set-group-ID programs to temporarily relinquish the set-group-ID value.
-This function did not work correctly,
-and its purpose is now better served by the use of the
-.Fn setegid
-function (see
-.Xr setuid 2 ) .
-.Pp
-When setting the real and effective group IDs to the same value,
-the standard
-.Fn setgid
-function is preferred.
-.Sh RETURN VALUES
-Upon successful completion, a value of 0 is returned. Otherwise,
-a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Bl -tag -width [EPERM]
-.It Bq Er EPERM
-The current process is not the super-user and a change
-other than changing the effective group-id to the real group-id
-was specified.
-.El
-.Sh SEE ALSO
-.Xr getgid 2 ,
-.Xr setegid 2 ,
-.Xr setgid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-The
-.Nm
-function call appeared in
-.Bx 4.2
-and was dropped in
-.Bx 4.4 .
diff --git a/lib/libc/compat-43/setregid.c b/lib/libc/compat-43/setregid.c
deleted file mode 100644
index f91418b..0000000
--- a/lib/libc/compat-43/setregid.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)setregid.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <errno.h>
-
-int
-setregid(rgid, egid)
- gid_t rgid, egid;
-{
- static gid_t savedgid = -1;
-
- if (savedgid == -1)
- savedgid = getegid();
- /*
- * we assume that the intent here is to be able to
- * get back rgid priviledge. So we make sure that
- * we will be able to do so, but do not actually
- * set the rgid.
- */
- if (rgid != -1 && rgid != getgid() && rgid != savedgid) {
- errno = EPERM;
- return (-1);
- }
- if (egid != -1 && setegid(egid) < 0)
- return (-1);
- return (0);
-}
diff --git a/lib/libc/compat-43/setreuid.2 b/lib/libc/compat-43/setreuid.2
deleted file mode 100644
index 980da12..0000000
--- a/lib/libc/compat-43/setreuid.2
+++ /dev/null
@@ -1,91 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)setreuid.2 8.2 (Berkeley) 4/16/94
-.\"
-.Dd April 16, 1994
-.Dt SETREUID 2
-.Os BSD 4
-.Sh NAME
-.Nm setreuid
-.Nd set real and effective user ID's
-.Sh SYNOPSIS
-.Fd #include <unistd.h>
-.Ft int
-.Fn setreuid "uid_t ruid" "uid_t euid"
-.Sh DESCRIPTION
-The real and effective user IDs of the
-current process are set according to the arguments.
-If
-.Fa ruid
-or
-.Fa euid
-is -1, the current uid is filled in by the system.
-Unprivileged users may change the real user
-ID to the effective user ID and vice-versa; only the super-user may
-make other changes.
-.Pp
-The
-.Fn setreuid
-function has been used to swap the real and effective user IDs
-in set-user-ID programs to temporarily relinquish the set-user-ID value.
-This purpose is now better served by the use of the
-.Fn seteuid
-function (see
-.Xr setuid 2 ) .
-.Pp
-When setting the real and effective user IDs to the same value,
-the standard
-.Fn setuid
-function is preferred.
-.Sh RETURN VALUES
-Upon successful completion, a value of 0 is returned. Otherwise,
-a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Bl -tag -width [EPERM]
-.It Bq Er EPERM
-The current process is not the super-user and a change
-other than changing the effective user-id to the real user-id
-was specified.
-.El
-.Sh SEE ALSO
-.Xr getuid 2 ,
-.Xr seteuid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-The
-.Nm
-function call appeared in
-.Bx 4.2
-and was dropped in
-.Bx 4.4 .
diff --git a/lib/libc/compat-43/setreuid.c b/lib/libc/compat-43/setreuid.c
deleted file mode 100644
index 4031681..0000000
--- a/lib/libc/compat-43/setreuid.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)setreuid.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <errno.h>
-
-int
-setreuid(ruid, euid)
- uid_t ruid, euid;
-{
- static uid_t saveduid = -1;
-
- if (saveduid == -1)
- saveduid = geteuid();
- /*
- * we assume that the intent here is to be able to
- * get back ruid priviledge. So we make sure that
- * we will be able to do so, but do not actually
- * set the ruid.
- */
- if (ruid != -1 && ruid != getuid() && ruid != saveduid) {
- errno = EPERM;
- return (-1);
- }
- if (euid != -1 && seteuid(euid) < 0)
- return (-1);
- return (0);
-}
diff --git a/lib/libc/gen/ctime.3 b/lib/libc/gen/ctime.3
deleted file mode 100644
index ff6a8ef..0000000
--- a/lib/libc/gen/ctime.3
+++ /dev/null
@@ -1,258 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Arthur Olson.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)ctime.3 8.1 (Berkeley) 6/4/93
-.\"
-.Dd June 4, 1993
-.Dt CTIME 3
-.Os BSD 4.3
-.Sh NAME
-.Nm asctime ,
-.Nm ctime ,
-.Nm difftime ,
-.Nm gmtime ,
-.Nm localtime ,
-.Nm mktime
-.Nd transform binary date and time value to
-.Tn ASCII
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <time.h>
-.Vt extern char *tzname[2];
-.Ft char *
-.Fn ctime "const time_t *clock"
-.Ft double
-.Fn difftime "time_t time1" "time_t time0"
-.Ft char *
-.Fn asctime "const struct tm *tm"
-.Ft struct tm *
-.Fn localtime "const time_t *clock"
-.Ft struct tm *
-.Fn gmtime "const time_t *clock"
-.Ft time_t
-.Fn mktime "struct tm *tm"
-.Sh DESCRIPTION
-The functions
-.Fn ctime ,
-.Fn gmtime
-and
-.Fn localtime
-all take as an argument a time value representing the time in seconds since
-the Epoch (00:00:00
-.Tn UTC ,
-January 1, 1970; see
-.Xr time 3 ) .
-.Pp
-The function
-.Fn localtime
-converts the time value pointed at by
-.Fa clock ,
-and returns a pointer to a
-.Dq Fa struct tm
-(described below) which contains
-the broken-out time information for the value after adjusting for the current
-time zone (and any other factors such as Daylight Saving Time).
-Time zone adjustments are performed as specified by the
-.Ev TZ
-environmental variable (see
-.Xr tzset 3 ) .
-The function
-.Fn localtime
-uses
-.Xr tzset
-to initialize time conversion information if
-.Xr tzset
-has not already been called by the process.
-.Pp
-After filling in the tm structure,
-.Fn localtime
-sets the
-.Fa tm_isdst Ns 'th
-element of
-.Fa tzname
-to a pointer to an
-.Tn ASCII
-string that's the time zone abbreviation to be
-used with
-.Fn localtime Ns 's
-return value.
-.Pp
-The function
-.Fn gmtime
-similarly converts the time value, but without any time zone adjustment,
-and returns a pointer to a tm structure (described below).
-.Pp
-The
-.Fn ctime
-function
-adjusts the time value for the current time zone in the same manner as
-.Fn localtime ,
-and returns a pointer to a 26-character string of the form:
-.Bd -literal -offset indent
-Thu Nov 24 18:22:48 1986\en\e0
-.Ed
-.Pp
-All the fields have constant width.
-.Pp
-The
-.Fn asctime
-function
-converts the broken down time in the structure
-.Fa tm
-pointed at by
-.Fa *tm
-to the form
-shown in the example above.
-.Pp
-The function
-.Fn mktime
-converts the broken-down time, expressed as local time, in the structure
-pointed to by tm into a time value with the same encoding as that of the
-values returned by the
-.Xr time 3
-function, that is, seconds from the Epoch,
-.Tn UTC .
-.Pp
-The original values of the
-.Fa tm_wday
-and
-.Fa tm_yday
-components of the structure are ignored, and the original values of the
-other components are not restricted to their normal ranges.
-(A positive or zero value for
-.Fa tm_isdst
-causes
-.Fn mktime
-to presume initially that summer time (for example, Daylight Saving Time)
-is or is not in effect for the specified time, respectively.
-A negative value for
-.Fa tm_isdst
-causes the
-.Fn mktime
-function to attempt to divine whether summer time is in effect for the
-specified time.)
-.Pp
-On successful completion, the values of the
-.Fa tm_wday
-and
-.Fa tm_yday
-components of the structure are set appropriately, and the other components
-are set to represent the specified calendar time, but with their values
-forced to their normal ranges; the final value of
-.Fa tm_mday
-is not set until
-.Fa tm_mon
-and
-.Fa tm_year
-are determined.
-.Fn Mktime
-returns the specified calendar time; if the calendar time cannot be
-represented, it returns \-1;
-.Pp
-The
-.Fn difftime
-function
-returns the difference between two calendar times,
-.Pf ( Fa time1
--
-.Fa time0 ) ,
-expressed in seconds.
-.Pp
-External declarations as well as the tm structure definition are in the
-.Aq Pa time.h
-include file.
-The tm structure includes at least the following fields:
-.Bd -literal -offset indent
-int tm_sec; /\(** seconds (0 - 60) \(**/
-int tm_min; /\(** minutes (0 - 59) \(**/
-int tm_hour; /\(** hours (0 - 23) \(**/
-int tm_mday; /\(** day of month (1 - 31) \(**/
-int tm_mon; /\(** month of year (0 - 11) \(**/
-int tm_year; /\(** year \- 1900 \(**/
-int tm_wday; /\(** day of week (Sunday = 0) \(**/
-int tm_yday; /\(** day of year (0 - 365) \(**/
-int tm_isdst; /\(** is summer time in effect? \(**/
-char \(**tm_zone; /\(** abbreviation of timezone name \(**/
-long tm_gmtoff; /\(** offset from UTC in seconds \(**/
-.Ed
-.Pp
-The
-field
-.Fa tm_isdst
-is non-zero if summer time is in effect.
-.Pp
-The field
-.Fa tm_gmtoff
-is the offset (in seconds) of the time represented from
-.Tn UTC ,
-with positive
-values indicating east of the Prime Meridian.
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr gettimeofday 2 ,
-.Xr getenv 3 ,
-.Xr time 3 ,
-.Xr tzset 3 ,
-.Xr tzfile 5
-.Sh HISTORY
-This manual page is derived from
-the time package contributed to Berkeley by
-Arthur Olsen and which appeared in
-.Bx 4.3 .
-.Sh BUGS
-Except for
-.Fn difftime
-and
-.Fn mktime ,
-these functions leaves their result in an internal static object and return
-a pointer to that object. Subsequent calls to these
-function will modify the same object.
-.Pp
-The
-.Fa tm_zone
-field of a returned tm structure points to a static array of characters,
-which will also be overwritten by any subsequent calls (as well as by
-subsequent calls to
-.Xr tzset 3
-and
-.Xr tzsetwall 3 ) .
-.Pp
-Use of the external variable
-.Fa tzname
-is discouraged; the
-.Fa tm_zone
-entry in the tm structure is preferred.
-.Pp
-Avoid using out-of-range values with
-.Fn mktime
-when setting up lunch with promptness sticklers in Riyadh.
diff --git a/lib/libc/gen/ctime.c b/lib/libc/gen/ctime.c
deleted file mode 100644
index b11e39b..0000000
--- a/lib/libc/gen/ctime.c
+++ /dev/null
@@ -1,1381 +0,0 @@
-/*
- * Copyright (c) 1987, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Arthur David Olson of the National Cancer Institute.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)ctime.c 8.2 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-
-/*
-** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu).
-** POSIX-style TZ environment variable handling from Guy Harris
-** (guy@auspex.com).
-*/
-
-/*LINTLIBRARY*/
-
-#include <sys/param.h>
-#include <fcntl.h>
-#include <time.h>
-#include <tzfile.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#ifdef __STDC__
-#include <stdlib.h>
-
-#define P(s) s
-#define alloc_size_t size_t
-#define qsort_size_t size_t
-#define fread_size_t size_t
-#define fwrite_size_t size_t
-
-#else /* !defined __STDC__ */
-
-#define P(s) ()
-
-typedef char * genericptr_t;
-typedef unsigned alloc_size_t;
-typedef int qsort_size_t;
-typedef int fread_size_t;
-typedef int fwrite_size_t;
-
-extern char * calloc();
-extern char * malloc();
-extern char * realloc();
-extern char * getenv();
-
-#endif /* !defined __STDC__ */
-
-extern time_t time();
-
-#define ACCESS_MODE O_RDONLY
-#define OPEN_MODE O_RDONLY
-
-#ifndef WILDABBR
-/*
-** Someone might make incorrect use of a time zone abbreviation:
-** 1. They might reference tzname[0] before calling tzset (explicitly
-** or implicitly).
-** 2. They might reference tzname[1] before calling tzset (explicitly
-** or implicitly).
-** 3. They might reference tzname[1] after setting to a time zone
-** in which Daylight Saving Time is never observed.
-** 4. They might reference tzname[0] after setting to a time zone
-** in which Standard Time is never observed.
-** 5. They might reference tm.TM_ZONE after calling offtime.
-** What's best to do in the above cases is open to debate;
-** for now, we just set things up so that in any of the five cases
-** WILDABBR is used. Another possibility: initialize tzname[0] to the
-** string "tzname[0] used before set", and similarly for the other cases.
-** And another: initialize tzname[0] to "ERA", with an explanation in the
-** manual page of what this "time zone abbreviation" means (doing this so
-** that tzname[0] has the "normal" length of three characters).
-*/
-#define WILDABBR " "
-#endif /* !defined WILDABBR */
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif /* !defined TRUE */
-
-static const char GMT[] = "GMT";
-
-struct ttinfo { /* time type information */
- long tt_gmtoff; /* GMT offset in seconds */
- int tt_isdst; /* used to set tm_isdst */
- int tt_abbrind; /* abbreviation list index */
- int tt_ttisstd; /* TRUE if transition is std time */
-};
-
-struct lsinfo { /* leap second information */
- time_t ls_trans; /* transition time */
- long ls_corr; /* correction to apply */
-};
-
-struct state {
- int leapcnt;
- int timecnt;
- int typecnt;
- int charcnt;
- time_t ats[TZ_MAX_TIMES];
- unsigned char types[TZ_MAX_TIMES];
- struct ttinfo ttis[TZ_MAX_TYPES];
- char chars[(TZ_MAX_CHARS + 1 > sizeof GMT) ?
- TZ_MAX_CHARS + 1 : sizeof GMT];
- struct lsinfo lsis[TZ_MAX_LEAPS];
-};
-
-struct rule {
- int r_type; /* type of rule--see below */
- int r_day; /* day number of rule */
- int r_week; /* week number of rule */
- int r_mon; /* month number of rule */
- long r_time; /* transition time of rule */
-};
-
-#define JULIAN_DAY 0 /* Jn - Julian day */
-#define DAY_OF_YEAR 1 /* n - day of year */
-#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */
-
-/*
-** Prototypes for static functions.
-*/
-
-static long detzcode P((const char * codep));
-static const char * getzname P((const char * strp));
-static const char * getnum P((const char * strp, int * nump, int min,
- int max));
-static const char * getsecs P((const char * strp, long * secsp));
-static const char * getoffset P((const char * strp, long * offsetp));
-static const char * getrule P((const char * strp, struct rule * rulep));
-static void gmtload P((struct state * sp));
-static void gmtsub P((const time_t * timep, long offset,
- struct tm * tmp));
-static void localsub P((const time_t * timep, long offset,
- struct tm * tmp));
-static void normalize P((int * tensptr, int * unitsptr, int base));
-static void settzname P((void));
-static time_t time1 P((struct tm * tmp, void (* funcp)(),
- long offset));
-static time_t time2 P((struct tm *tmp, void (* funcp)(),
- long offset, int * okayp));
-static void timesub P((const time_t * timep, long offset,
- const struct state * sp, struct tm * tmp));
-static int tmcomp P((const struct tm * atmp,
- const struct tm * btmp));
-static time_t transtime P((time_t janfirst, int year,
- const struct rule * rulep, long offset));
-static int tzload P((const char * name, struct state * sp));
-static int tzparse P((const char * name, struct state * sp,
- int lastditch));
-
-#ifdef ALL_STATE
-static struct state * lclptr;
-static struct state * gmtptr;
-#endif /* defined ALL_STATE */
-
-#ifndef ALL_STATE
-static struct state lclmem;
-static struct state gmtmem;
-#define lclptr (&lclmem)
-#define gmtptr (&gmtmem)
-#endif /* State Farm */
-
-static int lcl_is_set;
-static int gmt_is_set;
-
-char * tzname[2] = {
- WILDABBR,
- WILDABBR
-};
-
-#ifdef USG_COMPAT
-time_t timezone = 0;
-int daylight = 0;
-#endif /* defined USG_COMPAT */
-
-#ifdef ALTZONE
-time_t altzone = 0;
-#endif /* defined ALTZONE */
-
-static long
-detzcode(codep)
-const char * const codep;
-{
- register long result;
- register int i;
-
- result = 0;
- for (i = 0; i < 4; ++i)
- result = (result << 8) | (codep[i] & 0xff);
- return result;
-}
-
-static void
-settzname()
-{
- register const struct state * const sp = lclptr;
- register int i;
-
- tzname[0] = WILDABBR;
- tzname[1] = WILDABBR;
-#ifdef USG_COMPAT
- daylight = 0;
- timezone = 0;
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
- altzone = 0;
-#endif /* defined ALTZONE */
-#ifdef ALL_STATE
- if (sp == NULL) {
- tzname[0] = tzname[1] = GMT;
- return;
- }
-#endif /* defined ALL_STATE */
- for (i = 0; i < sp->typecnt; ++i) {
- register const struct ttinfo * const ttisp = &sp->ttis[i];
-
- tzname[ttisp->tt_isdst] =
- (char *) &sp->chars[ttisp->tt_abbrind];
-#ifdef USG_COMPAT
- if (ttisp->tt_isdst)
- daylight = 1;
- if (i == 0 || !ttisp->tt_isdst)
- timezone = -(ttisp->tt_gmtoff);
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
- if (i == 0 || ttisp->tt_isdst)
- altzone = -(ttisp->tt_gmtoff);
-#endif /* defined ALTZONE */
- }
- /*
- ** And to get the latest zone names into tzname. . .
- */
- for (i = 0; i < sp->timecnt; ++i) {
- register const struct ttinfo * const ttisp =
- &sp->ttis[sp->types[i]];
-
- tzname[ttisp->tt_isdst] =
- (char *) &sp->chars[ttisp->tt_abbrind];
- }
-}
-
-static int
-tzload(name, sp)
-register const char * name;
-register struct state * const sp;
-{
- register const char * p;
- register int i;
- register int fid;
-
- if (name == NULL && (name = TZDEFAULT) == NULL)
- return -1;
- {
- char fullname[FILENAME_MAX + 1];
-
- if (name[0] == ':')
- ++name;
- if (name[0] != '/') {
- if ((p = TZDIR) == NULL)
- return -1;
- if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
- return -1;
- (void) strcpy(fullname, p);
- (void) strcat(fullname, "/");
- (void) strcat(fullname, name);
- name = fullname;
- }
- if ((fid = open(name, OPEN_MODE)) == -1)
- return -1;
- }
- {
- register const struct tzhead * tzhp;
- char buf[sizeof *sp + sizeof *tzhp];
- int ttisstdcnt;
-
- i = read(fid, buf, sizeof buf);
- if (close(fid) != 0 || i < sizeof *tzhp)
- return -1;
- tzhp = (struct tzhead *) buf;
- ttisstdcnt = (int) detzcode(tzhp->tzh_ttisstdcnt);
- sp->leapcnt = (int) detzcode(tzhp->tzh_leapcnt);
- sp->timecnt = (int) detzcode(tzhp->tzh_timecnt);
- sp->typecnt = (int) detzcode(tzhp->tzh_typecnt);
- sp->charcnt = (int) detzcode(tzhp->tzh_charcnt);
- if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
- sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
- sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
- sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
- (ttisstdcnt != sp->typecnt && ttisstdcnt != 0))
- return -1;
- if (i < sizeof *tzhp +
- sp->timecnt * (4 + sizeof (char)) +
- sp->typecnt * (4 + 2 * sizeof (char)) +
- sp->charcnt * sizeof (char) +
- sp->leapcnt * 2 * 4 +
- ttisstdcnt * sizeof (char))
- return -1;
- p = buf + sizeof *tzhp;
- for (i = 0; i < sp->timecnt; ++i) {
- sp->ats[i] = detzcode(p);
- p += 4;
- }
- for (i = 0; i < sp->timecnt; ++i) {
- sp->types[i] = (unsigned char) *p++;
- if (sp->types[i] >= sp->typecnt)
- return -1;
- }
- for (i = 0; i < sp->typecnt; ++i) {
- register struct ttinfo * ttisp;
-
- ttisp = &sp->ttis[i];
- ttisp->tt_gmtoff = detzcode(p);
- p += 4;
- ttisp->tt_isdst = (unsigned char) *p++;
- if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
- return -1;
- ttisp->tt_abbrind = (unsigned char) *p++;
- if (ttisp->tt_abbrind < 0 ||
- ttisp->tt_abbrind > sp->charcnt)
- return -1;
- }
- for (i = 0; i < sp->charcnt; ++i)
- sp->chars[i] = *p++;
- sp->chars[i] = '\0'; /* ensure '\0' at end */
- for (i = 0; i < sp->leapcnt; ++i) {
- register struct lsinfo * lsisp;
-
- lsisp = &sp->lsis[i];
- lsisp->ls_trans = detzcode(p);
- p += 4;
- lsisp->ls_corr = detzcode(p);
- p += 4;
- }
- for (i = 0; i < sp->typecnt; ++i) {
- register struct ttinfo * ttisp;
-
- ttisp = &sp->ttis[i];
- if (ttisstdcnt == 0)
- ttisp->tt_ttisstd = FALSE;
- else {
- ttisp->tt_ttisstd = *p++;
- if (ttisp->tt_ttisstd != TRUE &&
- ttisp->tt_ttisstd != FALSE)
- return -1;
- }
- }
- }
- return 0;
-}
-
-static const int mon_lengths[2][MONSPERYEAR] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
- 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-static const int year_lengths[2] = {
- DAYSPERNYEAR, DAYSPERLYEAR
-};
-
-/*
-** Given a pointer into a time zone string, scan until a character that is not
-** a valid character in a zone name is found. Return a pointer to that
-** character.
-*/
-
-static const char *
-getzname(strp)
-register const char * strp;
-{
- register char c;
-
- while ((c = *strp) != '\0' && !isdigit(c) && c != ',' && c != '-' &&
- c != '+')
- ++strp;
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number from that string.
-** Check that the number is within a specified range; if it is not, return
-** NULL.
-** Otherwise, return a pointer to the first character not part of the number.
-*/
-
-static const char *
-getnum(strp, nump, min, max)
-register const char * strp;
-int * const nump;
-const int min;
-const int max;
-{
- register char c;
- register int num;
-
- if (strp == NULL || !isdigit(*strp))
- return NULL;
- num = 0;
- while ((c = *strp) != '\0' && isdigit(c)) {
- num = num * 10 + (c - '0');
- if (num > max)
- return NULL; /* illegal value */
- ++strp;
- }
- if (num < min)
- return NULL; /* illegal value */
- *nump = num;
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number of seconds,
-** in hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the number
-** of seconds.
-*/
-
-static const char *
-getsecs(strp, secsp)
-register const char * strp;
-long * const secsp;
-{
- int num;
-
- strp = getnum(strp, &num, 0, HOURSPERDAY);
- if (strp == NULL)
- return NULL;
- *secsp = num * SECSPERHOUR;
- if (*strp == ':') {
- ++strp;
- strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
- if (strp == NULL)
- return NULL;
- *secsp += num * SECSPERMIN;
- if (*strp == ':') {
- ++strp;
- strp = getnum(strp, &num, 0, SECSPERMIN - 1);
- if (strp == NULL)
- return NULL;
- *secsp += num;
- }
- }
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract an offset, in
-** [+-]hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the time.
-*/
-
-static const char *
-getoffset(strp, offsetp)
-register const char * strp;
-long * const offsetp;
-{
- register int neg;
-
- if (*strp == '-') {
- neg = 1;
- ++strp;
- } else if (isdigit(*strp) || *strp++ == '+')
- neg = 0;
- else return NULL; /* illegal offset */
- strp = getsecs(strp, offsetp);
- if (strp == NULL)
- return NULL; /* illegal time */
- if (neg)
- *offsetp = -*offsetp;
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a rule in the form
-** date[/time]. See POSIX section 8 for the format of "date" and "time".
-** If a valid rule is not found, return NULL.
-** Otherwise, return a pointer to the first character not part of the rule.
-*/
-
-static const char *
-getrule(strp, rulep)
-const char * strp;
-register struct rule * const rulep;
-{
- if (*strp == 'J') {
- /*
- ** Julian day.
- */
- rulep->r_type = JULIAN_DAY;
- ++strp;
- strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
- } else if (*strp == 'M') {
- /*
- ** Month, week, day.
- */
- rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
- ++strp;
- strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
- if (strp == NULL)
- return NULL;
- if (*strp++ != '.')
- return NULL;
- strp = getnum(strp, &rulep->r_week, 1, 5);
- if (strp == NULL)
- return NULL;
- if (*strp++ != '.')
- return NULL;
- strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
- } else if (isdigit(*strp)) {
- /*
- ** Day of year.
- */
- rulep->r_type = DAY_OF_YEAR;
- strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
- } else return NULL; /* invalid format */
- if (strp == NULL)
- return NULL;
- if (*strp == '/') {
- /*
- ** Time specified.
- */
- ++strp;
- strp = getsecs(strp, &rulep->r_time);
- } else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */
- return strp;
-}
-
-/*
-** Given the Epoch-relative time of January 1, 00:00:00 GMT, in a year, the
-** year, a rule, and the offset from GMT at the time that rule takes effect,
-** calculate the Epoch-relative time that rule takes effect.
-*/
-
-static time_t
-transtime(janfirst, year, rulep, offset)
-const time_t janfirst;
-const int year;
-register const struct rule * const rulep;
-const long offset;
-{
- register int leapyear;
- register time_t value;
- register int i;
- int d, m1, yy0, yy1, yy2, dow;
-
- leapyear = isleap(year);
- switch (rulep->r_type) {
-
- case JULIAN_DAY:
- /*
- ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
- ** years.
- ** In non-leap years, or if the day number is 59 or less, just
- ** add SECSPERDAY times the day number-1 to the time of
- ** January 1, midnight, to get the day.
- */
- value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
- if (leapyear && rulep->r_day >= 60)
- value += SECSPERDAY;
- break;
-
- case DAY_OF_YEAR:
- /*
- ** n - day of year.
- ** Just add SECSPERDAY times the day number to the time of
- ** January 1, midnight, to get the day.
- */
- value = janfirst + rulep->r_day * SECSPERDAY;
- break;
-
- case MONTH_NTH_DAY_OF_WEEK:
- /*
- ** Mm.n.d - nth "dth day" of month m.
- */
- value = janfirst;
- for (i = 0; i < rulep->r_mon - 1; ++i)
- value += mon_lengths[leapyear][i] * SECSPERDAY;
-
- /*
- ** Use Zeller's Congruence to get day-of-week of first day of
- ** month.
- */
- m1 = (rulep->r_mon + 9) % 12 + 1;
- yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
- yy1 = yy0 / 100;
- yy2 = yy0 % 100;
- dow = ((26 * m1 - 2) / 10 +
- 1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
- if (dow < 0)
- dow += DAYSPERWEEK;
-
- /*
- ** "dow" is the day-of-week of the first day of the month. Get
- ** the day-of-month (zero-origin) of the first "dow" day of the
- ** month.
- */
- d = rulep->r_day - dow;
- if (d < 0)
- d += DAYSPERWEEK;
- for (i = 1; i < rulep->r_week; ++i) {
- if (d + DAYSPERWEEK >=
- mon_lengths[leapyear][rulep->r_mon - 1])
- break;
- d += DAYSPERWEEK;
- }
-
- /*
- ** "d" is the day-of-month (zero-origin) of the day we want.
- */
- value += d * SECSPERDAY;
- break;
- }
-
- /*
- ** "value" is the Epoch-relative time of 00:00:00 GMT on the day in
- ** question. To get the Epoch-relative time of the specified local
- ** time on that day, add the transition time and the current offset
- ** from GMT.
- */
- return value + rulep->r_time + offset;
-}
-
-/*
-** Given a POSIX section 8-style TZ string, fill in the rule tables as
-** appropriate.
-*/
-
-static int
-tzparse(name, sp, lastditch)
-const char * name;
-register struct state * const sp;
-const int lastditch;
-{
- const char * stdname;
- const char * dstname;
- int stdlen;
- int dstlen;
- long stdoffset;
- long dstoffset;
- register time_t * atp;
- register unsigned char * typep;
- register char * cp;
- register int load_result;
-
- stdname = name;
- if (lastditch) {
- stdlen = strlen(name); /* length of standard zone name */
- name += stdlen;
- if (stdlen >= sizeof sp->chars)
- stdlen = (sizeof sp->chars) - 1;
- } else {
- name = getzname(name);
- stdlen = name - stdname;
- if (stdlen < 3)
- return -1;
- }
- if (*name == '\0')
- return -1;
- else {
- name = getoffset(name, &stdoffset);
- if (name == NULL)
- return -1;
- }
- load_result = tzload(TZDEFRULES, sp);
- if (load_result != 0)
- sp->leapcnt = 0; /* so, we're off a little */
- if (*name != '\0') {
- dstname = name;
- name = getzname(name);
- dstlen = name - dstname; /* length of DST zone name */
- if (dstlen < 3)
- return -1;
- if (*name != '\0' && *name != ',' && *name != ';') {
- name = getoffset(name, &dstoffset);
- if (name == NULL)
- return -1;
- } else dstoffset = stdoffset - SECSPERHOUR;
- if (*name == ',' || *name == ';') {
- struct rule start;
- struct rule end;
- register int year;
- register time_t janfirst;
- time_t starttime;
- time_t endtime;
-
- ++name;
- if ((name = getrule(name, &start)) == NULL)
- return -1;
- if (*name++ != ',')
- return -1;
- if ((name = getrule(name, &end)) == NULL)
- return -1;
- if (*name != '\0')
- return -1;
- sp->typecnt = 2; /* standard time and DST */
- /*
- ** Two transitions per year, from EPOCH_YEAR to 2037.
- */
- sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1);
- if (sp->timecnt > TZ_MAX_TIMES)
- return -1;
- sp->ttis[0].tt_gmtoff = -dstoffset;
- sp->ttis[0].tt_isdst = 1;
- sp->ttis[0].tt_abbrind = stdlen + 1;
- sp->ttis[1].tt_gmtoff = -stdoffset;
- sp->ttis[1].tt_isdst = 0;
- sp->ttis[1].tt_abbrind = 0;
- atp = sp->ats;
- typep = sp->types;
- janfirst = 0;
- for (year = EPOCH_YEAR; year <= 2037; ++year) {
- starttime = transtime(janfirst, year, &start,
- stdoffset);
- endtime = transtime(janfirst, year, &end,
- dstoffset);
- if (starttime > endtime) {
- *atp++ = endtime;
- *typep++ = 1; /* DST ends */
- *atp++ = starttime;
- *typep++ = 0; /* DST begins */
- } else {
- *atp++ = starttime;
- *typep++ = 0; /* DST begins */
- *atp++ = endtime;
- *typep++ = 1; /* DST ends */
- }
- janfirst +=
- year_lengths[isleap(year)] * SECSPERDAY;
- }
- } else {
- int sawstd;
- int sawdst;
- long stdfix;
- long dstfix;
- long oldfix;
- int isdst;
- register int i;
-
- if (*name != '\0')
- return -1;
- if (load_result != 0)
- return -1;
- /*
- ** Compute the difference between the real and
- ** prototype standard and summer time offsets
- ** from GMT, and put the real standard and summer
- ** time offsets into the rules in place of the
- ** prototype offsets.
- */
- sawstd = FALSE;
- sawdst = FALSE;
- stdfix = 0;
- dstfix = 0;
- for (i = 0; i < sp->typecnt; ++i) {
- if (sp->ttis[i].tt_isdst) {
- oldfix = dstfix;
- dstfix =
- sp->ttis[i].tt_gmtoff + dstoffset;
- if (sawdst && (oldfix != dstfix))
- return -1;
- sp->ttis[i].tt_gmtoff = -dstoffset;
- sp->ttis[i].tt_abbrind = stdlen + 1;
- sawdst = TRUE;
- } else {
- oldfix = stdfix;
- stdfix =
- sp->ttis[i].tt_gmtoff + stdoffset;
- if (sawstd && (oldfix != stdfix))
- return -1;
- sp->ttis[i].tt_gmtoff = -stdoffset;
- sp->ttis[i].tt_abbrind = 0;
- sawstd = TRUE;
- }
- }
- /*
- ** Make sure we have both standard and summer time.
- */
- if (!sawdst || !sawstd)
- return -1;
- /*
- ** Now correct the transition times by shifting
- ** them by the difference between the real and
- ** prototype offsets. Note that this difference
- ** can be different in standard and summer time;
- ** the prototype probably has a 1-hour difference
- ** between standard and summer time, but a different
- ** difference can be specified in TZ.
- */
- isdst = FALSE; /* we start in standard time */
- for (i = 0; i < sp->timecnt; ++i) {
- register const struct ttinfo * ttisp;
-
- /*
- ** If summer time is in effect, and the
- ** transition time was not specified as
- ** standard time, add the summer time
- ** offset to the transition time;
- ** otherwise, add the standard time offset
- ** to the transition time.
- */
- ttisp = &sp->ttis[sp->types[i]];
- sp->ats[i] +=
- (isdst && !ttisp->tt_ttisstd) ?
- dstfix : stdfix;
- isdst = ttisp->tt_isdst;
- }
- }
- } else {
- dstlen = 0;
- sp->typecnt = 1; /* only standard time */
- sp->timecnt = 0;
- sp->ttis[0].tt_gmtoff = -stdoffset;
- sp->ttis[0].tt_isdst = 0;
- sp->ttis[0].tt_abbrind = 0;
- }
- sp->charcnt = stdlen + 1;
- if (dstlen != 0)
- sp->charcnt += dstlen + 1;
- if (sp->charcnt > sizeof sp->chars)
- return -1;
- cp = sp->chars;
- (void) strncpy(cp, stdname, stdlen);
- cp += stdlen;
- *cp++ = '\0';
- if (dstlen != 0) {
- (void) strncpy(cp, dstname, dstlen);
- *(cp + dstlen) = '\0';
- }
- return 0;
-}
-
-static void
-gmtload(sp)
-struct state * const sp;
-{
- if (tzload(GMT, sp) != 0)
- (void) tzparse(GMT, sp, TRUE);
-}
-
-void
-tzset()
-{
- register const char * name;
- void tzsetwall();
-
- name = getenv("TZ");
- if (name == NULL) {
- tzsetwall();
- return;
- }
- lcl_is_set = TRUE;
-#ifdef ALL_STATE
- if (lclptr == NULL) {
- lclptr = (struct state *) malloc(sizeof *lclptr);
- if (lclptr == NULL) {
- settzname(); /* all we can do */
- return;
- }
- }
-#endif /* defined ALL_STATE */
- if (*name == '\0') {
- /*
- ** User wants it fast rather than right.
- */
- lclptr->leapcnt = 0; /* so, we're off a little */
- lclptr->timecnt = 0;
- lclptr->ttis[0].tt_gmtoff = 0;
- lclptr->ttis[0].tt_abbrind = 0;
- (void) strcpy(lclptr->chars, GMT);
- } else if (tzload(name, lclptr) != 0)
- if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
- (void) gmtload(lclptr);
- settzname();
-}
-
-void
-tzsetwall()
-{
- lcl_is_set = TRUE;
-#ifdef ALL_STATE
- if (lclptr == NULL) {
- lclptr = (struct state *) malloc(sizeof *lclptr);
- if (lclptr == NULL) {
- settzname(); /* all we can do */
- return;
- }
- }
-#endif /* defined ALL_STATE */
- if (tzload((char *) NULL, lclptr) != 0)
- gmtload(lclptr);
- settzname();
-}
-
-/*
-** The easy way to behave "as if no library function calls" localtime
-** is to not call it--so we drop its guts into "localsub", which can be
-** freely called. (And no, the PANS doesn't require the above behavior--
-** but it *is* desirable.)
-**
-** The unused offset argument is for the benefit of mktime variants.
-*/
-
-/*ARGSUSED*/
-static void
-localsub(timep, offset, tmp)
-const time_t * const timep;
-const long offset;
-struct tm * const tmp;
-{
- register struct state * sp;
- register const struct ttinfo * ttisp;
- register int i;
- const time_t t = *timep;
-
- if (!lcl_is_set)
- tzset();
- sp = lclptr;
-#ifdef ALL_STATE
- if (sp == NULL) {
- gmtsub(timep, offset, tmp);
- return;
- }
-#endif /* defined ALL_STATE */
- if (sp->timecnt == 0 || t < sp->ats[0]) {
- i = 0;
- while (sp->ttis[i].tt_isdst)
- if (++i >= sp->typecnt) {
- i = 0;
- break;
- }
- } else {
- for (i = 1; i < sp->timecnt; ++i)
- if (t < sp->ats[i])
- break;
- i = sp->types[i - 1];
- }
- ttisp = &sp->ttis[i];
- /*
- ** To get (wrong) behavior that's compatible with System V Release 2.0
- ** you'd replace the statement below with
- ** t += ttisp->tt_gmtoff;
- ** timesub(&t, 0L, sp, tmp);
- */
- timesub(&t, ttisp->tt_gmtoff, sp, tmp);
- tmp->tm_isdst = ttisp->tt_isdst;
- tzname[tmp->tm_isdst] = (char *) &sp->chars[ttisp->tt_abbrind];
- tmp->tm_zone = &sp->chars[ttisp->tt_abbrind];
-}
-
-struct tm *
-localtime(timep)
-const time_t * const timep;
-{
- static struct tm tm;
-
- localsub(timep, 0L, &tm);
- return &tm;
-}
-
-/*
-** gmtsub is to gmtime as localsub is to localtime.
-*/
-
-static void
-gmtsub(timep, offset, tmp)
-const time_t * const timep;
-const long offset;
-struct tm * const tmp;
-{
- if (!gmt_is_set) {
- gmt_is_set = TRUE;
-#ifdef ALL_STATE
- gmtptr = (struct state *) malloc(sizeof *gmtptr);
- if (gmtptr != NULL)
-#endif /* defined ALL_STATE */
- gmtload(gmtptr);
- }
- timesub(timep, offset, gmtptr, tmp);
- /*
- ** Could get fancy here and deliver something such as
- ** "GMT+xxxx" or "GMT-xxxx" if offset is non-zero,
- ** but this is no time for a treasure hunt.
- */
- if (offset != 0)
- tmp->tm_zone = WILDABBR;
- else {
-#ifdef ALL_STATE
- if (gmtptr == NULL)
- tmp->TM_ZONE = GMT;
- else tmp->TM_ZONE = gmtptr->chars;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
- tmp->tm_zone = gmtptr->chars;
-#endif /* State Farm */
- }
-}
-
-struct tm *
-gmtime(timep)
-const time_t * const timep;
-{
- static struct tm tm;
-
- gmtsub(timep, 0L, &tm);
- return &tm;
-}
-
-static void
-timesub(timep, offset, sp, tmp)
-const time_t * const timep;
-const long offset;
-register const struct state * const sp;
-register struct tm * const tmp;
-{
- register const struct lsinfo * lp;
- register long days;
- register long rem;
- register int y;
- register int yleap;
- register const int * ip;
- register long corr;
- register int hit;
- register int i;
-
- corr = 0;
- hit = FALSE;
-#ifdef ALL_STATE
- i = (sp == NULL) ? 0 : sp->leapcnt;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
- i = sp->leapcnt;
-#endif /* State Farm */
- while (--i >= 0) {
- lp = &sp->lsis[i];
- if (*timep >= lp->ls_trans) {
- if (*timep == lp->ls_trans)
- hit = ((i == 0 && lp->ls_corr > 0) ||
- lp->ls_corr > sp->lsis[i - 1].ls_corr);
- corr = lp->ls_corr;
- break;
- }
- }
- days = *timep / SECSPERDAY;
- rem = *timep % SECSPERDAY;
-#ifdef mc68k
- if (*timep == 0x80000000) {
- /*
- ** A 3B1 muffs the division on the most negative number.
- */
- days = -24855;
- rem = -11648;
- }
-#endif /* mc68k */
- rem += (offset - corr);
- while (rem < 0) {
- rem += SECSPERDAY;
- --days;
- }
- while (rem >= SECSPERDAY) {
- rem -= SECSPERDAY;
- ++days;
- }
- tmp->tm_hour = (int) (rem / SECSPERHOUR);
- rem = rem % SECSPERHOUR;
- tmp->tm_min = (int) (rem / SECSPERMIN);
- tmp->tm_sec = (int) (rem % SECSPERMIN);
- if (hit)
- /*
- ** A positive leap second requires a special
- ** representation. This uses "... ??:59:60".
- */
- ++(tmp->tm_sec);
- tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK);
- if (tmp->tm_wday < 0)
- tmp->tm_wday += DAYSPERWEEK;
- y = EPOCH_YEAR;
- if (days >= 0)
- for ( ; ; ) {
- yleap = isleap(y);
- if (days < (long) year_lengths[yleap])
- break;
- ++y;
- days = days - (long) year_lengths[yleap];
- }
- else do {
- --y;
- yleap = isleap(y);
- days = days + (long) year_lengths[yleap];
- } while (days < 0);
- tmp->tm_year = y - TM_YEAR_BASE;
- tmp->tm_yday = (int) days;
- ip = mon_lengths[yleap];
- for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
- days = days - (long) ip[tmp->tm_mon];
- tmp->tm_mday = (int) (days + 1);
- tmp->tm_isdst = 0;
- tmp->tm_gmtoff = offset;
-}
-
-/*
-** A la X3J11
-*/
-
-char *
-asctime(timeptr)
-register const struct tm * timeptr;
-{
- static const char wday_name[DAYSPERWEEK][3] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
- static const char mon_name[MONSPERYEAR][3] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
- static char result[26];
-
- (void) sprintf(result, "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n",
- wday_name[timeptr->tm_wday],
- mon_name[timeptr->tm_mon],
- timeptr->tm_mday, timeptr->tm_hour,
- timeptr->tm_min, timeptr->tm_sec,
- TM_YEAR_BASE + timeptr->tm_year);
- return result;
-}
-
-char *
-ctime(timep)
-const time_t * const timep;
-{
- return asctime(localtime(timep));
-}
-
-/*
-** Adapted from code provided by Robert Elz, who writes:
-** The "best" way to do mktime I think is based on an idea of Bob
-** Kridle's (so its said...) from a long time ago. (mtxinu!kridle now).
-** It does a binary search of the time_t space. Since time_t's are
-** just 32 bits, its a max of 32 iterations (even at 64 bits it
-** would still be very reasonable).
-*/
-
-#ifndef WRONG
-#define WRONG (-1)
-#endif /* !defined WRONG */
-
-static void
-normalize(tensptr, unitsptr, base)
-int * const tensptr;
-int * const unitsptr;
-const int base;
-{
- if (*unitsptr >= base) {
- *tensptr += *unitsptr / base;
- *unitsptr %= base;
- } else if (*unitsptr < 0) {
- *tensptr -= 1 + (-(*unitsptr + 1)) / base;
- *unitsptr = base - 1 - (-(*unitsptr + 1)) % base;
- }
-}
-
-static int
-tmcomp(atmp, btmp)
-register const struct tm * const atmp;
-register const struct tm * const btmp;
-{
- register int result;
-
- if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
- (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
- (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
- (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
- (result = (atmp->tm_min - btmp->tm_min)) == 0)
- result = atmp->tm_sec - btmp->tm_sec;
- return result;
-}
-
-static time_t
-time2(tmp, funcp, offset, okayp)
-struct tm * const tmp;
-void (* const funcp)();
-const long offset;
-int * const okayp;
-{
- register const struct state * sp;
- register int dir;
- register int bits;
- register int i, j ;
- register int saved_seconds;
- time_t newt;
- time_t t;
- struct tm yourtm, mytm;
-
- *okayp = FALSE;
- yourtm = *tmp;
- if (yourtm.tm_sec >= SECSPERMIN + 2 || yourtm.tm_sec < 0)
- normalize(&yourtm.tm_min, &yourtm.tm_sec, SECSPERMIN);
- normalize(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR);
- normalize(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY);
- normalize(&yourtm.tm_year, &yourtm.tm_mon, MONSPERYEAR);
- while (yourtm.tm_mday <= 0) {
- --yourtm.tm_year;
- yourtm.tm_mday +=
- year_lengths[isleap(yourtm.tm_year + TM_YEAR_BASE)];
- }
- while (yourtm.tm_mday > DAYSPERLYEAR) {
- yourtm.tm_mday -=
- year_lengths[isleap(yourtm.tm_year + TM_YEAR_BASE)];
- ++yourtm.tm_year;
- }
- for ( ; ; ) {
- i = mon_lengths[isleap(yourtm.tm_year +
- TM_YEAR_BASE)][yourtm.tm_mon];
- if (yourtm.tm_mday <= i)
- break;
- yourtm.tm_mday -= i;
- if (++yourtm.tm_mon >= MONSPERYEAR) {
- yourtm.tm_mon = 0;
- ++yourtm.tm_year;
- }
- }
- saved_seconds = yourtm.tm_sec;
- yourtm.tm_sec = 0;
- /*
- ** Calculate the number of magnitude bits in a time_t
- ** (this works regardless of whether time_t is
- ** signed or unsigned, though lint complains if unsigned).
- */
- for (bits = 0, t = 1; t > 0; ++bits, t <<= 1)
- ;
- /*
- ** If time_t is signed, then 0 is the median value,
- ** if time_t is unsigned, then 1 << bits is median.
- */
- t = (t < 0) ? 0 : ((time_t) 1 << bits);
- for ( ; ; ) {
- (*funcp)(&t, offset, &mytm);
- dir = tmcomp(&mytm, &yourtm);
- if (dir != 0) {
- if (bits-- < 0)
- return WRONG;
- if (bits < 0)
- --t;
- else if (dir > 0)
- t -= (time_t) 1 << bits;
- else t += (time_t) 1 << bits;
- continue;
- }
- if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
- break;
- /*
- ** Right time, wrong type.
- ** Hunt for right time, right type.
- ** It's okay to guess wrong since the guess
- ** gets checked.
- */
- sp = (const struct state *)
- ((funcp == localsub) ? lclptr : gmtptr);
-#ifdef ALL_STATE
- if (sp == NULL)
- return WRONG;
-#endif /* defined ALL_STATE */
- for (i = 0; i < sp->typecnt; ++i) {
- if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
- continue;
- for (j = 0; j < sp->typecnt; ++j) {
- if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
- continue;
- newt = t + sp->ttis[j].tt_gmtoff -
- sp->ttis[i].tt_gmtoff;
- (*funcp)(&newt, offset, &mytm);
- if (tmcomp(&mytm, &yourtm) != 0)
- continue;
- if (mytm.tm_isdst != yourtm.tm_isdst)
- continue;
- /*
- ** We have a match.
- */
- t = newt;
- goto label;
- }
- }
- return WRONG;
- }
-label:
- t += saved_seconds;
- (*funcp)(&t, offset, tmp);
- *okayp = TRUE;
- return t;
-}
-
-static time_t
-time1(tmp, funcp, offset)
-struct tm * const tmp;
-void (* const funcp)();
-const long offset;
-{
- register time_t t;
- register const struct state * sp;
- register int samei, otheri;
- int okay;
-
- if (tmp->tm_isdst > 1)
- tmp->tm_isdst = 1;
- t = time2(tmp, funcp, offset, &okay);
- if (okay || tmp->tm_isdst < 0)
- return t;
- /*
- ** We're supposed to assume that somebody took a time of one type
- ** and did some math on it that yielded a "struct tm" that's bad.
- ** We try to divine the type they started from and adjust to the
- ** type they need.
- */
- sp = (const struct state *) ((funcp == localsub) ? lclptr : gmtptr);
-#ifdef ALL_STATE
- if (sp == NULL)
- return WRONG;
-#endif /* defined ALL_STATE */
- for (samei = 0; samei < sp->typecnt; ++samei) {
- if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
- continue;
- for (otheri = 0; otheri < sp->typecnt; ++otheri) {
- if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
- continue;
- tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
- sp->ttis[samei].tt_gmtoff;
- tmp->tm_isdst = !tmp->tm_isdst;
- t = time2(tmp, funcp, offset, &okay);
- if (okay)
- return t;
- tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
- sp->ttis[samei].tt_gmtoff;
- tmp->tm_isdst = !tmp->tm_isdst;
- }
- }
- return WRONG;
-}
-
-time_t
-mktime(tmp)
-struct tm * const tmp;
-{
- return time1(tmp, localsub, 0L);
-}
diff --git a/lib/libc/gen/difftime.c b/lib/libc/gen/difftime.c
deleted file mode 100644
index 3941330..0000000
--- a/lib/libc/gen/difftime.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)difftime.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-
-double
-difftime(time1, time0)
- time_t time1, time0;
-{
- return(time1 - time0);
-}
diff --git a/lib/libc/gen/sigsetjmp.c b/lib/libc/gen/sigsetjmp.c
deleted file mode 100644
index ca960a6..0000000
--- a/lib/libc/gen/sigsetjmp.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)sigsetjmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <setjmp.h>
-
-int
-sigsetjmp(jmpbuf, savemask)
- sigjmp_buf jmpbuf;
- int savemask;
-{
-
- jmpbuf[_JBLEN] = savemask;
- if (savemask)
- return (setjmp(jmpbuf));
- return (_setjmp(jmpbuf));
-}
-
-void
-siglongjmp(jmpbuf, retval)
- sigjmp_buf jmpbuf;
- int retval;
-{
-
- if (jmpbuf[_JBLEN])
- return (longjmp(jmpbuf, retval));
- return (_longjmp(jmpbuf, retval));
-}
diff --git a/lib/libc/i386/gen/_setjmp.s b/lib/libc/i386/gen/_setjmp.s
deleted file mode 100644
index 47e319a..0000000
--- a/lib/libc/i386/gen/_setjmp.s
+++ /dev/null
@@ -1,78 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * C library -- _setjmp, _longjmp
- *
- * _longjmp(a,v)
- * will generate a "return(v)" from the last call to
- * _setjmp(a)
- * by restoring registers from the stack.
- * The previous signal state is NOT restored.
- */
-
-#include "DEFS.h"
-
-ENTRY(_setjmp)
- movl 4(%esp),%eax
- movl 0(%esp),%edx
- movl %edx, 0(%eax) /* rta */
- movl %ebx, 4(%eax)
- movl %esp, 8(%eax)
- movl %ebp,12(%eax)
- movl %esi,16(%eax)
- movl %edi,20(%eax)
- movl $0,%eax
- ret
-
-ENTRY(_longjmp)
- movl 4(%esp),%edx
- movl 8(%esp),%eax
- movl 0(%edx),%ecx
- movl 4(%edx),%ebx
- movl 8(%edx),%esp
- movl 12(%edx),%ebp
- movl 16(%edx),%esi
- movl 20(%edx),%edi
- cmpl $0,%eax
- jne 1f
- movl $1,%eax
-1: movl %ecx,0(%esp)
- ret
diff --git a/lib/libc/i386/gen/alloca.s b/lib/libc/i386/gen/alloca.s
deleted file mode 100644
index a2d6a41..0000000
--- a/lib/libc/i386/gen/alloca.s
+++ /dev/null
@@ -1,57 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)alloca.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/* like alloc, but automatic automatic free in return */
-
-#include "DEFS.h"
-
-ENTRY(alloca)
- popl %edx /* pop return addr */
- popl %eax /* pop amount to allocate */
- movl %esp,%ecx
- addl $3,%eax /* round up to next word */
- andl $0xfffffffc,%eax
- subl %eax,%esp
- movl %esp,%eax /* base of newly allocated space */
- pushl 8(%ecx) /* copy possible saved registers */
- pushl 4(%ecx)
- pushl 0(%ecx)
- pushl %eax /* dummy to pop at callsite */
- jmp %edx /* "return" */
diff --git a/lib/libc/i386/gen/divsi3.s b/lib/libc/i386/gen/divsi3.s
deleted file mode 100644
index 946a4a1..0000000
--- a/lib/libc/i386/gen/divsi3.s
+++ /dev/null
@@ -1,46 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)divsi3.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
- .globl ___divsi3
-___divsi3:
- movl 4(%esp),%eax
- cltd
- idivl 8(%esp)
- ret
diff --git a/lib/libc/i386/gen/fabs.s b/lib/libc/i386/gen/fabs.s
deleted file mode 100644
index 40e72c8..0000000
--- a/lib/libc/i386/gen/fabs.s
+++ /dev/null
@@ -1,46 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)fabs.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-#include "DEFS.h"
-
-ENTRY(fabs)
- fldl 4(%esp)
- fabs
- ret
diff --git a/lib/libc/i386/gen/fixdfsi.s b/lib/libc/i386/gen/fixdfsi.s
deleted file mode 100644
index 138d078..0000000
--- a/lib/libc/i386/gen/fixdfsi.s
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)fixdfsi.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
- .globl ___fixdfsi
-___fixdfsi:
- fldl 4(%esp)
- fistpl 4(%esp)
- movl 4(%esp),%eax
- ret
diff --git a/lib/libc/i386/gen/fixunsdfsi.s b/lib/libc/i386/gen/fixunsdfsi.s
deleted file mode 100644
index 7025bb6..0000000
--- a/lib/libc/i386/gen/fixunsdfsi.s
+++ /dev/null
@@ -1,60 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)fixunsdfsi.s 8.1 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
- .globl ___fixunsdfsi
-___fixunsdfsi:
- fldl 4(%esp) /* argument double to accum stack */
- frndint /* create integer */
- fcoml fbiggestsigned /* bigger than biggest signed? */
- fstsw %ax
- sahf
- jnb 1f
-
- fistpl 4(%esp)
- movl 4(%esp),%eax
- ret
-
-1: fsubl fbiggestsigned /* reduce for proper conversion */
- fistpl 4(%esp) /* convert */
- movl 4(%esp),%eax
- orl $0x80000000,%eax /* restore bias */
- ret
-
-fbiggestsigned: .double 0r2147483648.0
diff --git a/lib/libc/i386/gen/modf.s b/lib/libc/i386/gen/modf.s
deleted file mode 100644
index 2551237..0000000
--- a/lib/libc/i386/gen/modf.s
+++ /dev/null
@@ -1,75 +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
- * Sean Eric Fagan.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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)
- .asciz "@(#)modf.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * modf(value, iptr): return fractional part of value, and stores the
- * integral part into iptr (a pointer to double).
- *
- * Written by Sean Eric Fagan (sef@kithrup.COM)
- * Sun Mar 11 20:27:30 PST 1990
- */
-
-/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */
-.text
-.globl _modf
-_modf:
- pushl %ebp
- movl %esp,%ebp
- subl $16,%esp
- fnstcw -12(%ebp)
- movw -12(%ebp),%dx
- orw $3072,%dx
- movw %dx,-16(%ebp)
- fldcw -16(%ebp)
- fldl 8(%ebp)
- frndint
- fstpl -8(%ebp)
- fldcw -12(%ebp)
- movl 16(%ebp),%eax
- movl -8(%ebp),%edx
- movl -4(%ebp),%ecx
- movl %edx,(%eax)
- movl %ecx,4(%eax)
- fldl 8(%ebp)
- fsubl -8(%ebp)
- jmp L1
-L1:
- leave
- ret
diff --git a/lib/libc/i386/gen/setjmp.s b/lib/libc/i386/gen/setjmp.s
deleted file mode 100644
index b24da11..0000000
--- a/lib/libc/i386/gen/setjmp.s
+++ /dev/null
@@ -1,86 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * C library -- _setjmp, _longjmp
- *
- * longjmp(a,v)
- * will generate a "return(v)" from the last call to
- * setjmp(a)
- * by restoring registers from the stack.
- * The previous signal state is restored.
- */
-
-#include "DEFS.h"
-
-ENTRY(setjmp)
- pushl $0
- call _sigblock
- popl %edx
- movl 4(%esp),%ecx
- movl 0(%esp),%edx
- movl %edx, 0(%ecx)
- movl %ebx, 4(%ecx)
- movl %esp, 8(%ecx)
- movl %ebp,12(%ecx)
- movl %esi,16(%ecx)
- movl %edi,20(%ecx)
- movl %eax,24(%ecx)
- movl $0,%eax
- ret
-
-ENTRY(longjmp)
- movl 4(%esp),%edx
- pushl 24(%edx)
- call _sigsetmask
- popl %eax
- movl 4(%esp),%edx
- movl 8(%esp),%eax
- movl 0(%edx),%ecx
- movl 4(%edx),%ebx
- movl 8(%edx),%esp
- movl 12(%edx),%ebp
- movl 16(%edx),%esi
- movl 20(%edx),%edi
- cmpl $0,%eax
- jne 1f
- movl $1,%eax
-1: movl %ecx,0(%esp)
- ret
diff --git a/lib/libc/i386/gen/udivsi3.s b/lib/libc/i386/gen/udivsi3.s
deleted file mode 100644
index 791e526..0000000
--- a/lib/libc/i386/gen/udivsi3.s
+++ /dev/null
@@ -1,46 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)udivsi3.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
- .globl ___udivsi3
-___udivsi3:
- movl 4(%esp),%eax
- xorl %edx,%edx
- divl 8(%esp)
- ret
diff --git a/lib/libc/i386/net/htonl.s b/lib/libc/i386/net/htonl.s
deleted file mode 100644
index 01d93c8..0000000
--- a/lib/libc/i386/net/htonl.s
+++ /dev/null
@@ -1,50 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)htonl.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/* netorder = htonl(hostorder) */
-
-#include "DEFS.h"
-
-ENTRY(htonl)
- movl 4(%esp),%eax
- xchgb %al,%ah
- roll $16,%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/i386/net/htons.s b/lib/libc/i386/net/htons.s
deleted file mode 100644
index 74a76ab..0000000
--- a/lib/libc/i386/net/htons.s
+++ /dev/null
@@ -1,48 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)htons.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/* netorder = htons(hostorder) */
-
-#include "DEFS.h"
-
-ENTRY(htons)
- movzwl 4(%esp),%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/i386/net/ntohl.s b/lib/libc/i386/net/ntohl.s
deleted file mode 100644
index 29802fa..0000000
--- a/lib/libc/i386/net/ntohl.s
+++ /dev/null
@@ -1,50 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)ntohl.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/* hostorder = ntohl(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohl)
- movl 4(%esp),%eax
- xchgb %al,%ah
- roll $16,%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/i386/net/ntohs.s b/lib/libc/i386/net/ntohs.s
deleted file mode 100644
index 4b521da..0000000
--- a/lib/libc/i386/net/ntohs.s
+++ /dev/null
@@ -1,48 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)ntohs.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/* hostorder = ntohs(netorder) */
-
-#include "DEFS.h"
-
-ENTRY(ntohs)
- movzwl 4(%esp),%eax
- xchgb %al,%ah
- ret
diff --git a/lib/libc/i386/stdlib/abs.s b/lib/libc/i386/stdlib/abs.s
deleted file mode 100644
index 755ea56..0000000
--- a/lib/libc/i386/stdlib/abs.s
+++ /dev/null
@@ -1,48 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)abs.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-#include "DEFS.h"
-
-ENTRY(abs)
- movl 4(%esp),%eax
- cmpl $0,%eax
- jge 1f
- negl %eax
-1: ret
diff --git a/lib/libc/i386/string/bzero.s b/lib/libc/i386/string/bzero.s
deleted file mode 100644
index 79a5a69..0000000
--- a/lib/libc/i386/string/bzero.s
+++ /dev/null
@@ -1,53 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)bzero.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-/* bzero (base,cnt) */
-
- .globl _bzero
-_bzero:
- pushl %edi
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- movb $0x00,%al
- cld
- rep
- stosb
- popl %edi
- ret
diff --git a/lib/libc/i386/sys/Ovfork.s b/lib/libc/i386/sys/Ovfork.s
deleted file mode 100644
index c7e6b8a..0000000
--- a/lib/libc/i386/sys/Ovfork.s
+++ /dev/null
@@ -1,70 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)Ovfork.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-/*
- * pid = vfork();
- *
- * %edx == 0 in parent process, %edx == 1 in child process.
- * %eax == pid of child in parent, %eax == pid of parent in child.
- *
- */
- .set vfork,66
-.globl _vfork
-
-_vfork:
- popl %ecx /* my rta into ecx */
- movl $vfork, %eax
- LCALL(7,0)
- jb verror
-vforkok:
- cmpl $0,%edx /* child process? */
- jne child /* yes */
- jmp parent
-.globl _errno
-verror:
- movl %eax,_errno
- movl $-1,%eax
- jmp %ecx
-child:
- movl $0,%eax
-parent:
- jmp %ecx
diff --git a/lib/libc/i386/sys/brk.s b/lib/libc/i386/sys/brk.s
deleted file mode 100644
index f85186c..0000000
--- a/lib/libc/i386/sys/brk.s
+++ /dev/null
@@ -1,65 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-#define SYS_brk 17
-
- .globl curbrk
- .globl minbrk
-ENTRY(_brk)
- jmp ok
-
-ENTRY(brk)
- movl 4(%esp),%eax
- cmpl %eax,minbrk
- jl ok
- movl minbrk,%eax
- movl %eax,4(%esp)
-ok:
- lea SYS_brk,%eax
- LCALL(7,0)
- jb err
- movl 4(%esp),%eax
- movl %eax,curbrk
- movl $0,%eax
- ret
-err:
- jmp cerror
diff --git a/lib/libc/i386/sys/cerror.s b/lib/libc/i386/sys/cerror.s
deleted file mode 100644
index cc2d82f..0000000
--- a/lib/libc/i386/sys/cerror.s
+++ /dev/null
@@ -1,47 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
- .globl _errno
-cerror:
- movl %eax,_errno
- movl $-1,%eax
- ret
diff --git a/lib/libc/i386/sys/exect.s b/lib/libc/i386/sys/exect.s
deleted file mode 100644
index 6b42cf8..0000000
--- a/lib/libc/i386/sys/exect.s
+++ /dev/null
@@ -1,52 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)exect.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-#include <machine/psl.h>
-
-ENTRY(exect)
- lea SYS_execve,%eax
- pushf
- popl %edx
- orl $ PSL_T,%edx
- pushl %edx
- popf
- LCALL(7,0)
- jmp cerror /* exect(file, argv, env); */
diff --git a/lib/libc/i386/sys/fork.s b/lib/libc/i386/sys/fork.s
deleted file mode 100644
index ff4d948..0000000
--- a/lib/libc/i386/sys/fork.s
+++ /dev/null
@@ -1,48 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-SYSCALL(fork)
- cmpl $0,%edx /* parent, since %edx == 0 in parent, 1 in child */
- je 1f
- movl $0,%eax
-1:
- ret /* pid = fork(); */
diff --git a/lib/libc/i386/sys/mount.s b/lib/libc/i386/sys/mount.s
deleted file mode 100644
index ac418f7..0000000
--- a/lib/libc/i386/sys/mount.s
+++ /dev/null
@@ -1,45 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)mount.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-SYSCALL(mount)
- movl $0,%eax
- ret
diff --git a/lib/libc/i386/sys/pipe.s b/lib/libc/i386/sys/pipe.s
deleted file mode 100644
index 6469397..0000000
--- a/lib/libc/i386/sys/pipe.s
+++ /dev/null
@@ -1,48 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)pipe.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-SYSCALL(pipe)
- movl 4(%esp),%ecx
- movl %eax,(%ecx)
- movl %edx,4(%ecx)
- movl $0,%eax
- ret
diff --git a/lib/libc/i386/sys/ptrace.s b/lib/libc/i386/sys/ptrace.s
deleted file mode 100644
index 98994ea..0000000
--- a/lib/libc/i386/sys/ptrace.s
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-ENTRY(ptrace)
- xorl %eax,%eax
- movl %eax,_errno
- lea SYS_ptrace,%eax
- LCALL(7,0)
- jb err
- ret
-err:
- jmp cerror
diff --git a/lib/libc/i386/sys/reboot.s b/lib/libc/i386/sys/reboot.s
deleted file mode 100644
index 020bea0..0000000
--- a/lib/libc/i386/sys/reboot.s
+++ /dev/null
@@ -1,44 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)reboot.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-SYSCALL(reboot)
- iret
diff --git a/lib/libc/i386/sys/sbrk.s b/lib/libc/i386/sys/sbrk.s
deleted file mode 100644
index 7fecd93..0000000
--- a/lib/libc/i386/sys/sbrk.s
+++ /dev/null
@@ -1,65 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-#define SYS_brk 17
-
- .globl _end
- .globl minbrk
- .globl curbrk
-
- .data
-minbrk: .long _end
-curbrk: .long _end
- .text
-
-ENTRY(sbrk)
- movl 4(%esp),%ecx
- movl curbrk,%eax
- addl %eax,4(%esp)
- lea SYS_brk,%eax
- LCALL(7,0)
- jb err
- movl curbrk,%eax
- addl %ecx,curbrk
- ret
-err:
- jmp cerror
diff --git a/lib/libc/i386/sys/setlogin.s b/lib/libc/i386/sys/setlogin.s
deleted file mode 100644
index 43d31d7..0000000
--- a/lib/libc/i386/sys/setlogin.s
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)setlogin.s 8.1 (Berkeley) 6/4/93"
-#endif /* LIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-.globl __logname_valid /* in getlogin() */
-
-SYSCALL(setlogin)
- movl $0,__logname_valid
- ret /* setlogin(name) */
diff --git a/lib/libc/i386/sys/sigpending.s b/lib/libc/i386/sys/sigpending.s
deleted file mode 100644
index 63b06a2..0000000
--- a/lib/libc/i386/sys/sigpending.s
+++ /dev/null
@@ -1,47 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigpending.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-SYSCALL(sigpending)
- movl 4(%esp),%ecx # fetch pointer to...
- movl %eax,(%ecx) # store old mask
- xorl %eax,%eax
- ret
diff --git a/lib/libc/i386/sys/sigprocmask.s b/lib/libc/i386/sys/sigprocmask.s
deleted file mode 100644
index ef91e80..0000000
--- a/lib/libc/i386/sys/sigprocmask.s
+++ /dev/null
@@ -1,64 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigprocmask.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-err:
- jmp cerror
-
-ENTRY(sigprocmask)
- movl 8(%esp),%ecx # fetch new sigset pointer
- cmpl $0,%ecx # check new sigset pointer
- jne 1f # if not null, indirect
-/* movl $0,8(%esp) # null mask pointer: block empty set */
- movl $1,4(%esp) # SIG_BLOCK
- jmp 2f
-1: movl (%ecx),%ecx # fetch indirect ...
- movl %ecx,8(%esp) # to new mask arg
-2: movl $ SYS_sigprocmask , %eax
- LCALL(0x7,0)
- jb err
- movl 12(%esp),%ecx # fetch old mask requested
- cmpl $0,%ecx # test if old mask requested
- je out
- movl %eax,(%ecx) # store old mask
-out:
- xorl %eax,%eax
- ret
diff --git a/lib/libc/i386/sys/sigreturn.s b/lib/libc/i386/sys/sigreturn.s
deleted file mode 100644
index 1bd6a3b..0000000
--- a/lib/libc/i386/sys/sigreturn.s
+++ /dev/null
@@ -1,54 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigreturn.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-/*
- * We must preserve the state of the registers as the user has set them up.
- */
-#ifdef PROF
-#undef ENTRY
-#define ENTRY(x) \
- .globl _/**/x; .align 2; _/**/x: pusha ; \
- .data; 1:; .long 0; .text; movl $1b,%eax; call mcount; popa ; nop
-#endif /* PROF */
-
-SYSCALL(sigreturn)
- ret
diff --git a/lib/libc/i386/sys/sigsuspend.s b/lib/libc/i386/sys/sigsuspend.s
deleted file mode 100644
index afbc1ba..0000000
--- a/lib/libc/i386/sys/sigsuspend.s
+++ /dev/null
@@ -1,54 +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
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigsuspend.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-err:
- jmp cerror
-
-ENTRY(sigsuspend)
- movl 4(%esp),%eax # fetch mask arg
- movl (%eax),%eax # indirect to mask arg
- movl %eax,4(%esp)
- movl $ SYS_sigsuspend ,%eax
- LCALL(0x7,0)
- jb err
- xorl %eax,%eax # shouldn t happen
- ret
diff --git a/lib/libc/i386/sys/syscall.s b/lib/libc/i386/sys/syscall.s
deleted file mode 100644
index 189f4dd..0000000
--- a/lib/libc/i386/sys/syscall.s
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)syscall.s 8.1 (Berkeley) 6/4/93"
-#endif /* SYSLIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-ENTRY(syscall)
- pop %ecx /* rta */
- pop %eax /* syscall number */
- push %ecx
- LCALL(7,0)
- jb 1f
- ret
-1:
- jmp cerror
diff --git a/lib/libc/net/getnetbyname.c b/lib/libc/net/getnetbyname.c
deleted file mode 100644
index 5082a7a..0000000
--- a/lib/libc/net/getnetbyname.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetbyname.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <netdb.h>
-#include <string.h>
-
-extern int _net_stayopen;
-
-struct netent *
-getnetbyname(name)
- register const char *name;
-{
- register struct netent *p;
- register char **cp;
-
- setnetent(_net_stayopen);
- while (p = getnetent()) {
- if (strcmp(p->n_name, name) == 0)
- break;
- for (cp = p->n_aliases; *cp != 0; cp++)
- if (strcmp(*cp, name) == 0)
- goto found;
- }
-found:
- if (!_net_stayopen)
- endnetent();
- return (p);
-}
diff --git a/lib/libc/net/getnetent.c b/lib/libc/net/getnetent.c
deleted file mode 100644
index 49ec9b7..0000000
--- a/lib/libc/net/getnetent.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <string.h>
-
-#define MAXALIASES 35
-
-static FILE *netf;
-static char line[BUFSIZ+1];
-static struct netent net;
-static char *net_aliases[MAXALIASES];
-int _net_stayopen;
-
-void
-setnetent(f)
- int f;
-{
- if (netf == NULL)
- netf = fopen(_PATH_NETWORKS, "r" );
- else
- rewind(netf);
- _net_stayopen |= f;
-}
-
-void
-endnetent()
-{
- if (netf) {
- fclose(netf);
- netf = NULL;
- }
- _net_stayopen = 0;
-}
-
-struct netent *
-getnetent()
-{
- char *p;
- register char *cp, **q;
-
- if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL)
- return (NULL);
-again:
- p = fgets(line, BUFSIZ, netf);
- if (p == NULL)
- return (NULL);
- if (*p == '#')
- goto again;
- cp = strpbrk(p, "#\n");
- if (cp == NULL)
- goto again;
- *cp = '\0';
- net.n_name = p;
- cp = strpbrk(p, " \t");
- if (cp == NULL)
- goto again;
- *cp++ = '\0';
- while (*cp == ' ' || *cp == '\t')
- cp++;
- p = strpbrk(cp, " \t");
- if (p != NULL)
- *p++ = '\0';
- net.n_net = inet_network(cp);
- net.n_addrtype = AF_INET;
- q = net.n_aliases = net_aliases;
- if (p != NULL)
- cp = p;
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &net_aliases[MAXALIASES - 1])
- *q++ = cp;
- cp = strpbrk(cp, " \t");
- if (cp != NULL)
- *cp++ = '\0';
- }
- *q = NULL;
- return (&net);
-}
diff --git a/lib/libc/net/sethostent.c b/lib/libc/net/sethostent.c
deleted file mode 100644
index dbc6e20..0000000
--- a/lib/libc/net/sethostent.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sethostent.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <netdb.h>
-#include <resolv.h>
-
-void
-sethostent(stayopen)
-{
- if (stayopen)
- _res.options |= RES_STAYOPEN | RES_USEVC;
-}
-
-void
-endhostent()
-{
- _res.options &= ~(RES_STAYOPEN | RES_USEVC);
- _res_close();
-}
diff --git a/lib/libc/stdlib/free.3 b/lib/libc/stdlib/free.3
deleted file mode 100644
index 17d99eb..0000000
--- a/lib/libc/stdlib/free.3
+++ /dev/null
@@ -1,81 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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.
-.\"
-.\" @(#)free.3 8.1 (Berkeley) 6/4/93
-.\"
-.Dd June 4, 1993
-.Dt FREE 3
-.Os
-.Sh NAME
-.Nm free
-.Nd free up memory allocated with malloc, calloc or realloc
-.Sh SYNOPSIS
-.Fd #include <stdlib.h>
-.Ft void
-.Fn free "void *ptr"
-.Sh DESCRIPTION
-The
-.Fn free
-function causes the space pointed to by
-.Fa ptr
-to be deallocated, that is, made available
-for further allocation.
-If
-.Fa ptr
-is a null pointer, no action occurs.
-Otherwise, if the argument does not match a pointer earlier
-returned by the
-.Xr calloc ,
-.Xr malloc ,
-or
-.Xr realloc
-function, or if the space has been deallocated by a call to
-.Fn free
-or
-.Xr realloc ,
-general havoc may occur.
-.Sh RETURN VALUES
-The
-.Fn free
-function returns no value.
-.Sh SEE ALSO
-.Xr calloc 3 ,
-.Xr malloc 3 ,
-.Xr realloc 3
-.Sh STANDARDS
-The
-.Fn free
-function conforms to
-.St -ansiC .
diff --git a/lib/libc/stdlib/realloc.3 b/lib/libc/stdlib/realloc.3
deleted file mode 100644
index 903825c..0000000
--- a/lib/libc/stdlib/realloc.3
+++ /dev/null
@@ -1,99 +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.
-.\"
-.\" @(#)realloc.3 8.2 (Berkeley) 4/19/94
-.\"
-.Dd April 19, 1994
-.Dt REALLOC 3
-.Os
-.Sh NAME
-.Nm realloc
-.Nd reallocation of memory function
-.Sh SYNOPSIS
-.Fd #include <stdlib.h>
-.Ft void *
-.Fn realloc "void *ptr" "size_t size"
-.Sh DESCRIPTION
-The
-.Fn realloc
-function changes the size of the object pointed to by
-.Fa ptr
-to the size specified by
-.Fa size .
-The contents of the object are unchanged up to the lesser
-of the new and old sizes.
-If the new size is larger, the value of the newly allocated portion
-of the object is indeterminate.
-If
-.Fa ptr
-is a null pointer, the
-.Fn realloc
-function behaves like the
-.Xr malloc 3
-function for the specified size.
-Otherwise, if
-.Fa ptr
-does not match a pointer earlier returned by the
-.Xr calloc 3 ,
-.Xr malloc 3 ,
-or
-.Fn realloc
-function, or if the space has been deallocated
-by a call to the
-.Xr free
-or
-.Fn realloc
-function, unpredictable and usually detrimental
-behavior will occur.
-If the space cannot be allocated, the object
-pointed to by
-.Fa ptr
-is unchanged.
-If
-.Fa size
-is zero and
-.Fa ptr
-is not a null pointer, the object it points to is freed.
-.Pp
-The
-.Fn realloc
-function returns either a null pointer or a pointer
-to the possibly moved allocated space.
-.Sh SEE ALSO
-.Xr alloca 3 ,
-.Xr calloc 3 ,
-.Xr free 3 ,
-.Xr malloc 3 ,
-.Sh STANDARDS
-The
-.Fn realloc
-function conforms to
-.St -ansiC .
diff --git a/lib/libc/string/strftime.3 b/lib/libc/string/strftime.3
deleted file mode 100644
index 3da35a1..0000000
--- a/lib/libc/string/strftime.3
+++ /dev/null
@@ -1,186 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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.
-.\"
-.\" @(#)strftime.3 8.1 (Berkeley) 6/4/93
-.\"
-.Dd June 4, 1993
-.Dt STRFTIME 3
-.Os
-.Sh NAME
-.Nm strftime
-.Nd format date and time
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <time.h>
-.Fd #include <string.h>
-.Ft size_t
-.Fn strftime "char *buf" "size_t maxsize" "const char *format" "const struct tm *timeptr"
-.Sh DESCRIPTION
-The
-.Fn strftime
-function formats the information from
-.Fa timeptr
-into the buffer
-.Fa buf
-according to the string pointed to by
-.Fa format .
-.Pp
-The
-.Fa format
-string consists of zero or more conversion specifications and
-ordinary characters.
-All ordinary characters are copied directly into the buffer.
-A conversion specification consists of a percent sign
-.Dq Ql %
-and one other character.
-.Pp
-No more than
-.Fa maxsize
-characters will be placed into the array.
-If the total number of resulting characters, including the terminating
-null character, is not more than
-.Fa maxsize ,
-.Fn strftime
-returns the number of characters in the array, not counting the
-terminating null.
-Otherwise, zero is returned.
-.Pp
-Each conversion specification is replaced by the characters as
-follows which are then copied into the buffer.
-.Bl -tag -width "xxxx"
-.It Cm \&%A
-is replaced by the full weekday name.
-.It Cm %a
-is replaced by the abbreviated weekday name, where the abbreviation
-is the first three characters.
-.It Cm \&%B
-is replaced by the full month name.
-.It Cm %b or %h
-is replaced by the abbreviated month name, where the abbreviation is
-the first three characters.
-.It Cm \&%C
-is equivalent to
-.Dq Li %a %b %e %H:%M:%S %Y
-(the format produced by
-.Xr asctime 3 .
-.It Cm %c
-is equivalent to
-.Dq Li %m/%d/%y .
-.It Cm \&%D
-is replaced by the date in the format
-.Dq Ql mm/dd/yy .
-.It Cm %d
-is replaced by the day of the month as a decimal number (01-31).
-.It Cm %e
-is replaced by the day of month as a decimal number (1-31); single
-digits are preceded by a blank.
-.It Cm \&%H
-is replaced by the hour (24-hour clock) as a decimal number (00-23).
-.It Cm \&%I
-is replaced by the hour (12-hour clock) as a decimal number (01-12).
-.It Cm %j
-is replaced by the day of the year as a decimal number (001-366).
-.It Cm %k
-is replaced by the hour (24-hour clock) as a decimal number (0-23);
-single digits are preceded by a blank.
-.It Cm %l
-is replaced by the hour (12-hour clock) as a decimal number (1-12);
-single digits are preceded by a blank.
-.It Cm \&%M
-is replaced by the minute as a decimal number (00-59).
-.It Cm %m
-is replaced by the month as a decimal number (01-12).
-.It Cm %n
-is replaced by a newline.
-.It Cm %p
-is replaced by either
-.Dq Tn AM
-or
-.Dq Tn PM
-as appropriate.
-.It Cm \&%R
-is equivalent to
-.Dq Li %H:%M
-.It Cm %r
-is equivalent to
-.Dq Li %I:%M:%S %p .
-.It Cm %t
-is replaced by a tab.
-.It Cm \&%S
-is replaced by the second as a decimal number (00-60).
-.It Cm %s
-is replaced by the number of seconds since the Epoch, UCT (see
-.Xr mktime 3 ) .
-.It Cm \&%T No or Cm \&%X
-is equivalent to
-.Dq Li %H:%M:%S .
-.It Cm \&%U
-is replaced by the week number of the year (Sunday as the first day of
-the week) as a decimal number (00-53).
-.It Cm \&%W
-is replaced by the week number of the year (Monday as the first day of
-the week) as a decimal number (00-53).
-.It Cm %w
-is replaced by the weekday (Sunday as the first day of the week)
-as a decimal number (0-6).
-.It Cm %x
-is equivalent to
-.Dq Li %m/%d/%y %H:%M:%S .
-.It Cm \&%Y
-is replaced by the year with century as a decimal number.
-.It Cm %y
-is replaced by the year without century as a decimal number (00-99).
-.It Cm \&%Z
-is replaced by the time zone name.
-.It Cm %%
-is replaced by
-.Ql % .
-.El
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr ctime 3 ,
-.Xr printf 1 ,
-.Xr printf 3
-.Sh STANDARDS
-The
-.Fn strftime
-function
-conforms to
-.St -ansiC .
-The
-.Ql %s
-conversion specification is an extension.
-.Sh BUGS
-There is no conversion specification for the phase of the moon.
diff --git a/lib/libc/string/strftime.c b/lib/libc/string/strftime.c
deleted file mode 100644
index b39aeeb..0000000
--- a/lib/libc/string/strftime.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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[] = "@(#)strftime.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <tzfile.h>
-#include <string.h>
-
-static char *afmt[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
-};
-static char *Afmt[] = {
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
- "Saturday",
-};
-static char *bfmt[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
- "Oct", "Nov", "Dec",
-};
-static char *Bfmt[] = {
- "January", "February", "March", "April", "May", "June", "July",
- "August", "September", "October", "November", "December",
-};
-
-static size_t gsize;
-static char *pt;
-static int _add __P((char *));
-static int _conv __P((int, int, int));
-static int _secs __P((const struct tm *));
-static size_t _fmt __P((const char *, const struct tm *));
-
-size_t
-strftime(s, maxsize, format, t)
- char *s;
- size_t maxsize;
- const char *format;
- const struct tm *t;
-{
-
- pt = s;
- if ((gsize = maxsize) < 1)
- return(0);
- if (_fmt(format, t)) {
- *pt = '\0';
- return(maxsize - gsize);
- }
- return(0);
-}
-
-static size_t
-_fmt(format, t)
- register const char *format;
- const struct tm *t;
-{
- for (; *format; ++format) {
- if (*format == '%')
- switch(*++format) {
- case '\0':
- --format;
- break;
- case 'A':
- if (t->tm_wday < 0 || t->tm_wday > 6)
- return(0);
- if (!_add(Afmt[t->tm_wday]))
- return(0);
- continue;
- case 'a':
- if (t->tm_wday < 0 || t->tm_wday > 6)
- return(0);
- if (!_add(afmt[t->tm_wday]))
- return(0);
- continue;
- case 'B':
- if (t->tm_mon < 0 || t->tm_mon > 11)
- return(0);
- if (!_add(Bfmt[t->tm_mon]))
- return(0);
- continue;
- case 'b':
- case 'h':
- if (t->tm_mon < 0 || t->tm_mon > 11)
- return(0);
- if (!_add(bfmt[t->tm_mon]))
- return(0);
- continue;
- case 'C':
- if (!_fmt("%a %b %e %H:%M:%S %Y", t))
- return(0);
- continue;
- case 'c':
- if (!_fmt("%m/%d/%y %H:%M:%S", t))
- return(0);
- continue;
- case 'D':
- if (!_fmt("%m/%d/%y", t))
- return(0);
- continue;
- case 'd':
- if (!_conv(t->tm_mday, 2, '0'))
- return(0);
- continue;
- case 'e':
- if (!_conv(t->tm_mday, 2, ' '))
- return(0);
- continue;
- case 'H':
- if (!_conv(t->tm_hour, 2, '0'))
- return(0);
- continue;
- case 'I':
- if (!_conv(t->tm_hour % 12 ?
- t->tm_hour % 12 : 12, 2, '0'))
- return(0);
- continue;
- case 'j':
- if (!_conv(t->tm_yday + 1, 3, '0'))
- return(0);
- continue;
- case 'k':
- if (!_conv(t->tm_hour, 2, ' '))
- return(0);
- continue;
- case 'l':
- if (!_conv(t->tm_hour % 12 ?
- t->tm_hour % 12 : 12, 2, ' '))
- return(0);
- continue;
- case 'M':
- if (!_conv(t->tm_min, 2, '0'))
- return(0);
- continue;
- case 'm':
- if (!_conv(t->tm_mon + 1, 2, '0'))
- return(0);
- continue;
- case 'n':
- if (!_add("\n"))
- return(0);
- continue;
- case 'p':
- if (!_add(t->tm_hour >= 12 ? "PM" : "AM"))
- return(0);
- continue;
- case 'R':
- if (!_fmt("%H:%M", t))
- return(0);
- continue;
- case 'r':
- if (!_fmt("%I:%M:%S %p", t))
- return(0);
- continue;
- case 'S':
- if (!_conv(t->tm_sec, 2, '0'))
- return(0);
- continue;
- case 's':
- if (!_secs(t))
- return(0);
- continue;
- case 'T':
- case 'X':
- if (!_fmt("%H:%M:%S", t))
- return(0);
- continue;
- case 't':
- if (!_add("\t"))
- return(0);
- continue;
- case 'U':
- if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7,
- 2, '0'))
- return(0);
- continue;
- case 'W':
- if (!_conv((t->tm_yday + 7 -
- (t->tm_wday ? (t->tm_wday - 1) : 6))
- / 7, 2, '0'))
- return(0);
- continue;
- case 'w':
- if (!_conv(t->tm_wday, 1, '0'))
- return(0);
- continue;
- case 'x':
- if (!_fmt("%m/%d/%y", t))
- return(0);
- continue;
- case 'y':
- if (!_conv((t->tm_year + TM_YEAR_BASE)
- % 100, 2, '0'))
- return(0);
- continue;
- case 'Y':
- if (!_conv(t->tm_year + TM_YEAR_BASE, 4, '0'))
- return(0);
- continue;
- case 'Z':
- if (!t->tm_zone || !_add(t->tm_zone))
- return(0);
- continue;
- case '%':
- /*
- * X311J/88-090 (4.12.3.5): if conversion char is
- * undefined, behavior is undefined. Print out the
- * character itself as printf(3) does.
- */
- default:
- break;
- }
- if (!gsize--)
- return(0);
- *pt++ = *format;
- }
- return(gsize);
-}
-
-static int
-_secs(t)
- const struct tm *t;
-{
- static char buf[15];
- register time_t s;
- register char *p;
- struct tm tmp;
-
- /* Make a copy, mktime(3) modifies the tm struct. */
- tmp = *t;
- s = mktime(&tmp);
- for (p = buf + sizeof(buf) - 2; s > 0 && p > buf; s /= 10)
- *p-- = s % 10 + '0';
- return(_add(++p));
-}
-
-static int
-_conv(n, digits, pad)
- int n, digits, pad;
-{
- static char buf[10];
- register char *p;
-
- for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits)
- *p-- = n % 10 + '0';
- while (p > buf && digits-- > 0)
- *p-- = pad;
- return(_add(++p));
-}
-
-static int
-_add(str)
- register char *str;
-{
- for (;; ++pt, --gsize) {
- if (!gsize)
- return(0);
- if (!(*pt = *str++))
- return(1);
- }
-}
diff --git a/lib/libcompat/regexp/regexp.h b/lib/libcompat/regexp/regexp.h
deleted file mode 100644
index 73d6bf4..0000000
--- a/lib/libcompat/regexp/regexp.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Definitions etc. for regexp(3) routines.
- *
- * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
- * not the System V one.
- */
-#define NSUBEXP 10
-typedef struct regexp {
- char *startp[NSUBEXP];
- char *endp[NSUBEXP];
- char regstart; /* Internal use only. */
- char reganch; /* Internal use only. */
- char *regmust; /* Internal use only. */
- int regmlen; /* Internal use only. */
- char program[1]; /* Unwarranted chumminess with compiler. */
-} regexp;
-
-extern regexp *regcomp();
-extern int regexec();
-extern void regsub();
-extern void regerror();
diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h
deleted file mode 100644
index 95423c6..0000000
--- a/lib/libedit/histedit.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Christos Zoulas of Cornell University.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * @(#)histedit.h 8.2 (Berkeley) 1/3/94
- */
-
-/*
- * histedit.h: Line editor and history interface.
- */
-#ifndef _h_editline
-#define _h_editline
-
-#include <sys/types.h>
-#include <stdio.h>
-
-/*
- * ==== Editing ====
- */
-typedef struct editline EditLine;
-
-/*
- * For user-defined function interface
- */
-typedef struct lineinfo {
- __const char *buffer;
- __const char *cursor;
- __const char *lastchar;
-} LineInfo;
-
-
-/*
- * EditLine editor function return codes.
- * For user-defined function interface
- */
-#define CC_NORM 0
-#define CC_NEWLINE 1
-#define CC_EOF 2
-#define CC_ARGHACK 3
-#define CC_REFRESH 4
-#define CC_CURSOR 5
-#define CC_ERROR 6
-#define CC_FATAL 7
-
-/*
- * Initialization, cleanup, and resetting
- */
-EditLine *el_init __P((const char *, FILE *, FILE *));
-void el_reset __P((EditLine *));
-void el_end __P((EditLine *));
-
-
-/*
- * Get a line, a character or push a string back in the input queue
- */
-__const char *el_gets __P((EditLine *, int *));
-int el_getc __P((EditLine *, char *));
-void el_push __P((EditLine *, const char *));
-
-/*
- * High level function internals control
- * Parses argc, argv array and executes builtin editline commands
- */
-int el_parse __P((EditLine *, int, char **));
-
-/*
- * Low level editline access function
- */
-int el_set __P((EditLine *, int, ...));
-
-/*
- * el_set/el_get parameters
- */
-#define EL_PROMPT 0 /* , el_pfunc_t); */
-#define EL_TERMINAL 1 /* , const char *); */
-#define EL_EDITOR 2 /* , const char *); */
-#define EL_SIGNAL 3 /* , int); */
-#define EL_BIND 4 /* , const char *, ..., NULL); */
-#define EL_TELLTC 5 /* , const char *, ..., NULL); */
-#define EL_SETTC 6 /* , const char *, ..., NULL); */
-#define EL_ECHOTC 7 /* , const char *, ..., NULL); */
-#define EL_SETTY 8 /* , const char *, ..., NULL); */
-#define EL_ADDFN 9 /* , const char *, const char * */
- /* , el_func_t); */
-#define EL_HIST 10 /* , hist_fun_t, const char *); */
-
-/*
- * Source named file or $PWD/.editrc or $HOME/.editrc
- */
-int el_source __P((EditLine *, const char *));
-
-/*
- * Must be called when the terminal changes size; If EL_SIGNAL
- * is set this is done automatically otherwise it is the responsibility
- * of the application
- */
-void el_resize __P((EditLine *));
-
-
-/*
- * User-defined function interface.
- */
-__const LineInfo *el_line __P((EditLine *));
-int el_insertstr __P((EditLine *, char *));
-void el_deletestr __P((EditLine *, int));
-
-/*
- * ==== History ====
- */
-
-typedef struct history History;
-
-typedef struct HistEvent {
- int num;
- __const char *str;
-} HistEvent;
-
-/*
- * History access functions.
- */
-History * history_init __P((void));
-void history_end __P((History *));
-
-__const HistEvent * history __P((History *, int, ...));
-
-#define H_FUNC 0 /* , UTSL */
-#define H_EVENT 1 /* , const int); */
-#define H_FIRST 2 /* , void); */
-#define H_LAST 3 /* , void); */
-#define H_PREV 4 /* , void); */
-#define H_NEXT 5 /* , void); */
-#define H_CURR 6 /* , void); */
-#define H_ADD 7 /* , const char*); */
-#define H_ENTER 8 /* , const char*); */
-#define H_END 9 /* , void); */
-#define H_NEXT_STR 10 /* , const char*); */
-#define H_PREV_STR 11 /* , const char*); */
-#define H_NEXT_EVENT 12 /* , const int); */
-#define H_PREV_EVENT 13 /* , const int); */
-
-#endif /* _h_editline */
diff --git a/lib/libedit/termcap.h b/lib/libedit/termcap.h
deleted file mode 100644
index 4fd2cab..0000000
--- a/lib/libedit/termcap.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Christos Zoulas of Cornell University.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * @(#)termcap.h 8.1 (Berkeley) 6/4/93
- */
-
-/*
- * termcap.h: I cannot find those in any include files...
- */
-#ifndef _h_termcap
-#define _h_termcap
-
-int tgetent __P((char *, char *));
-char *tgetstr __P((char *, char **));
-int tgetflag __P((char *));
-int tgetnum __P((char *));
-char *tgoto __P((char *, int, int));
-char *tputs __P((char *, int, void (*)(int)));
-
-#endif /* _h_termcap */
diff --git a/lib/librpc/DISCLAIMER b/lib/librpc/DISCLAIMER
deleted file mode 100644
index 1a66d5f..0000000
--- a/lib/librpc/DISCLAIMER
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
diff --git a/lib/librpc/Makefile b/lib/librpc/Makefile
deleted file mode 100644
index bafff29..0000000
--- a/lib/librpc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/11 4.0 RPCSRC
-#
-# Build and install everything.
-#
-# These directories are presumed to exist in DESTDIR:
-# /usr/lib /usr/bin /usr/include
-#
-DESTDIR=
-CFLAGS=-O
-MAKE=make
-
-# These are not used by BSD except portmap which lives in
-# /usr/src/usr.sbin/portmap.
-# SUBDIR= rpcgen etc rpcsvc
-
-all install: rpclib ${SUBDIR}
-
-rpclib: FRC
- @echo "Building and installing RPC library"
- cd rpc; $(MAKE) ${MFLAGS} all DESTDIR=${DESTDIR}; \
- $(MAKE) ${MFLAGS} install DESTDIR=${DESTDIR}
-
-${SUBDIR}: FRC
- @echo "Building and installing files from: $@"
- cd $@; $(MAKE) ${MFLAGS} DESTDIR=${DESTDIR} CFLAGS=${CFLAGS};\
- $(MAKE) ${MFLAGS} install DESTDIR=${DESTDIR}
-
-FRC:
-
diff --git a/lib/librpc/README b/lib/librpc/README
deleted file mode 100644
index ad9d70f..0000000
--- a/lib/librpc/README
+++ /dev/null
@@ -1,233 +0,0 @@
-RPCSRC 4.0 7/11/89
-
-This distribution contains Sun Microsystem's implementation of the
-RPC and XDR protocols and is compatible with 4.2BSD and 4.3BSD. Also
-included is complete documentation, utilities, RPC service
-specification files, and demonstration services in the format used by
-the RPC protocol compiler (rpcgen). See WHAT'S NEW below for
-details.
-
-NOTE ABOUT SECURE RPC:
-
-This release of RPCSRC contains most of the code needed to implement
-Secure RPC (see "DES Authentication" in the RPC Protocol Specification,
-doc/rpc.rfc.ms). Due to legal considerations, we are unable to
-distribute an implementation of DES, the Data Encryption Standard, which
-Secure RPC requires. For this reason, all of the files, documentation, and
-programs associated with Secure RPC have been placed into a separate
-directory, secure_rpc. The RPC library contained in the main body of this
-release *DOES NOT* support Secure RPC. See secure_rpc/README for more
-details. (A DES library was posted in Volume 18 of comp.sources.unix.)
-
-If you wish to report bugs found in this release, send mail to:
-
-Portable ONC/NFS
-Sun Microsystems, Inc
-MS 12-33
-2550 Garcia Avenue
-Mountain View, CA 94043
-
-or send Email to nfsnet@sun.com (the Internet) or sun!nfsnet (Usenet).
-
-ROADMAP
-
-The directory hierarchy is as follows:
-
- demo/ Various demonstration services
- demo/dir Remote directory lister
- demo/msg Remote console message delivery service
- demo/sort Remote sort service
-
- doc/ Documentation for RPC, XDR and NFS in "-ms" format.
-
- etc/ Utilities (rpcinfo and portmap). portmap must be
- started by root before any other RPC network services are
- used. SEE BELOW FOR BUGFIX TO 4.3BSD COMPILER.
-
- man/ Manual pages for RPC library, rpcgen, and utilities.
-
- rpc/ The RPC and XDR library. SEE BELOW
- FOR BUGFIX TO 4.2BSD COMPILER.
-
- rpcgen/ The RPC Language compiler (for .x files)
-
- rpcsvc/ Service definition files for various services and the
- server and client code for the Remote Status service.
-
- secure_rpc/ The files in this directory are used to build a version of
- the RPC library with DES Authentication. See the README
- file in that directory for more details.
-
-BUILD INSTRUCTIONS
-
-Makefiles can be found in all directories except for man. The
-Makefile in the top directory will cause these others to be invoked
-(except for in the doc, man and demo directories), in turn building the
-entire release.
-
-WARNING! THE DEFAULT INSTALLATION PROCEDURES WILL INSTALL FILES
-IN /usr/include, /usr/lib, /usr/bin and /etc.
-
-The master RPC include file, rpc/rpc.h, is used by all programs and
-routines that use RPC. It includes other RPC and system include files
-needed by the RPC system. PLEASE NOTE: If your system has NFS, it
-may have been based on Sun's NFS Source. The include files installed
-by this package may duplicate include files you will find on your NFS
-system. The RPCSRC 4.0 include files are upwardly compatible to all
-NFS Source include files as of the date of this distribution (not
-including any new definitions or declarations added by your system
-vendor). HOWEVER: Please read the comments towards the end of
-rpc/rpc.h regarding rpc/netdb.h. You may need to uncomment the
-inclusion of that file if the structures it defines are already
-defined by your system's include files.
-
-After making any compiler fixes that are needed (see below), at
-the top directory, type:
-
- make install
-
-For all installations, the Makefile macro DESTDIR is prepended to the
-installation path. It is defined to be null in the Makefiles, so
-installations are relative to root. (You will probably need root
-privileges for installing the files under the default path.) To
-install the files under some other tree (e.g., /usr/local), use the
-command:
-
- make install DESTDIR=/usr/local
-
-This will place the include files in /usr/local/usr/include, the RPC
-library in /usr/local/usr/lib, rpcgen in /usr/local/usr/bin, and the
-utilities in /usr/local/etc. You'll have to edit the Makefiles or
-install the files by hand if you want to do anything other than this
-kind of relocation of the installation tree.
-
-The RPC library will be built and installed first. By default it is
-installed in /usr/lib as "librpclib.a". The directory
-/usr/include/rpc will also be created, and several header files will
-be installed there. ALL RPC SERVICES INCLUDE THESE HEADER FILES.
-
-The programs in etc/ link in routines from librpclib.a. If you change
-where it is installed, be sure to edit etc/'s Makefile to reflect this.
-These programs are installed in /etc. PORTMAP MUST BE RUNNING ON
-YOUR SYSTEM BEFORE YOU START ANY OTHER RPC SERVICE.
-
-rpcgen is installed in /usr/bin. This program is required to build
-the demonstration services in demo and the rstat client and server in
-rpcsvc/.
-
-The rpcsvc/ directory will install its files in the directory
-/usr/include/rpcsvc. The Remote Status service (rstat_svc) will be
-compiled and installed in /etc. If you wish to make this service
-available, you should either start this service when needed or have
-it started at boot time by invoking it in your /etc/rc.local script.
-(Be sure that portmap is started first!) Sun has modified its
-version of inetd to automatically start RPC services. (Use "make
-LIB=" when building rstat on a Sun Workstation.) The Remote Status
-client (rstat) will be installed in /usr/bin. This program queries
-the rstat_svc on a remote host and prints a system status summary
-similar to the one printed by "uptime".
-
-The documentation is not built during the "make install" command.
-Typing "make" in the doc directory will cause all of the manuals to
-be formatted using nroff into a single file. We have had a report
-that certain "troff" equivalents have trouble processing the full
-manual. If you have trouble, try building the manuals individually
-(see the Makefile).
-
-The demonstration services in the demo directory are not built by the
-top-level "make install" command. To build these, cd to the demo
-directory and enter "make". The three services will be built.
-RPCGEN MUST BE INSTALLED in a path that make can find. To run the
-services, start the portmap program as root and invoke the service
-(you probably will want to put it in the background). rpcinfo can be
-used to check that the service succeeded in getting registered with
-portmap, and to ping the service (see rpcinfo's man page). You can
-then use the corresponding client program to exercise the service.
-To build these services on a Sun workstation, you must prevent the
-Makefile from trying to link the RPC library (as these routines are
-already a part of Sun's libc). Use: "make LIB=".
-
-BUGFIX FOR 4.3BSD COMPILER
-
-The use of a 'void *' declaration for one of the arguments in
-the reply_proc() procedure in etc/rpcinfo.c will trigger a bug
-in the 4.3BSD compiler. The bug is fixed by the following change to
-the compiler file mip/manifest.h:
-
-*** manifest.h.r1.1 Thu Apr 30 13:52:25 1987
---- manifest.h.r1.2 Mon Nov 23 18:58:17 1987
-***************
-*** 21,27 ****
- /*
- * Bogus type values
- */
-! #define TNULL PTR /* pointer to UNDEF */
- #define TVOID FTN /* function returning UNDEF (for void) */
-
- /*
---- 21,27 ----
- /*
- * Bogus type values
- */
-! #define TNULL INCREF(MOETY) /* pointer to MOETY -- impossible type */
- #define TVOID FTN /* function returning UNDEF (for void) */
-
- /*
-
-If you cannot fix your compiler, change the declaration in reply_proc()
-from 'void *' to 'char *'.
-
-BUGFIX FOR 4.2BSD COMPILER
-
-Unpatched 4.2BSD compilers complain about valid C. You can make old
-compilers happy by changing some voids to ints. However, the fix to
-the 4.2 VAX compiler is as follows (to mip/trees.c):
-
-*** trees.c.r1.1 Mon May 11 13:47:58 1987
---- trees.c.r1.2 Wed Jul 2 18:28:52 1986
-***************
-*** 1247,1253 ****
- if(o==CAST && mt1==0)return(TYPL+TYMATCH);
- if( mt12 & MDBI ) return( TYPL+LVAL+TYMATCH );
- else if( (mt1&MENU)||(mt2&MENU) ) return( LVAL+NCVT+TYPL+PTMATCH+PUN );
-! else if( mt12 == 0 ) break;
- else if( mt1 & MPTR ) return( LVAL+PTMATCH+PUN );
- else if( mt12 & MPTI ) return( TYPL+LVAL+TYMATCH+PUN );
- break;
---- 1261,1269 ----
- if(o==CAST && mt1==0)return(TYPL+TYMATCH);
- if( mt12 & MDBI ) return( TYPL+LVAL+TYMATCH );
- else if( (mt1&MENU)||(mt2&MENU) ) return( LVAL+NCVT+TYPL+PTMATCH+PUN );
-! /* if right is TVOID and looks like a CALL, is not ok */
-! else if (mt2 == 0 && (p->in.right->in.op == CALL || p->in.right->in.op == UNARY CALL))
-! break;
- else if( mt1 & MPTR ) return( LVAL+PTMATCH+PUN );
- else if( mt12 & MPTI ) return( TYPL+LVAL+TYMATCH+PUN );
- break;
-
-WHAT'S NEW IN THIS RELEASE: RPCSRC 4.0
-
-The previous release was RPCSRC 3.9. As with all previous releases,
-this release is based directly on files from Sun Microsystem's
-implementation.
-
-Upgrade from RPCSRC 3.9
-
-1) RPCSRC 4.0 upgrades RPCSRC 3.9. Improvements from SunOS 4.0 have
- been integrated into this release.
-
-Secure RPC (in the secure_rpc/ directory)
-
-2) DES Authentication routines and programs are provided.
-3) A new manual, "Secure NFS" is provided, which describes Secure RPC
- and Secure NFS.
-4) Skeleton routines and manual pages are provided which describe the
- DES encryption procedures required by Secure RPC. HOWEVER, NO DES
- ROUTINE IS PROVIDED.
-
-New Functionality
-
-5) rpcinfo can now be used to de-register services from the portmapper
- which may have terminated abnormally.
-6) A new client, rstat, is provided which queries the rstat_svc and
- prints a status line similar to the one displayed by "uptime".
diff --git a/lib/librpc/demo/Makefile b/lib/librpc/demo/Makefile
deleted file mode 100644
index 05510d6..0000000
--- a/lib/librpc/demo/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/02 4.0 RPCSRC
-#
-#
-# Build all demo services
-#
-MAKE = make
-LIB=-lrpclib
-
-SUBDIR= dir msg sort
-
-all: ${SUBDIR}
-
-clean cleanup:
- cd dir; $(MAKE) ${MFLAGS} cleanup
- cd msg; $(MAKE) ${MFLAGS} cleanup
- cd sort; $(MAKE) ${MFLAGS} cleanup
-
-install:
- @echo "No installations done."
-
-${SUBDIR}: FRC
- cd $@; $(MAKE) ${MFLAGS} LIB=$(LIB)
-
-FRC:
diff --git a/lib/librpc/demo/dir/Makefile b/lib/librpc/demo/dir/Makefile
deleted file mode 100644
index 592c9d6..0000000
--- a/lib/librpc/demo/dir/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/02 4.0 RPCSRC
-#
-BIN = dir_svc rls
-GEN = dir_clnt.c dir_svc.c dir_xdr.c dir.h
-LIB = -lrpclib
-RPCCOM = rpcgen
-
-all: $(BIN)
-
-$(GEN): dir.x
- $(RPCCOM) dir.x
-
-dir_svc: dir_proc.o dir_svc.o dir_xdr.o
- $(CC) -o $@ dir_proc.o dir_svc.o dir_xdr.o $(LIB)
-
-rls: rls.o dir_clnt.o dir_xdr.o
- $(CC) -o $@ rls.o dir_clnt.o dir_xdr.o $(LIB)
-
-rls.o: rls.c dir.h
-
-dir_proc.o: dir_proc.c dir.h
-
-clean cleanup:
- rm -f $(GEN) *.o $(BIN)
-
diff --git a/lib/librpc/demo/dir/dir.x b/lib/librpc/demo/dir/dir.x
deleted file mode 100644
index db4283c..0000000
--- a/lib/librpc/demo/dir/dir.x
+++ /dev/null
@@ -1,37 +0,0 @@
-/* @(#)dir.x 2.1 88/08/02 4.0 RPCSRC */
-/*
- * dir.x: Remote directory listing protocol
- */
-const MAXNAMELEN = 255; /* maximum length of a directory entry */
-
-typedef string nametype<MAXNAMELEN>; /* a directory entry */
-
-typedef struct namenode *namelist; /* a link in the listing */
-
-/*
- * A node in the directory listing
- */
-struct namenode {
- nametype name; /* name of directory entry */
- namelist next; /* next entry */
-};
-
-/*
- * The result of a READDIR operation.
- */
-union readdir_res switch (int errno) {
-case 0:
- namelist list; /* no error: return directory listing */
-default:
- void; /* error occurred: nothing else to return */
-};
-
-/*
- * The directory program definition
- */
-program DIRPROG {
- version DIRVERS {
- readdir_res
- READDIR(nametype) = 1;
- } = 1;
-} = 76;
diff --git a/lib/librpc/demo/dir/dir_proc.c b/lib/librpc/demo/dir/dir_proc.c
deleted file mode 100644
index 9f7522a..0000000
--- a/lib/librpc/demo/dir/dir_proc.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* @(#)dir_proc.c 2.1 88/08/02 4.0 RPCSRC */
-/*
- * dir_proc.c: remote readdir implementation
- */
-#include <rpc/rpc.h>
-#include <sys/dir.h>
-#include "dir.h"
-
-extern int errno;
-extern char *malloc();
-extern char *strcpy();
-
-readdir_res *
-readdir_1(dirname)
- nametype *dirname;
-{
- DIR *dirp;
- struct direct *d;
- namelist nl;
- namelist *nlp;
- static readdir_res res; /* must be static! */
-
- /*
- * Open directory
- */
- dirp = opendir(*dirname);
- if (dirp == NULL) {
- res.errno = errno;
- return (&res);
- }
-
- /*
- * Free previous result
- */
- xdr_free(xdr_readdir_res, &res);
-
- /*
- * Collect directory entries
- */
- nlp = &res.readdir_res_u.list;
- while (d = readdir(dirp)) {
- nl = *nlp = (namenode *) malloc(sizeof(namenode));
- nl->name = malloc(strlen(d->d_name)+1);
- strcpy(nl->name, d->d_name);
- nlp = &nl->next;
- }
- *nlp = NULL;
-
- /*
- * Return the result
- */
- res.errno = 0;
- closedir(dirp);
- return (&res);
-}
diff --git a/lib/librpc/demo/dir/rls.c b/lib/librpc/demo/dir/rls.c
deleted file mode 100644
index 4f2d473..0000000
--- a/lib/librpc/demo/dir/rls.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* @(#)rls.c 2.2 88/08/12 4.0 RPCSRC */
-/*
- * rls.c: Remote directory listing client
- */
-#include <stdio.h>
-#include <rpc/rpc.h> /* always need this */
-#include "dir.h" /* need this too: will be generated by rpcgen*/
-
-extern int errno;
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- CLIENT *cl;
- char *server;
- char *dir;
- readdir_res *result;
- namelist nl;
-
-
- if (argc != 3) {
- fprintf(stderr, "usage: %s host directory\n", argv[0]);
- exit(1);
- }
-
- /*
- * Remember what our command line arguments refer to
- */
- server = argv[1];
- dir = argv[2];
-
- /*
- * Create client "handle" used for calling DIRPROG on the
- * server designated on the command line. We tell the rpc package
- * to use the "tcp" protocol when contacting the server.
- */
- cl = clnt_create(server, DIRPROG, DIRVERS, "tcp");
- if (cl == NULL) {
- /*
- * Couldn't establish connection with server.
- * Print error message and die.
- */
- clnt_pcreateerror(server);
- exit(1);
- }
-
- /*
- * Call the remote procedure "readdir" on the server
- */
- result = readdir_1(&dir, cl);
- if (result == NULL) {
- /*
- * An error occurred while calling the server.
- * Print error message and die.
- */
- clnt_perror(cl, server);
- exit(1);
- }
-
- /*
- * Okay, we successfully called the remote procedure.
- */
- if (result->errno != 0) {
- /*
- * A remote system error occurred.
- * Print error message and die.
- */
- errno = result->errno;
- perror(dir);
- exit(1);
- }
-
- /*
- * Successfuly got a directory listing.
- * Print it out.
- */
- for (nl = result->readdir_res_u.list; nl != NULL; nl = nl->next) {
- printf("%s\n", nl->name);
- }
-}
diff --git a/lib/librpc/demo/msg/Makefile b/lib/librpc/demo/msg/Makefile
deleted file mode 100644
index 2f3f5dd..0000000
--- a/lib/librpc/demo/msg/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/11 4.0 RPCSRC
-#
-BIN = printmsg msg_svc rprintmsg
-GEN = msg_clnt.c msg_svc.c msg.h
-LIB = -lrpclib
-RPCCOM = rpcgen
-
-all: $(BIN)
-
-#
-# This is the non-networked version of the program
-#
-printmsg: printmsg.o
- $(CC) -o $@ printmsg.o
-
-#
-# note: no xdr routines are generated here, due this service's
-# use of basic data types.
-#
-$(GEN): msg.x
- $(RPCCOM) msg.x
-
-msg_svc: msg_proc.o msg_svc.o
- $(CC) -o $@ msg_proc.o msg_svc.o $(LIB)
-
-rprintmsg: rprintmsg.o msg_clnt.o
- $(CC) -o $@ rprintmsg.o msg_clnt.o $(LIB)
-
-rprintmsg.o: rprintmsg.c msg.h
-
-msg_proc.o: msg_proc.c msg.h
-
-clean cleanup:
- rm -f $(GEN) *.o $(BIN)
-
diff --git a/lib/librpc/demo/msg/msg.x b/lib/librpc/demo/msg/msg.x
deleted file mode 100644
index d311352..0000000
--- a/lib/librpc/demo/msg/msg.x
+++ /dev/null
@@ -1,9 +0,0 @@
-/* @(#)msg.x 2.1 88/08/11 4.0 RPCSRC */
-/*
- * msg.x: Remote message printing protocol
- */
-program MESSAGEPROG {
- version MESSAGEVERS {
- int PRINTMESSAGE(string) = 1;
- } = 1;
-} = 99;
diff --git a/lib/librpc/demo/msg/msg_proc.c b/lib/librpc/demo/msg/msg_proc.c
deleted file mode 100644
index 80e5d95..0000000
--- a/lib/librpc/demo/msg/msg_proc.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* @(#)msg_proc.c 2.1 88/08/11 4.0 RPCSRC */
-/*
- * msg_proc.c: implementation of the remote procedure "printmessage"
- */
-#include <stdio.h>
-#include <rpc/rpc.h> /* always need this here */
-#include "msg.h" /* need this too: msg.h will be generated by rpcgen */
-
-/*
- * Remote verson of "printmessage"
- */
-int *
-printmessage_1(msg)
- char **msg;
-{
- static int result; /* must be static! */
- FILE *f;
-
- f = fopen("/dev/console", "w");
- if (f == NULL) {
- result = 0;
- return (&result);
- }
- fprintf(f, "%s\n", *msg);
- fclose(f);
- result = 1;
- return (&result);
-}
diff --git a/lib/librpc/demo/msg/printmsg.c b/lib/librpc/demo/msg/printmsg.c
deleted file mode 100644
index dde55dd..0000000
--- a/lib/librpc/demo/msg/printmsg.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* @(#)printmsg.c 2.1 88/08/11 4.0 RPCSRC */
-/*
- * printmsg.c: print a message on the console
- */
-#include <stdio.h>
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char *message;
-
- if (argc < 2) {
- fprintf(stderr, "usage: %s <message>\n", argv[0]);
- exit(1);
- }
- message = argv[1];
-
- if (!printmessage(message)) {
- fprintf(stderr, "%s: sorry, couldn't print your message\n",
- argv[0]);
- exit(1);
- }
- printf("Message delivered!\n");
-}
-
-/*
- * Print a message to the console.
- * Return a boolean indicating whether the message was actually printed.
- */
-printmessage(msg)
- char *msg;
-{
- FILE *f;
-
- f = fopen("/dev/console", "w");
- if (f == NULL) {
- return (0);
- }
- fprintf(f, "%s\n", msg);
- fclose(f);
- return(1);
-}
diff --git a/lib/librpc/demo/msg/rprintmsg.c b/lib/librpc/demo/msg/rprintmsg.c
deleted file mode 100644
index b9cb1e3..0000000
--- a/lib/librpc/demo/msg/rprintmsg.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* @(#)rprintmsg.c 2.1 88/08/11 4.0 RPCSRC */
-/*
- * rprintmsg.c: remote version of "printmsg.c"
- */
-#include <stdio.h>
-#include <rpc/rpc.h> /* always need this */
-#include "msg.h" /* need this too: will be generated by rpcgen*/
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- CLIENT *cl;
- int *result;
- char *server;
- char *message;
-
- if (argc < 3) {
- fprintf(stderr, "usage: %s host message\n", argv[0]);
- exit(1);
- }
-
- /*
- * Remember what our command line arguments refer to
- */
- server = argv[1];
- message = argv[2];
-
- /*
- * Create client "handle" used for calling MESSAGEPROG on the
- * server designated on the command line. We tell the rpc package
- * to use the "tcp" protocol when contacting the server.
- */
- cl = clnt_create(server, MESSAGEPROG, MESSAGEVERS, "tcp");
- if (cl == NULL) {
- /*
- * Couldn't establish connection with server.
- * Print error message and die.
- */
- clnt_pcreateerror(server);
- exit(1);
- }
-
- /*
- * Call the remote procedure "printmessage" on the server
- */
- result = printmessage_1(&message, cl);
- if (result == NULL) {
- /*
- * An error occurred while calling the server.
- * Print error message and die.
- */
- clnt_perror(cl, server);
- exit(1);
- }
-
- /*
- * Okay, we successfully called the remote procedure.
- */
- if (*result == 0) {
- /*
- * Server was unable to print our message.
- * Print error message and die.
- */
- fprintf(stderr, "%s: sorry, %s couldn't print your message\n",
- argv[0], server);
- exit(1);
- }
-
- /*
- * The message got printed on the server's console
- */
- printf("Message delivered to %s!\n", server);
-}
diff --git a/lib/librpc/demo/sort/Makefile b/lib/librpc/demo/sort/Makefile
deleted file mode 100644
index 07627fa..0000000
--- a/lib/librpc/demo/sort/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/11 4.0 RPCSRC
-#
-
-BIN = rsort sort_svc
-GEN = sort_clnt.c sort_svc.c sort_xdr.c sort.h
-LIB = -lrpclib
-RPCCOM = rpcgen
-
-all: $(BIN)
-
-rsort: rsort.o sort_clnt.o sort_xdr.o
- $(CC) $(LDFLAGS) -o $@ rsort.o sort_clnt.o sort_xdr.o $(LIB)
-
-rsort.o: rsort.c sort.h
-
-sort_clnt.c:
- $(RPCCOM) -l sort.x >$@
-
-sort_svc: sort_proc.o sort_svc.o sort_xdr.o
- $(CC) $(LDFLAGS) -o $@ sort_proc.o sort_svc.o sort_xdr.o $(LIB)
-
-sort_proc.o: sort_proc.c sort.h
-
-sort_svc.c:
- $(RPCCOM) -s udp sort.x >$@
-
-sort_xdr.c:
- $(RPCCOM) -c sort.x >$@
-
-sort.h:
- $(RPCCOM) -h sort.x >$@
-
-clean cleanup:
- rm -f $(GEN) *.o $(BIN)
-
diff --git a/lib/librpc/demo/sort/rsort.c b/lib/librpc/demo/sort/rsort.c
deleted file mode 100644
index 5c05ad7..0000000
--- a/lib/librpc/demo/sort/rsort.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* @(#)rsort.c 2.1 88/08/11 4.0 RPCSRC */
-/*
- * rsort.c
- * Client side application which sorts argc, argv.
- */
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include "sort.h"
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- char *machinename;
- struct sortstrings args, res;
- int i;
-
- if (argc < 3) {
- fprintf(stderr, "usage: %s machinename [s1 ...]\n", argv[0]);
- exit(1);
- }
- machinename = argv[1];
- args.ss.ss_len = argc - 2; /* substract off progname, machinename */
- args.ss.ss_val = &argv[2];
- res.ss.ss_val = (char **)NULL;
-
- if ((i = callrpc(machinename, SORTPROG, SORTVERS, SORT,
- xdr_sortstrings, &args, xdr_sortstrings, &res)))
- {
- fprintf(stderr, "%s: call to sort service failed. ", argv[0]);
- clnt_perrno(i);
- fprintf(stderr, "\n");
- exit(1);
- }
-
- for (i = 0; i < res.ss.ss_len; i++) {
- printf("%s\n", res.ss.ss_val[i]);
- }
-
- /* should free res here */
- exit(0);
-}
-
diff --git a/lib/librpc/demo/sort/sort.x b/lib/librpc/demo/sort/sort.x
deleted file mode 100644
index 629110c..0000000
--- a/lib/librpc/demo/sort/sort.x
+++ /dev/null
@@ -1,19 +0,0 @@
-/* @(#)sort.x 2.1 88/08/11 4.0 RPCSRC */
-/*
- * The sort procedure receives an array of strings and returns an array
- * of strings. This toy service handles a maximum of 64 strings.
- */
-const MAXSORTSIZE = 64;
-const MAXSTRINGLEN = 64;
-
-typedef string str<MAXSTRINGLEN>; /* the string itself */
-
-struct sortstrings {
- str ss<MAXSORTSIZE>;
-};
-
-program SORTPROG {
- version SORTVERS {
- sortstrings SORT(sortstrings) = 1;
- } = 1;
-} = 22855;
diff --git a/lib/librpc/demo/sort/sort_proc.c b/lib/librpc/demo/sort/sort_proc.c
deleted file mode 100644
index 5538faf..0000000
--- a/lib/librpc/demo/sort/sort_proc.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* @(#)sort_proc.c 2.1 88/08/11 4.0 RPCSRC */
-#include <rpc/rpc.h>
-#include "sort.h"
-
-static int
-comparestrings(sp1, sp2)
- char **sp1, **sp2;
-{
- return (strcmp(*sp1, *sp2));
-}
-
-struct sortstrings *
-sort_1(ssp)
- struct sortstrings *ssp;
-{
- static struct sortstrings ss_res;
-
- if (ss_res.ss.ss_val != (str *)NULL)
- free(ss_res.ss.ss_val);
-
- qsort(ssp->ss.ss_val, ssp->ss.ss_len, sizeof (char *), comparestrings);
- ss_res.ss.ss_len = ssp->ss.ss_len;
- ss_res.ss.ss_val = (str *)malloc(ssp->ss.ss_len * sizeof(str *));
- bcopy(ssp->ss.ss_val, ss_res.ss.ss_val,
- ssp->ss.ss_len * sizeof(str *));
- return(&ss_res);
-}
diff --git a/lib/librpc/doc/Makefile b/lib/librpc/doc/Makefile
deleted file mode 100644
index db819a0..0000000
--- a/lib/librpc/doc/Makefile
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/04 4.0 RPCSRC
-#
-#
-# The targets all.nroff and all.troff will make monolithic documents
-# with nroff and troff, respectively. The other *.nroff and *.troff
-# targets will make individual documents
-#
-TROFF= ditroff
-TOPTS= -t
-NROFF= nroff
-NOPTS=
-PIC= pic
-TBL= tbl
-EQN= eqn
-
-SRC= rpc.prog.ms rpcgen.ms xdr.nts.ms xdr.rfc.ms rpc.rfc.ms nfs.rfc.ms
-
-all default: all.nroff
-
-install: all.nroff
- @echo "Nothing installed."
-
-all.nroff: ${SRC}
- ${TBL} ${SRC} | ${EQN} | ${NROFF} ${NOPTS} -ms >all.nroff
-
-all.troff: ${SRC}
- ${TBL} ${SRC} | ${PIC} | ${EQN} | ${TROFF} ${TOPTS} -ms >all.troff
-
-#
-
-rpc.prog.nroff: rpc.prog.ms
- ${TBL} rpc.prog.ms | ${NROFF} ${NOPTS} -ms >rpc.prog.nroff
-
-rpc.prog.troff: rpc.prog.ms
- ${TBL} rpc.prog.ms | ${PIC} | ${TROFF} ${TOPTS} -ms >rpc.prog.troff
-
-#
-
-rpcgen.troff: rpcgen.ms
- ${TBL} rpcgen.ms | ${TROFF} ${TOPTS} -ms >rpcgen.troff
-
-rpcgen.nroff: rpcgen.ms
- ${TBL} rpcgen.ms | ${NROFF} ${NOPTS} -ms >rpcgen.nroff
-
-#
-
-xdr.nts.troff: xdr.nts.ms
- ${TBL} xdr.nts.ms | ${EQN} | ${TROFF} ${TOPTS} -ms >xdr.nts.troff
-
-xdr.nts.nroff: xdr.nts.ms
- ${TBL} xdr.nts.ms | ${EQN} | ${NROFF} ${NOPTS} -ms >xdr.nts.nroff
-
-#
-
-xdr.rfc.troff: xdr.rfc.ms
- ${TBL} xdr.rfc.ms | ${TROFF} ${TOPTS} -ms >xdr.rfc.troff
-
-xdr.rfc.nroff: xdr.rfc.ms
- ${TBL} xdr.rfc.ms | ${NROFF} ${NOPTS} -ms >xdr.rfc.nroff
-
-#
-
-rpc.rfc.troff: rpc.rfc.ms
- ${TBL} rpc.rfc.ms | ${TROFF} ${TOPTS} -ms >rpc.rfc.troff
-
-rpc.rfc.nroff: rpc.rfc.ms
- ${TBL} rpc.rfc.ms | ${NROFF} ${NOPTS} -ms >rpc.rfc.nroff
-
-#
-
-nfs.rfc.troff: nfs.rfc.ms
- ${TBL} nfs.rfc.ms | ${TROFF} ${TOPTS} -ms >nfs.rfc.troff
-
-nfs.rfc.nroff: nfs.rfc.ms
- ${TBL} nfs.rfc.ms | ${NROFF} ${NOPTS} -ms >nfs.rfc.nroff
-
-clean:
- rm -f *.nroff *.troff
-
-spell: ${SRC}
- @for i in ${SRC}; do \
- echo $$i; spell $$i | sort | comm -23 - spell.ok > $$i.spell; \
- done
diff --git a/lib/librpc/doc/nfs.rfc.ms b/lib/librpc/doc/nfs.rfc.ms
deleted file mode 100644
index 0c9a899..0000000
--- a/lib/librpc/doc/nfs.rfc.ms
+++ /dev/null
@@ -1,1372 +0,0 @@
-.\"
-.\" Must use -- tbl -- with this one
-.\"
-.\" @(#)nfs.rfc.ms 2.2 88/08/05 4.0 RPCSRC
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH 'Network File System: Version 2 Protocol Specification''Page %'
-.EH 'Page %''Network File System: Version 2 Protocol Specification'
-.if \\n%=1 .bp
-.SH
-\&Network File System: Version 2 Protocol Specification
-.IX NFS "" "" "" PAGE MAJOR
-.IX "Network File System" "" "" "" PAGE MAJOR
-.IX NFS "version-2 protocol specification"
-.IX "Network File System" "version-2 protocol specification"
-.LP
-.NH 0
-\&Status of this Standard
-.LP
-Note: This document specifies a protocol that Sun Microsystems, Inc.,
-and others are using. It specifies it in standard ARPA RFC form.
-.NH 1
-\&Introduction
-.IX NFS introduction
-.LP
-The Sun Network Filesystem (NFS) protocol provides transparent remote
-access to shared filesystems over local area networks. The NFS
-protocol is designed to be machine, operating system, network architecture,
-and transport protocol independent. This independence is
-achieved through the use of Remote Procedure Call (RPC) primitives
-built on top of an External Data Representation (XDR). Implementations
-exist for a variety of machines, from personal computers to
-supercomputers.
-.LP
-The supporting mount protocol allows the server to hand out remote
-access privileges to a restricted set of clients. It performs the
-operating system-specific functions that allow, for example, to
-attach remote directory trees to some local file system.
-.NH 2
-\&Remote Procedure Call
-.IX "Remote Procedure Call"
-.LP
-Sun's remote procedure call specification provides a procedure-
-oriented interface to remote services. Each server supplies a
-program that is a set of procedures. NFS is one such "program".
-The combination of host address, program number, and procedure
-number specifies one remote service procedure. RPC does not depend
-on services provided by specific protocols, so it can be used with
-any underlying transport protocol. See the
-.I "Remote Procedure Calls: Protocol Specification"
-chapter of this manual.
-.NH 2
-\&External Data Representation
-.IX "External Data Representation"
-.LP
-The External Data Representation (XDR) standard provides a common
-way of representing a set of data types over a network.
-The NFS
-Protocol Specification is written using the RPC data description
-language.
-For more information, see the
-.I " External Data Representation Standard: Protocol Specification."
-Sun provides implementations of XDR and
-RPC, but NFS does not require their use. Any software that
-provides equivalent functionality can be used, and if the encoding
-is exactly the same it can interoperate with other implementations
-of NFS.
-.NH 2
-\&Stateless Servers
-.IX "stateless servers"
-.IX servers stateless
-.LP
-The NFS protocol is stateless. That is, a server does not need to
-maintain any extra state information about any of its clients in
-order to function correctly. Stateless servers have a distinct
-advantage over stateful servers in the event of a failure. With
-stateless servers, a client need only retry a request until the
-server responds; it does not even need to know that the server has
-crashed, or the network temporarily went down. The client of a
-stateful server, on the other hand, needs to either detect a server
-crash and rebuild the server's state when it comes back up, or
-cause client operations to fail.
-.LP
-This may not sound like an important issue, but it affects the
-protocol in some unexpected ways. We feel that it is worth a bit
-of extra complexity in the protocol to be able to write very simple
-servers that do not require fancy crash recovery.
-.LP
-On the other hand, NFS deals with objects such as files and
-directories that inherently have state -- what good would a file be
-if it did not keep its contents intact? The goal is to not
-introduce any extra state in the protocol itself. Another way to
-simplify recovery is by making operations "idempotent" whenever
-possible (so that they can potentially be repeated).
-.NH 1
-\&NFS Protocol Definition
-.IX NFS "protocol definition"
-.IX NFS protocol
-.LP
-Servers have been known to change over time, and so can the
-protocol that they use. So RPC provides a version number with each
-RPC request. This RFC describes version two of the NFS protocol.
-Even in the second version, there are various obsolete procedures
-and parameters, which will be removed in later versions. An RFC
-for version three of the NFS protocol is currently under
-preparation.
-.NH 2
-\&File System Model
-.IX filesystem model
-.LP
-NFS assumes a file system that is hierarchical, with directories as
-all but the bottom-level files. Each entry in a directory (file,
-directory, device, etc.) has a string name. Different operating
-systems may have restrictions on the depth of the tree or the names
-used, as well as using different syntax to represent the "pathname",
-which is the concatenation of all the "components" (directory and
-file names) in the name. A "file system" is a tree on a single
-server (usually a single disk or physical partition) with a specified
-"root". Some operating systems provide a "mount" operation to make
-all file systems appear as a single tree, while others maintain a
-"forest" of file systems. Files are unstructured streams of
-uninterpreted bytes. Version 3 of NFS uses a slightly more general
-file system model.
-.LP
-NFS looks up one component of a pathname at a time. It may not be
-obvious why it does not just take the whole pathname, traipse down
-the directories, and return a file handle when it is done. There are
-several good reasons not to do this. First, pathnames need
-separators between the directory components, and different operating
-systems use different separators. We could define a Network Standard
-Pathname Representation, but then every pathname would have to be
-parsed and converted at each end. Other issues are discussed in
-\fINFS Implementation Issues\fP below.
-.LP
-Although files and directories are similar objects in many ways,
-different procedures are used to read directories and files. This
-provides a network standard format for representing directories. The
-same argument as above could have been used to justify a procedure
-that returns only one directory entry per call. The problem is
-efficiency. Directories can contain many entries, and a remote call
-to return each would be just too slow.
-.NH 2
-\&RPC Information
-.IX NFS "RPC information"
-.IP \fIAuthentication\fP
-The NFS service uses
-.I AUTH_UNIX ,
-.I AUTH_DES ,
-or
-.I AUTH_SHORT
-style
-authentication, except in the NULL procedure where
-.I AUTH_NONE
-is also allowed.
-.IP "\fITransport Protocols\fP"
-NFS currently is supported on UDP/IP only.
-.IP "\fIPort Number\fP"
-The NFS protocol currently uses the UDP port number 2049. This is
-not an officially assigned port, so later versions of the protocol
-use the \*QPortmapping\*U facility of RPC.
-.NH 2
-\&Sizes of XDR Structures
-.IX "XDR structure sizes"
-.LP
-These are the sizes, given in decimal bytes, of various XDR
-structures used in the protocol:
-.DS
-/* \fIThe maximum number of bytes of data in a READ or WRITE request\fP */
-const MAXDATA = 8192;
-
-/* \fIThe maximum number of bytes in a pathname argument\fP */
-const MAXPATHLEN = 1024;
-
-/* \fIThe maximum number of bytes in a file name argument\fP */
-const MAXNAMLEN = 255;
-
-/* \fIThe size in bytes of the opaque "cookie" passed by READDIR\fP */
-const COOKIESIZE = 4;
-
-/* \fIThe size in bytes of the opaque file handle\fP */
-const FHSIZE = 32;
-.DE
-.NH 2
-\&Basic Data Types
-.IX "NFS data types"
-.IX NFS "basic data types"
-.LP
-The following XDR definitions are basic structures and types used
-in other structures described further on.
-.KS
-.NH 3
-\&stat
-.IX "NFS data types" stat "" \fIstat\fP
-.DS
-enum stat {
- NFS_OK = 0,
- NFSERR_PERM=1,
- NFSERR_NOENT=2,
- NFSERR_IO=5,
- NFSERR_NXIO=6,
- NFSERR_ACCES=13,
- NFSERR_EXIST=17,
- NFSERR_NODEV=19,
- NFSERR_NOTDIR=20,
- NFSERR_ISDIR=21,
- NFSERR_FBIG=27,
- NFSERR_NOSPC=28,
- NFSERR_ROFS=30,
- NFSERR_NAMETOOLONG=63,
- NFSERR_NOTEMPTY=66,
- NFSERR_DQUOT=69,
- NFSERR_STALE=70,
- NFSERR_WFLUSH=99
-};
-.DE
-.KE
-.LP
-The
-.I stat
-type is returned with every procedure's results. A
-value of
-.I NFS_OK
-indicates that the call completed successfully and
-the results are valid. The other values indicate some kind of
-error occurred on the server side during the servicing of the
-procedure. The error values are derived from UNIX error numbers.
-.IP \fBNFSERR_PERM\fP:
-Not owner. The caller does not have correct ownership
-to perform the requested operation.
-.IP \fBNFSERR_NOENT\fP:
-No such file or directory. The file or directory
-specified does not exist.
-.IP \fBNFSERR_IO\fP:
-Some sort of hard error occurred when the operation was
-in progress. This could be a disk error, for example.
-.IP \fBNFSERR_NXIO\fP:
-No such device or address.
-.IP \fBNFSERR_ACCES\fP:
-Permission denied. The caller does not have the
-correct permission to perform the requested operation.
-.IP \fBNFSERR_EXIST\fP:
-File exists. The file specified already exists.
-.IP \fBNFSERR_NODEV\fP:
-No such device.
-.IP \fBNFSERR_NOTDIR\fP:
-Not a directory. The caller specified a
-non-directory in a directory operation.
-.IP \fBNFSERR_ISDIR\fP:
-Is a directory. The caller specified a directory in
-a non- directory operation.
-.IP \fBNFSERR_FBIG\fP:
-File too large. The operation caused a file to grow
-beyond the server's limit.
-.IP \fBNFSERR_NOSPC\fP:
-No space left on device. The operation caused the
-server's filesystem to reach its limit.
-.IP \fBNFSERR_ROFS\fP:
-Read-only filesystem. Write attempted on a read-only filesystem.
-.IP \fBNFSERR_NAMETOOLONG\fP:
-File name too long. The file name in an operation was too long.
-.IP \fBNFSERR_NOTEMPTY\fP:
-Directory not empty. Attempted to remove a
-directory that was not empty.
-.IP \fBNFSERR_DQUOT\fP:
-Disk quota exceeded. The client's disk quota on the
-server has been exceeded.
-.IP \fBNFSERR_STALE\fP:
-The "fhandle" given in the arguments was invalid.
-That is, the file referred to by that file handle no longer exists,
-or access to it has been revoked.
-.IP \fBNFSERR_WFLUSH\fP:
-The server's write cache used in the
-.I WRITECACHE
-call got flushed to disk.
-.LP
-.KS
-.NH 3
-\&ftype
-.IX "NFS data types" ftype "" \fIftype\fP
-.DS
-enum ftype {
- NFNON = 0,
- NFREG = 1,
- NFDIR = 2,
- NFBLK = 3,
- NFCHR = 4,
- NFLNK = 5
-};
-.DE
-.KE
-The enumeration
-.I ftype
-gives the type of a file. The type
-.I NFNON
-indicates a non-file,
-.I NFREG
-is a regular file,
-.I NFDIR
-is a directory,
-.I NFBLK
-is a block-special device,
-.I NFCHR
-is a character-special device, and
-.I NFLNK
-is a symbolic link.
-.KS
-.NH 3
-\&fhandle
-.IX "NFS data types" fhandle "" \fIfhandle\fP
-.DS
-typedef opaque fhandle[FHSIZE];
-.DE
-.KE
-The
-.I fhandle
-is the file handle passed between the server and the client.
-All file operations are done using file handles to refer to a file or
-directory. The file handle can contain whatever information the server
-needs to distinguish an individual file.
-.KS
-.NH 3
-\&timeval
-.IX "NFS data types" timeval "" \fItimeval\fP
-.DS
-struct timeval {
- unsigned int seconds;
- unsigned int useconds;
-};
-.DE
-.KE
-The
-.I timeval
-structure is the number of seconds and microseconds
-since midnight January 1, 1970, Greenwich Mean Time. It is used to
-pass time and date information.
-.KS
-.NH 3
-\&fattr
-.IX "NFS data types" fattr "" \fIfattr\fP
-.DS
-struct fattr {
- ftype type;
- unsigned int mode;
- unsigned int nlink;
- unsigned int uid;
- unsigned int gid;
- unsigned int size;
- unsigned int blocksize;
- unsigned int rdev;
- unsigned int blocks;
- unsigned int fsid;
- unsigned int fileid;
- timeval atime;
- timeval mtime;
- timeval ctime;
-};
-.DE
-.KE
-The
-.I fattr
-structure contains the attributes of a file; "type" is the type of
-the file; "nlink" is the number of hard links to the file (the number
-of different names for the same file); "uid" is the user
-identification number of the owner of the file; "gid" is the group
-identification number of the group of the file; "size" is the size in
-bytes of the file; "blocksize" is the size in bytes of a block of the
-file; "rdev" is the device number of the file if it is type
-.I NFCHR
-or
-.I NFBLK ;
-"blocks" is the number of blocks the file takes up on disk; "fsid" is
-the file system identifier for the filesystem containing the file;
-"fileid" is a number that uniquely identifies the file within its
-filesystem; "atime" is the time when the file was last accessed for
-either read or write; "mtime" is the time when the file data was last
-modified (written); and "ctime" is the time when the status of the
-file was last changed. Writing to the file also changes "ctime" if
-the size of the file changes.
-.LP
-"mode" is the access mode encoded as a set of bits. Notice that the
-file type is specified both in the mode bits and in the file type.
-This is really a bug in the protocol and will be fixed in future
-versions. The descriptions given below specify the bit positions
-using octal numbers.
-.TS
-box tab (&) ;
-cfI cfI
-lfL l .
-Bit&Description
-_
-0040000&This is a directory; "type" field should be NFDIR.
-0020000&This is a character special file; "type" field should be NFCHR.
-0060000&This is a block special file; "type" field should be NFBLK.
-0100000&This is a regular file; "type" field should be NFREG.
-0120000&This is a symbolic link file; "type" field should be NFLNK.
-0140000&This is a named socket; "type" field should be NFNON.
-0004000&Set user id on execution.
-0002000&Set group id on execution.
-0001000&Save swapped text even after use.
-0000400&Read permission for owner.
-0000200&Write permission for owner.
-0000100&Execute and search permission for owner.
-0000040&Read permission for group.
-0000020&Write permission for group.
-0000010&Execute and search permission for group.
-0000004&Read permission for others.
-0000002&Write permission for others.
-0000001&Execute and search permission for others.
-.TE
-.KS
-Notes:
-.IP
-The bits are the same as the mode bits returned by the
-.I stat(2)
-system call in the UNIX system. The file type is specified both in
-the mode bits and in the file type. This is fixed in future
-versions.
-.IP
-The "rdev" field in the attributes structure is an operating system
-specific device specifier. It will be removed and generalized in
-the next revision of the protocol.
-.KE
-.LP
-.KS
-.NH 3
-\&sattr
-.IX "NFS data types" sattr "" \fIsattr\fP
-.DS
-struct sattr {
- unsigned int mode;
- unsigned int uid;
- unsigned int gid;
- unsigned int size;
- timeval atime;
- timeval mtime;
-};
-.DE
-.KE
-The
-.I sattr
-structure contains the file attributes which can be set
-from the client. The fields are the same as for
-.I fattr
-above. A "size" of zero means the file should be truncated.
-A value of -1 indicates a field that should be ignored.
-.LP
-.KS
-.NH 3
-\&filename
-.IX "NFS data types" filename "" \fIfilename\fP
-.DS
-typedef string filename<MAXNAMLEN>;
-.DE
-.KE
-The type
-.I filename
-is used for passing file names or pathname components.
-.LP
-.KS
-.NH 3
-\&path
-.IX "NFS data types" path "" \fIpath\fP
-.DS
-typedef string path<MAXPATHLEN>;
-.DE
-.KE
-The type
-.I path
-is a pathname. The server considers it as a string
-with no internal structure, but to the client it is the name of a
-node in a filesystem tree.
-.LP
-.KS
-.NH 3
-\&attrstat
-.IX "NFS data types" attrstat "" \fIattrstat\fP
-.DS
-union attrstat switch (stat status) {
- case NFS_OK:
- fattr attributes;
- default:
- void;
-};
-.DE
-.KE
-The
-.I attrstat
-structure is a common procedure result. It contains
-a "status" and, if the call succeeded, it also contains the
-attributes of the file on which the operation was done.
-.LP
-.KS
-.NH 3
-\&diropargs
-.IX "NFS data types" diropargs "" \fIdiropargs\fP
-.DS
-struct diropargs {
- fhandle dir;
- filename name;
-};
-.DE
-.KE
-The
-.I diropargs
-structure is used in directory operations. The
-"fhandle" "dir" is the directory in which to find the file "name".
-A directory operation is one in which the directory is affected.
-.LP
-.KS
-.NH 3
-\&diropres
-.IX "NFS data types" diropres "" \fIdiropres\fP
-.DS
-union diropres switch (stat status) {
- case NFS_OK:
- struct {
- fhandle file;
- fattr attributes;
- } diropok;
- default:
- void;
-};
-.DE
-.KE
-The results of a directory operation are returned in a
-.I diropres
-structure. If the call succeeded, a new file handle "file" and the
-"attributes" associated with that file are returned along with the
-"status".
-.NH 2
-\&Server Procedures
-.IX "NFS server procedures" "" "" "" PAGE MAJOR
-.LP
-The protocol definition is given as a set of procedures with
-arguments and results defined using the RPC language. A brief
-description of the function of each procedure should provide enough
-information to allow implementation.
-.LP
-All of the procedures in the NFS protocol are assumed to be
-synchronous. When a procedure returns to the client, the client
-can assume that the operation has completed and any data associated
-with the request is now on stable storage. For example, a client
-.I WRITE
-request may cause the server to update data blocks,
-filesystem information blocks (such as indirect blocks), and file
-attribute information (size and modify times). When the
-.I WRITE
-returns to the client, it can assume that the write is safe, even
-in case of a server crash, and it can discard the data written.
-This is a very important part of the statelessness of the server.
-If the server waited to flush data from remote requests, the client
-would have to save those requests so that it could resend them in
-case of a server crash.
-.ie t .DS
-.el .DS L
-
-.ft I
-/*
-* Remote file service routines
-*/
-.ft CW
-program NFS_PROGRAM {
- version NFS_VERSION {
- void NFSPROC_NULL(void) = 0;
- attrstat NFSPROC_GETATTR(fhandle) = 1;
- attrstat NFSPROC_SETATTR(sattrargs) = 2;
- void NFSPROC_ROOT(void) = 3;
- diropres NFSPROC_LOOKUP(diropargs) = 4;
- readlinkres NFSPROC_READLINK(fhandle) = 5;
- readres NFSPROC_READ(readargs) = 6;
- void NFSPROC_WRITECACHE(void) = 7;
- attrstat NFSPROC_WRITE(writeargs) = 8;
- diropres NFSPROC_CREATE(createargs) = 9;
- stat NFSPROC_REMOVE(diropargs) = 10;
- stat NFSPROC_RENAME(renameargs) = 11;
- stat NFSPROC_LINK(linkargs) = 12;
- stat NFSPROC_SYMLINK(symlinkargs) = 13;
- diropres NFSPROC_MKDIR(createargs) = 14;
- stat NFSPROC_RMDIR(diropargs) = 15;
- readdirres NFSPROC_READDIR(readdirargs) = 16;
- statfsres NFSPROC_STATFS(fhandle) = 17;
- } = 2;
-} = 100003;
-.DE
-.KS
-.NH 3
-\&Do Nothing
-.IX "NFS server procedures" NFSPROC_NULL() "" \fINFSPROC_NULL()\fP
-.DS
-void
-NFSPROC_NULL(void) = 0;
-.DE
-.KE
-This procedure does no work. It is made available in all RPC
-services to allow server response testing and timing.
-.KS
-.NH 3
-\&Get File Attributes
-.IX "NFS server procedures" NFSPROC_GETATTR() "" \fINFSPROC_GETATTR()\fP
-.DS
-attrstat
-NFSPROC_GETATTR (fhandle) = 1;
-.DE
-.KE
-If the reply status is
-.I NFS_OK ,
-then the reply attributes contains
-the attributes for the file given by the input fhandle.
-.KS
-.NH 3
-\&Set File Attributes
-.IX "NFS server procedures" NFSPROC_SETATTR() "" \fINFSPROC_SETATTR()\fP
-.DS
-struct sattrargs {
- fhandle file;
- sattr attributes;
- };
-
-attrstat
-NFSPROC_SETATTR (sattrargs) = 2;
-.DE
-.KE
-The "attributes" argument contains fields which are either -1 or
-are the new value for the attributes of "file". If the reply
-status is
-.I NFS_OK ,
-then the reply attributes have the attributes of
-the file after the "SETATTR" operation has completed.
-.LP
-Note: The use of -1 to indicate an unused field in "attributes" is
-changed in the next version of the protocol.
-.KS
-.NH 3
-\&Get Filesystem Root
-.IX "NFS server procedures" NFSPROC_ROOT "" \fINFSPROC_ROOT\fP
-.DS
-void
-NFSPROC_ROOT(void) = 3;
-.DE
-.KE
-Obsolete. This procedure is no longer used because finding the
-root file handle of a filesystem requires moving pathnames between
-client and server. To do this right we would have to define a
-network standard representation of pathnames. Instead, the
-function of looking up the root file handle is done by the
-.I MNTPROC_MNT()
-procedure. (See the
-.I "Mount Protocol Definition"
-later in this chapter for details).
-.KS
-.NH 3
-\&Look Up File Name
-.IX "NFS server procedures" NFSPROC_LOOKUP() "" \fINFSPROC_LOOKUP()\fP
-.DS
-diropres
-NFSPROC_LOOKUP(diropargs) = 4;
-.DE
-.KE
-If the reply "status" is
-.I NFS_OK ,
-then the reply "file" and reply
-"attributes" are the file handle and attributes for the file "name"
-in the directory given by "dir" in the argument.
-.KS
-.NH 3
-\&Read From Symbolic Link
-.IX "NFS server procedures" NFSPROC_READLINK() "" \fINFSPROC_READLINK()\fP
-.DS
-union readlinkres switch (stat status) {
- case NFS_OK:
- path data;
- default:
- void;
-};
-
-readlinkres
-NFSPROC_READLINK(fhandle) = 5;
-.DE
-.KE
-If "status" has the value
-.I NFS_OK ,
-then the reply "data" is the data in
-the symbolic link given by the file referred to by the fhandle argument.
-.LP
-Note: since NFS always parses pathnames on the client, the
-pathname in a symbolic link may mean something different (or be
-meaningless) on a different client or on the server if a different
-pathname syntax is used.
-.KS
-.NH 3
-\&Read From File
-.IX "NFS server procedures" NFSPROC_READ "" \fINFSPROC_READ\fP
-.DS
-struct readargs {
- fhandle file;
- unsigned offset;
- unsigned count;
- unsigned totalcount;
-};
-
-union readres switch (stat status) {
- case NFS_OK:
- fattr attributes;
- opaque data<NFS_MAXDATA>;
- default:
- void;
-};
-
-readres
-NFSPROC_READ(readargs) = 6;
-.DE
-.KE
-Returns up to "count" bytes of "data" from the file given by
-"file", starting at "offset" bytes from the beginning of the file.
-The first byte of the file is at offset zero. The file attributes
-after the read takes place are returned in "attributes".
-.LP
-Note: The argument "totalcount" is unused, and is removed in the
-next protocol revision.
-.KS
-.NH 3
-\&Write to Cache
-.IX "NFS server procedures" NFSPROC_WRITECACHE() "" \fINFSPROC_WRITECACHE()\fP
-.DS
-void
-NFSPROC_WRITECACHE(void) = 7;
-.DE
-.KE
-To be used in the next protocol revision.
-.KS
-.NH 3
-\&Write to File
-.IX "NFS server procedures" NFSPROC_WRITE() "" \fINFSPROC_WRITE()\fP
-.DS
-struct writeargs {
- fhandle file;
- unsigned beginoffset;
- unsigned offset;
- unsigned totalcount;
- opaque data<NFS_MAXDATA>;
-};
-
-attrstat
-NFSPROC_WRITE(writeargs) = 8;
-.DE
-.KE
-Writes "data" beginning "offset" bytes from the beginning of
-"file". The first byte of the file is at offset zero. If the
-reply "status" is NFS_OK, then the reply "attributes" contains the
-attributes of the file after the write has completed. The write
-operation is atomic. Data from this call to
-.I WRITE
-will not be mixed with data from another client's calls.
-.LP
-Note: The arguments "beginoffset" and "totalcount" are ignored and
-are removed in the next protocol revision.
-.KS
-.NH 3
-\&Create File
-.IX "NFS server procedures" NFSPROC_CREATE() "" \fINFSPROC_CREATE()\fP
-.DS
-struct createargs {
- diropargs where;
- sattr attributes;
-};
-
-diropres
-NFSPROC_CREATE(createargs) = 9;
-.DE
-.KE
-The file "name" is created in the directory given by "dir". The
-initial attributes of the new file are given by "attributes". A
-reply "status" of NFS_OK indicates that the file was created, and
-reply "file" and reply "attributes" are its file handle and
-attributes. Any other reply "status" means that the operation
-failed and no file was created.
-.LP
-Note: This routine should pass an exclusive create flag, meaning
-"create the file only if it is not already there".
-.KS
-.NH 3
-\&Remove File
-.IX "NFS server procedures" NFSPROC_REMOVE() "" \fINFSPROC_REMOVE()\fP
-.DS
-stat
-NFSPROC_REMOVE(diropargs) = 10;
-.DE
-.KE
-The file "name" is removed from the directory given by "dir". A
-reply of NFS_OK means the directory entry was removed.
-.LP
-Note: possibly non-idempotent operation.
-.KS
-.NH 3
-\&Rename File
-.IX "NFS server procedures" NFSPROC_RENAME() "" \fINFSPROC_RENAME()\fP
-.DS
-struct renameargs {
- diropargs from;
- diropargs to;
-};
-
-stat
-NFSPROC_RENAME(renameargs) = 11;
-.DE
-.KE
-The existing file "from.name" in the directory given by "from.dir"
-is renamed to "to.name" in the directory given by "to.dir". If the
-reply is
-.I NFS_OK ,
-the file was renamed. The
-RENAME
-operation is
-atomic on the server; it cannot be interrupted in the middle.
-.LP
-Note: possibly non-idempotent operation.
-.KS
-.NH 3
-\&Create Link to File
-.IX "NFS server procedures" NFSPROC_LINK() "" \fINFSPROC_LINK()\fP
-.DS
-struct linkargs {
- fhandle from;
- diropargs to;
-};
-
-stat
-NFSPROC_LINK(linkargs) = 12;
-.DE
-.KE
-Creates the file "to.name" in the directory given by "to.dir",
-which is a hard link to the existing file given by "from". If the
-return value is
-.I NFS_OK ,
-a link was created. Any other return value
-indicates an error, and the link was not created.
-.LP
-A hard link should have the property that changes to either of the
-linked files are reflected in both files. When a hard link is made
-to a file, the attributes for the file should have a value for
-"nlink" that is one greater than the value before the link.
-.LP
-Note: possibly non-idempotent operation.
-.KS
-.NH 3
-\&Create Symbolic Link
-.IX "NFS server procedures" NFSPROC_SYMLINK() "" \fINFSPROC_SYMLINK()\fP
-.DS
-struct symlinkargs {
- diropargs from;
- path to;
- sattr attributes;
-};
-
-stat
-NFSPROC_SYMLINK(symlinkargs) = 13;
-.DE
-.KE
-Creates the file "from.name" with ftype
-.I NFLNK
-in the directory
-given by "from.dir". The new file contains the pathname "to" and
-has initial attributes given by "attributes". If the return value
-is
-.I NFS_OK ,
-a link was created. Any other return value indicates an
-error, and the link was not created.
-.LP
-A symbolic link is a pointer to another file. The name given in
-"to" is not interpreted by the server, only stored in the newly
-created file. When the client references a file that is a symbolic
-link, the contents of the symbolic link are normally transparently
-reinterpreted as a pathname to substitute. A
-.I READLINK
-operation returns the data to the client for interpretation.
-.LP
-Note: On UNIX servers the attributes are never used, since
-symbolic links always have mode 0777.
-.KS
-.NH 3
-\&Create Directory
-.IX "NFS server procedures" NFSPROC_MKDIR() "" \fINFSPROC_MKDIR()\fP
-.DS
-diropres
-NFSPROC_MKDIR (createargs) = 14;
-.DE
-.KE
-The new directory "where.name" is created in the directory given by
-"where.dir". The initial attributes of the new directory are given
-by "attributes". A reply "status" of NFS_OK indicates that the new
-directory was created, and reply "file" and reply "attributes" are
-its file handle and attributes. Any other reply "status" means
-that the operation failed and no directory was created.
-.LP
-Note: possibly non-idempotent operation.
-.KS
-.NH 3
-\&Remove Directory
-.IX "NFS server procedures" NFSPROC_RMDIR() "" \fINFSPROC_RMDIR()\fP
-.DS
-stat
-NFSPROC_RMDIR(diropargs) = 15;
-.DE
-.KE
-The existing empty directory "name" in the directory given by "dir"
-is removed. If the reply is
-.I NFS_OK ,
-the directory was removed.
-.LP
-Note: possibly non-idempotent operation.
-.KS
-.NH 3
-\&Read From Directory
-.IX "NFS server procedures" NFSPROC_READDIR() "" \fINFSPROC_READDIR()\fP
-.DS
-struct readdirargs {
- fhandle dir;
- nfscookie cookie;
- unsigned count;
-};
-
-struct entry {
- unsigned fileid;
- filename name;
- nfscookie cookie;
- entry *nextentry;
-};
-
-union readdirres switch (stat status) {
- case NFS_OK:
- struct {
- entry *entries;
- bool eof;
- } readdirok;
- default:
- void;
-};
-
-readdirres
-NFSPROC_READDIR (readdirargs) = 16;
-.DE
-.KE
-Returns a variable number of directory entries, with a total size
-of up to "count" bytes, from the directory given by "dir". If the
-returned value of "status" is
-.I NFS_OK ,
-then it is followed by a
-variable number of "entry"s. Each "entry" contains a "fileid"
-which consists of a unique number to identify the file within a
-filesystem, the "name" of the file, and a "cookie" which is an
-opaque pointer to the next entry in the directory. The cookie is
-used in the next
-.I READDIR
-call to get more entries starting at a
-given point in the directory. The special cookie zero (all bits
-zero) can be used to get the entries starting at the beginning of
-the directory. The "fileid" field should be the same number as the
-"fileid" in the the attributes of the file. (See the
-.I "Basic Data Types"
-section.)
-The "eof" flag has a value of
-.I TRUE
-if there are no more entries in the directory.
-.KS
-.NH 3
-\&Get Filesystem Attributes
-.IX "NFS server procedures" NFSPROC_STATFS() "" \fINFSPROC_STATFS()\fP
-.DS
-union statfsres (stat status) {
- case NFS_OK:
- struct {
- unsigned tsize;
- unsigned bsize;
- unsigned blocks;
- unsigned bfree;
- unsigned bavail;
- } info;
- default:
- void;
-};
-
-statfsres
-NFSPROC_STATFS(fhandle) = 17;
-.DE
-.KE
-If the reply "status" is
-.I NFS_OK ,
-then the reply "info" gives the
-attributes for the filesystem that contains file referred to by the
-input fhandle. The attribute fields contain the following values:
-.IP tsize:
-The optimum transfer size of the server in bytes. This is
-the number of bytes the server would like to have in the
-data part of READ and WRITE requests.
-.IP bsize:
-The block size in bytes of the filesystem.
-.IP blocks:
-The total number of "bsize" blocks on the filesystem.
-.IP bfree:
-The number of free "bsize" blocks on the filesystem.
-.IP bavail:
-The number of "bsize" blocks available to non-privileged users.
-.LP
-Note: This call does not work well if a filesystem has variable
-size blocks.
-.NH 1
-\&NFS Implementation Issues
-.IX NFS implementation
-.LP
-The NFS protocol is designed to be operating system independent, but
-since this version was designed in a UNIX environment, many
-operations have semantics similar to the operations of the UNIX file
-system. This section discusses some of the implementation-specific
-semantic issues.
-.NH 2
-\&Server/Client Relationship
-.IX NFS "server/client relationship"
-.LP
-The NFS protocol is designed to allow servers to be as simple and
-general as possible. Sometimes the simplicity of the server can be a
-problem, if the client wants to implement complicated filesystem
-semantics.
-.LP
-For example, some operating systems allow removal of open files. A
-process can open a file and, while it is open, remove it from the
-directory. The file can be read and written as long as the process
-keeps it open, even though the file has no name in the filesystem.
-It is impossible for a stateless server to implement these semantics.
-The client can do some tricks such as renaming the file on remove,
-and only removing it on close. We believe that the server provides
-enough functionality to implement most file system semantics on the
-client.
-.LP
-Every NFS client can also potentially be a server, and remote and
-local mounted filesystems can be freely intermixed. This leads to
-some interesting problems when a client travels down the directory
-tree of a remote filesystem and reaches the mount point on the server
-for another remote filesystem. Allowing the server to follow the
-second remote mount would require loop detection, server lookup, and
-user revalidation. Instead, we decided not to let clients cross a
-server's mount point. When a client does a LOOKUP on a directory on
-which the server has mounted a filesystem, the client sees the
-underlying directory instead of the mounted directory. A client can
-do remote mounts that match the server's mount points to maintain the
-server's view.
-.LP
-.NH 2
-\&Pathname Interpretation
-.IX NFS "pathname interpretation"
-.LP
-There are a few complications to the rule that pathnames are always
-parsed on the client. For example, symbolic links could have
-different interpretations on different clients. Another common
-problem for non-UNIX implementations is the special interpretation of
-the pathname ".." to mean the parent of a given directory. The next
-revision of the protocol uses an explicit flag to indicate the parent
-instead.
-.NH 2
-\&Permission Issues
-.IX NFS "permission issues"
-.LP
-The NFS protocol, strictly speaking, does not define the permission
-checking used by servers. However, it is expected that a server
-will do normal operating system permission checking using
-.I AUTH_UNIX
-style authentication as the basis of its protection mechanism. The
-server gets the client's effective "uid", effective "gid", and groups
-on each call and uses them to check permission. There are various
-problems with this method that can been resolved in interesting ways.
-.LP
-Using "uid" and "gid" implies that the client and server share the
-same "uid" list. Every server and client pair must have the same
-mapping from user to "uid" and from group to "gid". Since every
-client can also be a server, this tends to imply that the whole
-network shares the same "uid/gid" space.
-.I AUTH_DES
-(and the next
-revision of the NFS protocol) uses string names instead of numbers,
-but there are still complex problems to be solved.
-.LP
-Another problem arises due to the usually stateful open operation.
-Most operating systems check permission at open time, and then check
-that the file is open on each read and write request. With stateless
-servers, the server has no idea that the file is open and must do
-permission checking on each read and write call. On a local
-filesystem, a user can open a file and then change the permissions so
-that no one is allowed to touch it, but will still be able to write
-to the file because it is open. On a remote filesystem, by contrast,
-the write would fail. To get around this problem, the server's
-permission checking algorithm should allow the owner of a file to
-access it regardless of the permission setting.
-.LP
-A similar problem has to do with paging in from a file over the
-network. The operating system usually checks for execute permission
-before opening a file for demand paging, and then reads blocks from
-the open file. The file may not have read permission, but after it
-is opened it doesn't matter. An NFS server can not tell the
-difference between a normal file read and a demand page-in read. To
-make this work, the server allows reading of files if the "uid" given
-in the call has execute or read permission on the file.
-.LP
-In most operating systems, a particular user (on the user ID zero)
-has access to all files no matter what permission and ownership they
-have. This "super-user" permission may not be allowed on the server,
-since anyone who can become super-user on their workstation could
-gain access to all remote files. The UNIX server by default maps
-user id 0 to -2 before doing its access checking. This works except
-for NFS root filesystems, where super-user access cannot be avoided.
-.NH 2
-\&Setting RPC Parameters
-.IX NFS "setting RPC parameters"
-.LP
-Various file system parameters and options should be set at mount
-time. The mount protocol is described in the appendix below. For
-example, "Soft" mounts as well as "Hard" mounts are usually both
-provided. Soft mounted file systems return errors when RPC
-operations fail (after a given number of optional retransmissions),
-while hard mounted file systems continue to retransmit forever.
-Clients and servers may need to keep caches of recent operations to
-help avoid problems with non-idempotent operations.
-.NH 1
-\&Mount Protocol Definition
-.IX "mount protocol" "" "" "" PAGE MAJOR
-.sp 1
-.NH 2
-\&Introduction
-.IX "mount protocol" introduction
-.LP
-The mount protocol is separate from, but related to, the NFS
-protocol. It provides operating system specific services to get the
-NFS off the ground -- looking up server path names, validating user
-identity, and checking access permissions. Clients use the mount
-protocol to get the first file handle, which allows them entry into a
-remote filesystem.
-.LP
-The mount protocol is kept separate from the NFS protocol to make it
-easy to plug in new access checking and validation methods without
-changing the NFS server protocol.
-.LP
-Notice that the protocol definition implies stateful servers because
-the server maintains a list of client's mount requests. The mount
-list information is not critical for the correct functioning of
-either the client or the server. It is intended for advisory use
-only, for example, to warn possible clients when a server is going
-down.
-.LP
-Version one of the mount protocol is used with version two of the NFS
-protocol. The only connecting point is the
-.I fhandle
-structure, which is the same for both protocols.
-.NH 2
-\&RPC Information
-.IX "mount protocol" "RPC information"
-.IP \fIAuthentication\fP
-The mount service uses
-.I AUTH_UNIX
-and
-.I AUTH_DES
-style authentication only.
-.IP "\fITransport Protocols\fP"
-The mount service is currently supported on UDP/IP only.
-.IP "\fIPort Number\fP"
-Consult the server's portmapper, described in the chapter
-.I "Remote Procedure Calls: Protocol Specification",
-to find the port number on which the mount service is registered.
-.NH 2
-\&Sizes of XDR Structures
-.IX "mount protocol" "XDR structure sizes"
-.LP
-These are the sizes, given in decimal bytes, of various XDR
-structures used in the protocol:
-.DS
-/* \fIThe maximum number of bytes in a pathname argument\fP */
-const MNTPATHLEN = 1024;
-
-/* \fIThe maximum number of bytes in a name argument\fP */
-const MNTNAMLEN = 255;
-
-/* \fIThe size in bytes of the opaque file handle\fP */
-const FHSIZE = 32;
-.DE
-.NH 2
-\&Basic Data Types
-.IX "mount protocol" "basic data types"
-.IX "mount data types"
-.LP
-This section presents the data types used by the mount protocol.
-In many cases they are similar to the types used in NFS.
-.KS
-.NH 3
-\&fhandle
-.IX "mount data types" fhandle "" \fIfhandle\fP
-.DS
-typedef opaque fhandle[FHSIZE];
-.DE
-.KE
-The type
-.I fhandle
-is the file handle that the server passes to the
-client. All file operations are done using file handles to refer
-to a file or directory. The file handle can contain whatever
-information the server needs to distinguish an individual file.
-.LP
-This is the same as the "fhandle" XDR definition in version 2 of
-the NFS protocol; see
-.I "Basic Data Types"
-in the definition of the NFS protocol, above.
-.KS
-.NH 3
-\&fhstatus
-.IX "mount data types" fhstatus "" \fIfhstatus\fP
-.DS
-union fhstatus switch (unsigned status) {
- case 0:
- fhandle directory;
- default:
- void;
-};
-.DE
-.KE
-The type
-.I fhstatus
-is a union. If a "status" of zero is returned,
-the call completed successfully, and a file handle for the
-"directory" follows. A non-zero status indicates some sort of
-error. In this case the status is a UNIX error number.
-.KS
-.NH 3
-\&dirpath
-.IX "mount data types" dirpath "" \fIdirpath\fP
-.DS
-typedef string dirpath<MNTPATHLEN>;
-.DE
-.KE
-The type
-.I dirpath
-is a server pathname of a directory.
-.KS
-.NH 3
-\&name
-.IX "mount data types" name "" \fIname\fP
-.DS
-typedef string name<MNTNAMLEN>;
-.DE
-.KE
-The type
-.I name
-is an arbitrary string used for various names.
-.NH 2
-\&Server Procedures
-.IX "mount server procedures"
-.LP
-The following sections define the RPC procedures supplied by a
-mount server.
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* Protocol description for the mount program
-*/
-.ft CW
-
-program MOUNTPROG {
-.ft I
-/*
-* Version 1 of the mount protocol used with
-* version 2 of the NFS protocol.
-*/
-.ft CW
- version MOUNTVERS {
- void MOUNTPROC_NULL(void) = 0;
- fhstatus MOUNTPROC_MNT(dirpath) = 1;
- mountlist MOUNTPROC_DUMP(void) = 2;
- void MOUNTPROC_UMNT(dirpath) = 3;
- void MOUNTPROC_UMNTALL(void) = 4;
- exportlist MOUNTPROC_EXPORT(void) = 5;
- } = 1;
-} = 100005;
-.DE
-.KS
-.NH 3
-\&Do Nothing
-.IX "mount server procedures" MNTPROC_NULL() "" \fIMNTPROC_NULL()\fP
-.DS
-void
-MNTPROC_NULL(void) = 0;
-.DE
-.KE
-This procedure does no work. It is made available in all RPC
-services to allow server response testing and timing.
-.KS
-.NH 3
-\&Add Mount Entry
-.IX "mount server procedures" MNTPROC_MNT() "" \fIMNTPROC_MNT()\fP
-.DS
-fhstatus
-MNTPROC_MNT(dirpath) = 1;
-.DE
-.KE
-If the reply "status" is 0, then the reply "directory" contains the
-file handle for the directory "dirname". This file handle may be
-used in the NFS protocol. This procedure also adds a new entry to
-the mount list for this client mounting "dirname".
-.KS
-.NH 3
-\&Return Mount Entries
-.IX "mount server procedures" MNTPROC_DUMP() "" \fIMNTPROC_DUMP()\fP
-.DS
-struct *mountlist {
- name hostname;
- dirpath directory;
- mountlist nextentry;
-};
-
-mountlist
-MNTPROC_DUMP(void) = 2;
-.DE
-.KE
-Returns the list of remote mounted filesystems. The "mountlist"
-contains one entry for each "hostname" and "directory" pair.
-.KS
-.NH 3
-\&Remove Mount Entry
-.IX "mount server procedures" MNTPROC_UMNT() "" \fIMNTPROC_UMNT()\fP
-.DS
-void
-MNTPROC_UMNT(dirpath) = 3;
-.DE
-.KE
-Removes the mount list entry for the input "dirpath".
-.KS
-.NH 3
-\&Remove All Mount Entries
-.IX "mount server procedures" MNTPROC_UMNTALL() "" \fIMNTPROC_UMNTALL()\fP
-.DS
-void
-MNTPROC_UMNTALL(void) = 4;
-.DE
-.KE
-Removes all of the mount list entries for this client.
-.KS
-.NH 3
-\&Return Export List
-.IX "mount server procedures" MNTPROC_EXPORT() "" \fIMNTPROC_EXPORT()\fP
-.DS
-struct *groups {
- name grname;
- groups grnext;
-};
-
-struct *exportlist {
- dirpath filesys;
- groups groups;
- exportlist next;
-};
-
-exportlist
-MNTPROC_EXPORT(void) = 5;
-.DE
-.KE
-Returns a variable number of export list entries. Each entry
-contains a filesystem name and a list of groups that are allowed to
-import it. The filesystem name is in "filesys", and the group name
-is in the list "groups".
-.LP
-Note: The exportlist should contain
-more information about the status of the filesystem, such as a
-read-only flag.
diff --git a/lib/librpc/doc/rpc.prog.ms b/lib/librpc/doc/rpc.prog.ms
deleted file mode 100644
index 3b02447..0000000
--- a/lib/librpc/doc/rpc.prog.ms
+++ /dev/null
@@ -1,2684 +0,0 @@
-.\"
-.\" Must use -- tbl and pic -- with this one
-.\"
-.\" @(#)rpc.prog.ms 2.3 88/08/11 4.0 RPCSRC
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.IX "Network Programming" "" "" "" PAGE MAJOR
-.nr OF 0
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH 'Remote Procedure Call Programming Guide''Page %'
-.EH 'Page %''Remote Procedure Call Programming Guide'
-.SH
-\&Remote Procedure Call Programming Guide
-.nr OF 1
-.IX "RPC Programming Guide"
-.LP
-This document assumes a working knowledge of network theory. It is
-intended for programmers who wish to write network applications using
-remote procedure calls (explained below), and who want to understand
-the RPC mechanisms usually hidden by the
-.I rpcgen(1)
-protocol compiler.
-.I rpcgen
-is described in detail in the previous chapter, the
-.I "\fBrpcgen\fP \fIProgramming Guide\fP".
-.SH
-Note:
-.I
-.IX rpcgen "" \fIrpcgen\fP
-Before attempting to write a network application, or to convert an
-existing non-network application to run over the network, you may want to
-understand the material in this chapter. However, for most applications,
-you can circumvent the need to cope with the details presented here by using
-.I rpcgen .
-The
-.I "Generating XDR Routines"
-section of that chapter contains the complete source for a working RPC
-service\(ema remote directory listing service which uses
-.I rpcgen
-to generate XDR routines as well as client and server stubs.
-.LP
-.LP
-What are remote procedure calls? Simply put, they are the high-level
-communications paradigm used in the operating system.
-RPC presumes the existence of
-low-level networking mechanisms (such as TCP/IP and UDP/IP), and upon them
-it implements a logical client to server communications system designed
-specifically for the support of network applications. With RPC, the client
-makes a procedure call to send a data packet to the server. When the
-packet arrives, the server calls a dispatch routine, performs whatever
-service is requested, sends back the reply, and the procedure call returns
-to the client.
-.NH 0
-\&Layers of RPC
-.IX "layers of RPC"
-.IX "RPC" "layers"
-.LP
-The RPC interface can be seen as being divided into three layers.\**
-.FS
-For a complete specification of the routines in the remote procedure
-call Library, see the
-.I rpc(3N)
-manual page.
-.FE
-.LP
-.I "The Highest Layer:"
-.IX RPC "The Highest Layer"
-The highest layer is totally transparent to the operating system,
-machine and network upon which is is run. It's probably best to
-think of this level as a way of
-.I using
-RPC, rather than as
-a \fIpart of\fP RPC proper. Programmers who write RPC routines
-should (almost) always make this layer available to others by way
-of a simple C front end that entirely hides the networking.
-.LP
-To illustrate, at this level a program can simply make a call to
-.I rnusers (),
-a C routine which returns the number of users on a remote machine.
-The user is not explicitly aware of using RPC \(em they simply
-call a procedure, just as they would call
-.I malloc() .
-.LP
-.I "The Middle Layer:"
-.IX RPC "The Middle Layer"
-The middle layer is really \*QRPC proper.\*U Here, the user doesn't
-need to consider details about sockets, the UNIX system, or other low-level
-implementation mechanisms. They simply make remote procedure calls
-to routines on other machines. The selling point here is simplicity.
-It's this layer that allows RPC to pass the \*Qhello world\*U test \(em
-simple things should be simple. The middle-layer routines are used
-for most applications.
-.LP
-RPC calls are made with the system routines
-.I registerrpc()
-.I callrpc()
-and
-.I svc_run ().
-The first two of these are the most fundamental:
-.I registerrpc()
-obtains a unique system-wide procedure-identification number, and
-.I callrpc()
-actually executes a remote procedure call. At the middle level, a
-call to
-.I rnusers()
-is implemented by way of these two routines.
-.LP
-The middle layer is unfortunately rarely used in serious programming
-due to its inflexibility (simplicity). It does not allow timeout
-specifications or the choice of transport. It allows no UNIX
-process control or flexibility in case of errors. It doesn't support
-multiple kinds of call authentication. The programmer rarely needs
-all these kinds of control, but one or two of them is often necessary.
-.LP
-.I "The Lowest Layer:"
-.IX RPC "The Lowest Layer"
-The lowest layer does allow these details to be controlled by the
-programmer, and for that reason it is often necessary. Programs
-written at this level are also most efficient, but this is rarely a
-real issue \(em since RPC clients and servers rarely generate
-heavy network loads.
-.LP
-Although this document only discusses the interface to C,
-remote procedure calls can be made from any language.
-Even though this document discusses RPC
-when it is used to communicate
-between processes on different machines,
-it works just as well for communication
-between different processes on the same machine.
-.br
-.KS
-.NH 2
-\&The RPC Paradigm
-.IX RPC paradigm
-.LP
-Here is a diagram of the RPC paradigm:
-.LP
-\fBFigure 1-1\fI Network Communication with the Remote Reocedure Call\fR
-.LP
-.PS
-L1: arrow down 1i "client " rjust "program " rjust
-L2: line right 1.5i "\fIcallrpc\fP" "function"
-move up 1.5i; line dotted down 6i; move up 4.5i
-arrow right 1i
-L3: arrow down 1i "invoke " rjust "service " rjust
-L4: arrow right 1.5i "call" "service"
-L5: arrow down 1i " service" ljust " executes" ljust
-L6: arrow left 1.5i "\fIreturn\fP" "answer"
-L7: arrow down 1i "request " rjust "completed " rjust
-L8: line left 1i
-arrow left 1.5i "\fIreturn\fP" "reply"
-L9: arrow down 1i "program " rjust "continues " rjust
-line dashed down from L2 to L9
-line dashed down from L4 to L7
-line dashed up 1i from L3 "service " rjust "daemon " rjust
-arrow dashed down 1i from L8
-move right 1i from L3
-box invis "Machine B"
-move left 1.2i from L2; move down
-box invis "Machine A"
-.PE
-.KE
-.KS
-.NH 1
-\&Higher Layers of RPC
-.NH 2
-\&Highest Layer
-.IX "highest layer of RPC"
-.IX RPC "highest layer"
-.LP
-Imagine you're writing a program that needs to know
-how many users are logged into a remote machine.
-You can do this by calling the RPC library routine
-.I rnusers()
-as illustrated below:
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- int num;
-
- if (argc != 2) {
- fprintf(stderr, "usage: rnusers hostname\en");
- exit(1);
- }
- if ((num = rnusers(argv[1])) < 0) {
- fprintf(stderr, "error: rnusers\en");
- exit(-1);
- }
- printf("%d users on %s\en", num, argv[1]);
- exit(0);
-}
-.DE
-.KE
-RPC library routines such as
-.I rnusers()
-are in the RPC services library
-.I librpcsvc.a
-Thus, the program above should be compiled with
-.DS
-.ft CW
-% cc \fIprogram.c -lrpcsvc\fP
-.DE
-.I rnusers (),
-like the other RPC library routines, is documented in section 3R
-of the
-.I "System Interface Manual for the Sun Workstation" ,
-the same section which documents the standard Sun RPC services.
-.IX "RPC Services"
-See the
-.I intro(3R)
-manual page for an explanation of the documentation strategy
-for these services and their RPC protocols.
-.LP
-Here are some of the RPC service library routines available to the
-C programmer:
-.LP
-\fBTable 3-3\fI RPC Service Library Routines\RP
-.TS
-box tab (&) ;
-cfI cfI
-lfL l .
-Routine&Description
-_
-.sp.5
-rnusers&Return number of users on remote machine
-rusers&Return information about users on remote machine
-havedisk&Determine if remote machine has disk
-rstats&Get performance data from remote kernel
-rwall&Write to specified remote machines
-yppasswd&Update user password in Yellow Pages
-.TE
-.LP
-Other RPC services \(em for example
-.I ether()
-.I mount
-.I rquota()
-and
-.I spray
-\(em are not available to the C programmer as library routines.
-They do, however,
-have RPC program numbers so they can be invoked with
-.I callrpc()
-which will be discussed in the next section. Most of them also
-have compilable
-.I rpcgen(1)
-protocol description files. (The
-.I rpcgen
-protocol compiler radically simplifies the process of developing
-network applications.
-See the \fBrpcgen\fI Programming Guide\fR
-for detailed information about
-.I rpcgen
-and
-.I rpcgen
-protocol description files).
-.KS
-.NH 2
-\&Intermediate Layer
-.IX "intermediate layer of RPC"
-.IX "RPC" "intermediate layer"
-.LP
-The simplest interface, which explicitly makes RPC calls, uses the
-functions
-.I callrpc()
-and
-.I registerrpc()
-Using this method, the number of remote users can be gotten as follows:
-.ie t .DS
-.el .DS L
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <utmp.h>
-#include <rpcsvc/rusers.h>
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- unsigned long nusers;
- int stat;
-
- if (argc != 2) {
- fprintf(stderr, "usage: nusers hostname\en");
- exit(-1);
- }
- if (stat = callrpc(argv[1],
- RUSERSPROG, RUSERSVERS, RUSERSPROC_NUM,
- xdr_void, 0, xdr_u_long, &nusers) != 0) {
- clnt_perrno(stat);
- exit(1);
- }
- printf("%d users on %s\en", nusers, argv[1]);
- exit(0);
-}
-.DE
-.KE
-Each RPC procedure is uniquely defined by a program number,
-version number, and procedure number. The program number
-specifies a group of related remote procedures, each of
-which has a different procedure number. Each program also
-has a version number, so when a minor change is made to a
-remote service (adding a new procedure, for example), a new
-program number doesn't have to be assigned. When you want
-to call a procedure to find the number of remote users, you
-look up the appropriate program, version and procedure numbers
-in a manual, just as you look up the name of a memory allocator
-when you want to allocate memory.
-.LP
-The simplest way of making remote procedure calls is with the the RPC
-library routine
-.I callrpc()
-It has eight parameters. The first is the name of the remote server
-machine. The next three parameters are the program, version, and procedure
-numbers\(emtogether they identify the procedure to be called.
-The fifth and sixth parameters are an XDR filter and an argument to
-be encoded and passed to the remote procedure.
-The final two parameters are a filter for decoding the results
-returned by the remote procedure and a pointer to the place where
-the procedure's results are to be stored. Multiple arguments and
-results are handled by embedding them in structures. If
-.I callrpc()
-completes successfully, it returns zero; else it returns a nonzero
-value. The return codes (of type
-.IX "enum clnt_stat (in RPC programming)" "" "\fIenum clnt_stat\fP (in RPC programming)"
-cast into an integer) are found in
-.I <rpc/clnt.h> .
-.LP
-Since data types may be represented differently on different machines,
-.I callrpc()
-needs both the type of the RPC argument, as well as
-a pointer to the argument itself (and similarly for the result). For
-.I RUSERSPROC_NUM ,
-the return value is an
-.I "unsigned long"
-so
-.I callrpc()
-has
-.I xdr_u_long()
-as its first return parameter, which says
-that the result is of type
-.I "unsigned long"
-and
-.I &nusers
-as its second return parameter,
-which is a pointer to where the long result will be placed. Since
-.I RUSERSPROC_NUM
-takes no argument, the argument parameter of
-.I callrpc()
-is
-.I xdr_void ().
-.LP
-After trying several times to deliver a message, if
-.I callrpc()
-gets no answer, it returns with an error code.
-The delivery mechanism is UDP,
-which stands for User Datagram Protocol.
-Methods for adjusting the number of retries
-or for using a different protocol require you to use the lower
-layer of the RPC library, discussed later in this document.
-The remote server procedure
-corresponding to the above might look like this:
-.ie t .DS
-.el .DS L
-.ft CW
-.ft CW
-char *
-nuser(indata)
- char *indata;
-{
- unsigned long nusers;
-
-.ft I
- /*
- * Code here to compute the number of users
- * and place result in variable \fInusers\fP.
- */
-.ft CW
- return((char *)&nusers);
-}
-.DE
-.LP
-It takes one argument, which is a pointer to the input
-of the remote procedure call (ignored in our example),
-and it returns a pointer to the result.
-In the current version of C,
-character pointers are the generic pointers,
-so both the input argument and the return value are cast to
-.I "char *" .
-.LP
-Normally, a server registers all of the RPC calls it plans
-to handle, and then goes into an infinite loop waiting to service requests.
-In this example, there is only a single procedure
-to register, so the main body of the server would look like this:
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <utmp.h>
-#include <rpcsvc/rusers.h>
-
-char *nuser();
-
-main()
-{
- registerrpc(RUSERSPROG, RUSERSVERS, RUSERSPROC_NUM,
- nuser, xdr_void, xdr_u_long);
- svc_run(); /* \fINever returns\fP */
- fprintf(stderr, "Error: svc_run returned!\en");
- exit(1);
-}
-.DE
-.LP
-The
-.I registerrpc()
-routine registers a C procedure as corresponding to a
-given RPC procedure number. The first three parameters,
-.I RUSERPROG ,
-.I RUSERSVERS ,
-and
-.I RUSERSPROC_NUM
-are the program, version, and procedure numbers
-of the remote procedure to be registered;
-.I nuser()
-is the name of the local procedure that implements the remote
-procedure; and
-.I xdr_void()
-and
-.I xdr_u_long()
-are the XDR filters for the remote procedure's arguments and
-results, respectively. (Multiple arguments or multiple results
-are passed as structures).
-.LP
-Only the UDP transport mechanism can use
-.I registerrpc()
-thus, it is always safe in conjunction with calls generated by
-.I callrpc() .
-.SH
-.IX "UDP 8K warning"
-Warning: the UDP transport mechanism can only deal with
-arguments and results less than 8K bytes in length.
-.LP
-.LP
-After registering the local procedure, the server program's
-main procedure calls
-.I svc_run (),
-the RPC library's remote procedure dispatcher. It is this
-function that calls the remote procedures in response to RPC
-call messages. Note that the dispatcher takes care of decoding
-remote procedure arguments and encoding results, using the XDR
-filters specified when the remote procedure was registered.
-.NH 2
-\&Assigning Program Numbers
-.IX "program number assignment"
-.IX "assigning program numbers"
-.LP
-Program numbers are assigned in groups of
-.I 0x20000000
-according to the following chart:
-.DS
-.ft CW
- 0x0 - 0x1fffffff \fRDefined by Sun\fP
-0x20000000 - 0x3fffffff \fRDefined by user\fP
-0x40000000 - 0x5fffffff \fRTransient\fP
-0x60000000 - 0x7fffffff \fRReserved\fP
-0x80000000 - 0x9fffffff \fRReserved\fP
-0xa0000000 - 0xbfffffff \fRReserved\fP
-0xc0000000 - 0xdfffffff \fRReserved\fP
-0xe0000000 - 0xffffffff \fRReserved\fP
-.ft R
-.DE
-Sun Microsystems administers the first group of numbers, which
-should be identical for all Sun customers. If a customer
-develops an application that might be of general interest, that
-application should be given an assigned number in the first
-range. The second group of numbers is reserved for specific
-customer applications. This range is intended primarily for
-debugging new programs. The third group is reserved for
-applications that generate program numbers dynamically. The
-final groups are reserved for future use, and should not be
-used.
-.LP
-To register a protocol specification, send a request by network
-mail to
-.I rpc@sun
-or write to:
-.DS
-RPC Administrator
-Sun Microsystems
-2550 Garcia Ave.
-Mountain View, CA 94043
-.DE
-Please include a compilable
-.I rpcgen
-\*Q.x\*U file describing your protocol.
-You will be given a unique program number in return.
-.IX RPC administration
-.IX administration "of RPC"
-.LP
-The RPC program numbers and protocol specifications
-of standard Sun RPC services can be
-found in the include files in
-.I "/usr/include/rpcsvc" .
-These services, however, constitute only a small subset
-of those which have been registered. The complete list of
-registered programs, as of the time when this manual was
-printed, is:
-.LP
-\fBTable 3-2\fI RPC Registered Programs\fR
-.TS H
-box tab (&) ;
-lfBI lfBI lfBI
-lfL lfL lfI .
-RPC Number&Program&Description
-_
-.TH
-.sp.5
-100000&PMAPPROG&portmapper
-100001&RSTATPROG&remote stats
-100002&RUSERSPROG&remote users
-100003&NFSPROG&nfs
-100004&YPPROG&Yellow Pages
-100005&MOUNTPROG&mount demon
-100006&DBXPROG&remote dbx
-100007&YPBINDPROG&yp binder
-100008&WALLPROG&shutdown msg
-100009&YPPASSWDPROG&yppasswd server
-100010&ETHERSTATPROG&ether stats
-100011&RQUOTAPROG&disk quotas
-100012&SPRAYPROG&spray packets
-100013&IBM3270PROG&3270 mapper
-100014&IBMRJEPROG&RJE mapper
-100015&SELNSVCPROG&selection service
-100016&RDATABASEPROG&remote database access
-100017&REXECPROG&remote execution
-100018&ALICEPROG&Alice Office Automation
-100019&SCHEDPROG&scheduling service
-100020&LOCKPROG&local lock manager
-100021&NETLOCKPROG&network lock manager
-100022&X25PROG&x.25 inr protocol
-100023&STATMON1PROG&status monitor 1
-100024&STATMON2PROG&status monitor 2
-100025&SELNLIBPROG&selection library
-100026&BOOTPARAMPROG&boot parameters service
-100027&MAZEPROG&mazewars game
-100028&YPUPDATEPROG&yp update
-100029&KEYSERVEPROG&key server
-100030&SECURECMDPROG&secure login
-100031&NETFWDIPROG&nfs net forwarder init
-100032&NETFWDTPROG&nfs net forwarder trans
-100033&SUNLINKMAP_PROG&sunlink MAP
-100034&NETMONPROG&network monitor
-100035&DBASEPROG&lightweight database
-100036&PWDAUTHPROG&password authorization
-100037&TFSPROG&translucent file svc
-100038&NSEPROG&nse server
-100039&NSE_ACTIVATE_PROG&nse activate daemon
-.sp .2i
-150001&PCNFSDPROG&pc passwd authorization
-.sp .2i
-200000&PYRAMIDLOCKINGPROG&Pyramid-locking
-200001&PYRAMIDSYS5&Pyramid-sys5
-200002&CADDS_IMAGE&CV cadds_image
-.sp .2i
-300001&ADT_RFLOCKPROG&ADT file locking
-.TE
-.NH 2
-\&Passing Arbitrary Data Types
-.IX "arbitrary data types"
-.LP
-In the previous example, the RPC call passes a single
-.I "unsigned long"
-RPC can handle arbitrary data structures, regardless of
-different machines' byte orders or structure layout conventions,
-by always converting them to a network standard called
-.I "External Data Representation"
-(XDR) before
-sending them over the wire.
-The process of converting from a particular machine representation
-to XDR format is called
-.I serializing ,
-and the reverse process is called
-.I deserializing .
-The type field parameters of
-.I callrpc()
-and
-.I registerrpc()
-can be a built-in procedure like
-.I xdr_u_long()
-in the previous example, or a user supplied one.
-XDR has these built-in type routines:
-.IX RPC "built-in routines"
-.DS
-.ft CW
-xdr_int() xdr_u_int() xdr_enum()
-xdr_long() xdr_u_long() xdr_bool()
-xdr_short() xdr_u_short() xdr_wrapstring()
-xdr_char() xdr_u_char()
-.DE
-Note that the routine
-.I xdr_string()
-exists, but cannot be used with
-.I callrpc()
-and
-.I registerrpc (),
-which only pass two parameters to their XDR routines.
-.I xdr_wrapstring()
-has only two parameters, and is thus OK. It calls
-.I xdr_string ().
-.LP
-As an example of a user-defined type routine,
-if you wanted to send the structure
-.DS
-.ft CW
-struct simple {
- int a;
- short b;
-} simple;
-.DE
-then you would call
-.I callrpc()
-as
-.DS
-.ft CW
-callrpc(hostname, PROGNUM, VERSNUM, PROCNUM,
- xdr_simple, &simple ...);
-.DE
-where
-.I xdr_simple()
-is written as:
-.ie t .DS
-.el .DS L
-.ft CW
-#include <rpc/rpc.h>
-
-xdr_simple(xdrsp, simplep)
- XDR *xdrsp;
- struct simple *simplep;
-{
- if (!xdr_int(xdrsp, &simplep->a))
- return (0);
- if (!xdr_short(xdrsp, &simplep->b))
- return (0);
- return (1);
-}
-.DE
-.LP
-An XDR routine returns nonzero (true in the sense of C) if it
-completes successfully, and zero otherwise.
-A complete description of XDR is in the
-.I "XDR Protocol Specification"
-section of this manual, only few implementation examples are
-given here.
-.LP
-In addition to the built-in primitives,
-there are also the prefabricated building blocks:
-.DS
-.ft CW
-xdr_array() xdr_bytes() xdr_reference()
-xdr_vector() xdr_union() xdr_pointer()
-xdr_string() xdr_opaque()
-.DE
-To send a variable array of integers,
-you might package them up as a structure like this
-.DS
-.ft CW
-struct varintarr {
- int *data;
- int arrlnth;
-} arr;
-.DE
-and make an RPC call such as
-.DS
-.ft CW
-callrpc(hostname, PROGNUM, VERSNUM, PROCNUM,
- xdr_varintarr, &arr...);
-.DE
-with
-.I xdr_varintarr()
-defined as:
-.ie t .DS
-.el .DS L
-.ft CW
-xdr_varintarr(xdrsp, arrp)
- XDR *xdrsp;
- struct varintarr *arrp;
-{
- return (xdr_array(xdrsp, &arrp->data, &arrp->arrlnth,
- MAXLEN, sizeof(int), xdr_int));
-}
-.DE
-This routine takes as parameters the XDR handle,
-a pointer to the array, a pointer to the size of the array,
-the maximum allowable array size,
-the size of each array element,
-and an XDR routine for handling each array element.
-.KS
-.LP
-If the size of the array is known in advance, one can use
-.I xdr_vector (),
-which serializes fixed-length arrays.
-.ie t .DS
-.el .DS L
-.ft CW
-int intarr[SIZE];
-
-xdr_intarr(xdrsp, intarr)
- XDR *xdrsp;
- int intarr[];
-{
- int i;
-
- return (xdr_vector(xdrsp, intarr, SIZE, sizeof(int),
- xdr_int));
-}
-.DE
-.KE
-.LP
-XDR always converts quantities to 4-byte multiples when serializing.
-Thus, if either of the examples above involved characters
-instead of integers, each character would occupy 32 bits.
-That is the reason for the XDR routine
-.I xdr_bytes()
-which is like
-.I xdr_array()
-except that it packs characters;
-.I xdr_bytes()
-has four parameters, similar to the first four parameters of
-.I xdr_array ().
-For null-terminated strings, there is also the
-.I xdr_string()
-routine, which is the same as
-.I xdr_bytes()
-without the length parameter.
-On serializing it gets the string length from
-.I strlen (),
-and on deserializing it creates a null-terminated string.
-.LP
-Here is a final example that calls the previously written
-.I xdr_simple()
-as well as the built-in functions
-.I xdr_string()
-and
-.I xdr_reference (),
-which chases pointers:
-.ie t .DS
-.el .DS L
-.ft CW
-struct finalexample {
- char *string;
- struct simple *simplep;
-} finalexample;
-
-xdr_finalexample(xdrsp, finalp)
- XDR *xdrsp;
- struct finalexample *finalp;
-{
-
- if (!xdr_string(xdrsp, &finalp->string, MAXSTRLEN))
- return (0);
- if (!xdr_reference(xdrsp, &finalp->simplep,
- sizeof(struct simple), xdr_simple);
- return (0);
- return (1);
-}
-.DE
-Note that we could as easily call
-.I xdr_simple()
-here instead of
-.I xdr_reference ().
-.NH 1
-\&Lowest Layer of RPC
-.IX "lowest layer of RPC"
-.IX "RPC" "lowest layer"
-.LP
-In the examples given so far,
-RPC takes care of many details automatically for you.
-In this section, we'll show you how you can change the defaults
-by using lower layers of the RPC library.
-It is assumed that you are familiar with sockets
-and the system calls for dealing with them.
-.LP
-There are several occasions when you may need to use lower layers of
-RPC. First, you may need to use TCP, since the higher layer uses UDP,
-which restricts RPC calls to 8K bytes of data. Using TCP permits calls
-to send long streams of data.
-For an example, see the
-.I TCP
-section below. Second, you may want to allocate and free memory
-while serializing or deserializing with XDR routines.
-There is no call at the higher level to let
-you free memory explicitly.
-For more explanation, see the
-.I "Memory Allocation with XDR"
-section below.
-Third, you may need to perform authentication
-on either the client or server side, by supplying
-credentials or verifying them.
-See the explanation in the
-.I Authentication
-section below.
-.NH 2
-\&More on the Server Side
-.IX RPC "server side"
-.LP
-The server for the
-.I nusers()
-program shown below does the same thing as the one using
-.I registerrpc()
-above, but is written using a lower layer of the RPC package:
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <utmp.h>
-#include <rpcsvc/rusers.h>
-
-main()
-{
- SVCXPRT *transp;
- int nuser();
-
- transp = svcudp_create(RPC_ANYSOCK);
- if (transp == NULL){
- fprintf(stderr, "can't create an RPC server\en");
- exit(1);
- }
- pmap_unset(RUSERSPROG, RUSERSVERS);
- if (!svc_register(transp, RUSERSPROG, RUSERSVERS,
- nuser, IPPROTO_UDP)) {
- fprintf(stderr, "can't register RUSER service\en");
- exit(1);
- }
- svc_run(); /* \fINever returns\fP */
- fprintf(stderr, "should never reach this point\en");
-}
-
-nuser(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- unsigned long nusers;
-
- switch (rqstp->rq_proc) {
- case NULLPROC:
- if (!svc_sendreply(transp, xdr_void, 0))
- fprintf(stderr, "can't reply to RPC call\en");
- return;
- case RUSERSPROC_NUM:
-.ft I
- /*
- * Code here to compute the number of users
- * and assign it to the variable \fInusers\fP
- */
-.ft CW
- if (!svc_sendreply(transp, xdr_u_long, &nusers))
- fprintf(stderr, "can't reply to RPC call\en");
- return;
- default:
- svcerr_noproc(transp);
- return;
- }
-}
-.DE
-.LP
-First, the server gets a transport handle, which is used
-for receiving and replying to RPC messages.
-.I registerrpc()
-uses
-.I svcudp_create()
-to get a UDP handle.
-If you require a more reliable protocol, call
-.I svctcp_create()
-instead.
-If the argument to
-.I svcudp_create()
-is
-.I RPC_ANYSOCK
-the RPC library creates a socket
-on which to receive and reply to RPC calls. Otherwise,
-.I svcudp_create()
-expects its argument to be a valid socket number.
-If you specify your own socket, it can be bound or unbound.
-If it is bound to a port by the user, the port numbers of
-.I svcudp_create()
-and
-.I clnttcp_create()
-(the low-level client routine) must match.
-.LP
-If the user specifies the
-.I RPC_ANYSOCK
-argument, the RPC library routines will open sockets.
-Otherwise they will expect the user to do so. The routines
-.I svcudp_create()
-and
-.I clntudp_create()
-will cause the RPC library routines to
-.I bind()
-their socket if it is not bound already.
-.LP
-A service may choose to register its port number with the
-local portmapper service. This is done is done by specifying
-a non-zero protocol number in
-.I svc_register ().
-Incidently, a client can discover the server's port number by
-consulting the portmapper on their server's machine. This can
-be done automatically by specifying a zero port number in
-.I clntudp_create()
-or
-.I clnttcp_create ().
-.LP
-After creating an
-.I SVCXPRT ,
-the next step is to call
-.I pmap_unset()
-so that if the
-.I nusers()
-server crashed earlier,
-any previous trace of it is erased before restarting.
-More precisely,
-.I pmap_unset()
-erases the entry for
-.I RUSERSPROG
-from the port mapper's tables.
-.LP
-Finally, we associate the program number for
-.I nusers()
-with the procedure
-.I nuser ().
-The final argument to
-.I svc_register()
-is normally the protocol being used,
-which, in this case, is
-.I IPPROTO_UDP
-Notice that unlike
-.I registerrpc (),
-there are no XDR routines involved
-in the registration process.
-Also, registration is done on the program,
-rather than procedure, level.
-.LP
-The user routine
-.I nuser()
-must call and dispatch the appropriate XDR routines
-based on the procedure number.
-Note that
-two things are handled by
-.I nuser()
-that
-.I registerrpc()
-handles automatically.
-The first is that procedure
-.I NULLPROC
-(currently zero) returns with no results.
-This can be used as a simple test
-for detecting if a remote program is running.
-Second, there is a check for invalid procedure numbers.
-If one is detected,
-.I svcerr_noproc()
-is called to handle the error.
-.KS
-.LP
-The user service routine serializes the results and returns
-them to the RPC caller via
-.I svc_sendreply()
-Its first parameter is the
-.I SVCXPRT
-handle, the second is the XDR routine,
-and the third is a pointer to the data to be returned.
-Not illustrated above is how a server
-handles an RPC program that receives data.
-As an example, we can add a procedure
-.I RUSERSPROC_BOOL
-which has an argument
-.I nusers (),
-and returns
-.I TRUE
-or
-.I FALSE
-depending on whether there are nusers logged on.
-It would look like this:
-.ie t .DS
-.el .DS L
-.ft CW
-case RUSERSPROC_BOOL: {
- int bool;
- unsigned nuserquery;
-
- if (!svc_getargs(transp, xdr_u_int, &nuserquery) {
- svcerr_decode(transp);
- return;
- }
-.ft I
- /*
- * Code to set \fInusers\fP = number of users
- */
-.ft CW
- if (nuserquery == nusers)
- bool = TRUE;
- else
- bool = FALSE;
- if (!svc_sendreply(transp, xdr_bool, &bool)) {
- fprintf(stderr, "can't reply to RPC call\en");
- return (1);
- }
- return;
-}
-.DE
-.KE
-.LP
-The relevant routine is
-.I svc_getargs()
-which takes an
-.I SVCXPRT
-handle, the XDR routine,
-and a pointer to where the input is to be placed as arguments.
-.NH 2
-\&Memory Allocation with XDR
-.IX "memory allocation with XDR"
-.IX XDR "memory allocation"
-.LP
-XDR routines not only do input and output,
-they also do memory allocation.
-This is why the second parameter of
-.I xdr_array()
-is a pointer to an array, rather than the array itself.
-If it is
-.I NULL ,
-then
-.I xdr_array()
-allocates space for the array and returns a pointer to it,
-putting the size of the array in the third argument.
-As an example, consider the following XDR routine
-.I xdr_chararr1()
-which deals with a fixed array of bytes with length
-.I SIZE .
-.ie t .DS
-.el .DS L
-.ft CW
-xdr_chararr1(xdrsp, chararr)
- XDR *xdrsp;
- char chararr[];
-{
- char *p;
- int len;
-
- p = chararr;
- len = SIZE;
- return (xdr_bytes(xdrsp, &p, &len, SIZE));
-}
-.DE
-If space has already been allocated in
-.I chararr ,
-it can be called from a server like this:
-.ie t .DS
-.el .DS L
-.ft CW
-char chararr[SIZE];
-
-svc_getargs(transp, xdr_chararr1, chararr);
-.DE
-If you want XDR to do the allocation,
-you would have to rewrite this routine in the following way:
-.ie t .DS
-.el .DS L
-.ft CW
-xdr_chararr2(xdrsp, chararrp)
- XDR *xdrsp;
- char **chararrp;
-{
- int len;
-
- len = SIZE;
- return (xdr_bytes(xdrsp, charrarrp, &len, SIZE));
-}
-.DE
-Then the RPC call might look like this:
-.ie t .DS
-.el .DS L
-.ft CW
-char *arrptr;
-
-arrptr = NULL;
-svc_getargs(transp, xdr_chararr2, &arrptr);
-.ft I
-/*
- * Use the result here
- */
-.ft CW
-svc_freeargs(transp, xdr_chararr2, &arrptr);
-.DE
-Note that, after being used, the character array can be freed with
-.I svc_freeargs()
-.I svc_freeargs()
-will not attempt to free any memory if the variable indicating it
-is NULL. For example, in the the routine
-.I xdr_finalexample (),
-given earlier, if
-.I finalp->string
-was NULL, then it would not be freed. The same is true for
-.I finalp->simplep .
-.LP
-To summarize, each XDR routine is responsible
-for serializing, deserializing, and freeing memory.
-When an XDR routine is called from
-.I callrpc()
-the serializing part is used.
-When called from
-.I svc_getargs()
-the deserializer is used.
-And when called from
-.I svc_freeargs()
-the memory deallocator is used. When building simple examples like those
-in this section, a user doesn't have to worry
-about the three modes.
-See the
-.I "External Data Representation: Sun Technical Notes"
-for examples of more sophisticated XDR routines that determine
-which of the three modes they are in and adjust their behavior accordingly.
-.KS
-.NH 2
-\&The Calling Side
-.IX RPC "calling side"
-.LP
-When you use
-.I callrpc()
-you have no control over the RPC delivery
-mechanism or the socket used to transport the data.
-To illustrate the layer of RPC that lets you adjust these
-parameters, consider the following code to call the
-.I nusers
-service:
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <utmp.h>
-#include <rpcsvc/rusers.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <netdb.h>
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct hostent *hp;
- struct timeval pertry_timeout, total_timeout;
- struct sockaddr_in server_addr;
- int sock = RPC_ANYSOCK;
- register CLIENT *client;
- enum clnt_stat clnt_stat;
- unsigned long nusers;
-
- if (argc != 2) {
- fprintf(stderr, "usage: nusers hostname\en");
- exit(-1);
- }
- if ((hp = gethostbyname(argv[1])) == NULL) {
- fprintf(stderr, "can't get addr for %s\en",argv[1]);
- exit(-1);
- }
- pertry_timeout.tv_sec = 3;
- pertry_timeout.tv_usec = 0;
- bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr,
- hp->h_length);
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = 0;
- if ((client = clntudp_create(&server_addr, RUSERSPROG,
- RUSERSVERS, pertry_timeout, &sock)) == NULL) {
- clnt_pcreateerror("clntudp_create");
- exit(-1);
- }
- total_timeout.tv_sec = 20;
- total_timeout.tv_usec = 0;
- clnt_stat = clnt_call(client, RUSERSPROC_NUM, xdr_void,
- 0, xdr_u_long, &nusers, total_timeout);
- if (clnt_stat != RPC_SUCCESS) {
- clnt_perror(client, "rpc");
- exit(-1);
- }
- clnt_destroy(client);
- close(sock);
- exit(0);
-}
-.vs
-.DE
-.KE
-The low-level version of
-.I callrpc()
-is
-.I clnt_call()
-which takes a
-.I CLIENT
-pointer rather than a host name. The parameters to
-.I clnt_call()
-are a
-.I CLIENT
-pointer, the procedure number,
-the XDR routine for serializing the argument,
-a pointer to the argument,
-the XDR routine for deserializing the return value,
-a pointer to where the return value will be placed,
-and the time in seconds to wait for a reply.
-.LP
-The
-.I CLIENT
-pointer is encoded with the transport mechanism.
-.I callrpc()
-uses UDP, thus it calls
-.I clntudp_create()
-to get a
-.I CLIENT
-pointer. To get TCP (Transmission Control Protocol), you would use
-.I clnttcp_create() .
-.LP
-The parameters to
-.I clntudp_create()
-are the server address, the program number, the version number,
-a timeout value (between tries), and a pointer to a socket.
-The final argument to
-.I clnt_call()
-is the total time to wait for a response.
-Thus, the number of tries is the
-.I clnt_call()
-timeout divided by the
-.I clntudp_create()
-timeout.
-.LP
-Note that the
-.I clnt_destroy()
-call
-always deallocates the space associated with the
-.I CLIENT
-handle. It closes the socket associated with the
-.I CLIENT
-handle, however, only if the RPC library opened it. It the
-socket was opened by the user, it stays open. This makes it
-possible, in cases where there are multiple client handles
-using the same socket, to destroy one handle without closing
-the socket that other handles are using.
-.LP
-To make a stream connection, the call to
-.I clntudp_create()
-is replaced with a call to
-.I clnttcp_create() .
-.DS
-.ft CW
-clnttcp_create(&server_addr, prognum, versnum, &sock,
- inputsize, outputsize);
-.DE
-There is no timeout argument; instead, the receive and send buffer
-sizes must be specified. When the
-.I clnttcp_create()
-call is made, a TCP connection is established.
-All RPC calls using that
-.I CLIENT
-handle would use this connection.
-The server side of an RPC call using TCP has
-.I svcudp_create()
-replaced by
-.I svctcp_create() .
-.DS
-.ft CW
-transp = svctcp_create(RPC_ANYSOCK, 0, 0);
-.DE
-The last two arguments to
-.I svctcp_create()
-are send and receive sizes respectively. If `0' is specified for
-either of these, the system chooses a reasonable default.
-.KS
-.NH 1
-\&Other RPC Features
-.IX "RPC" "miscellaneous features"
-.IX "miscellaneous RPC features"
-.LP
-This section discusses some other aspects of RPC
-that are occasionally useful.
-.NH 2
-\&Select on the Server Side
-.IX RPC select() RPC \fIselect()\fP
-.IX select() "" \fIselect()\fP "on the server side"
-.LP
-Suppose a process is processing RPC requests
-while performing some other activity.
-If the other activity involves periodically updating a data structure,
-the process can set an alarm signal before calling
-.I svc_run()
-But if the other activity
-involves waiting on a a file descriptor, the
-.I svc_run()
-call won't work.
-The code for
-.I svc_run()
-is as follows:
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-void
-svc_run()
-{
- fd_set readfds;
- int dtbsz = getdtablesize();
-
- for (;;) {
- readfds = svc_fds;
- switch (select(dtbsz, &readfds, NULL,NULL,NULL)) {
-
- case -1:
- if (errno == EINTR)
- continue;
- perror("select");
- return;
- case 0:
- break;
- default:
- svc_getreqset(&readfds);
- }
- }
-}
-.vs
-.DE
-.KE
-.LP
-You can bypass
-.I svc_run()
-and call
-.I svc_getreqset()
-yourself.
-All you need to know are the file descriptors
-of the socket(s) associated with the programs you are waiting on.
-Thus you can have your own
-.I select()
-.IX select() "" \fIselect()\fP
-that waits on both the RPC socket,
-and your own descriptors. Note that
-.I svc_fds()
-is a bit mask of all the file descriptors that RPC is using for
-services. It can change everytime that
-.I any
-RPC library routine is called, because descriptors are constantly
-being opened and closed, for example for TCP connections.
-.NH 2
-\&Broadcast RPC
-.IX "broadcast RPC"
-.IX RPC "broadcast"
-.LP
-The
-.I portmapper
-is a daemon that converts RPC program numbers
-into DARPA protocol port numbers; see the
-.I portmap
-man page. You can't do broadcast RPC without the portmapper.
-Here are the main differences between
-broadcast RPC and normal RPC calls:
-.IP 1.
-Normal RPC expects one answer, whereas
-broadcast RPC expects many answers
-(one or more answer from each responding machine).
-.IP 2.
-Broadcast RPC can only be supported by packet-oriented (connectionless)
-transport protocols like UPD/IP.
-.IP 3.
-The implementation of broadcast RPC
-treats all unsuccessful responses as garbage by filtering them out.
-Thus, if there is a version mismatch between the
-broadcaster and a remote service,
-the user of broadcast RPC never knows.
-.IP 4.
-All broadcast messages are sent to the portmap port.
-Thus, only services that register themselves with their portmapper
-are accessible via the broadcast RPC mechanism.
-.IP 5.
-Broadcast requests are limited in size to the MTU (Maximum Transfer
-Unit) of the local network. For Ethernet, the MTU is 1500 bytes.
-.KS
-.NH 3
-\&Broadcast RPC Synopsis
-.IX "broadcast RPC" synopsis
-.IX "RPC" "broadcast synopsis"
-.ie t .DS
-.el .DS L
-.ft CW
-#include <rpc/pmap_clnt.h>
- . . .
-enum clnt_stat clnt_stat;
- . . .
-clnt_stat = clnt_broadcast(prognum, versnum, procnum,
- inproc, in, outproc, out, eachresult)
- u_long prognum; /* \fIprogram number\fP */
- u_long versnum; /* \fIversion number\fP */
- u_long procnum; /* \fIprocedure number\fP */
- xdrproc_t inproc; /* \fIxdr routine for args\fP */
- caddr_t in; /* \fIpointer to args\fP */
- xdrproc_t outproc; /* \fIxdr routine for results\fP */
- caddr_t out; /* \fIpointer to results\fP */
- bool_t (*eachresult)();/* \fIcall with each result gotten\fP */
-.DE
-.KE
-The procedure
-.I eachresult()
-is called each time a valid result is obtained.
-It returns a boolean that indicates
-whether or not the user wants more responses.
-.ie t .DS
-.el .DS L
-.ft CW
-bool_t done;
- . . .
-done = eachresult(resultsp, raddr)
- caddr_t resultsp;
- struct sockaddr_in *raddr; /* \fIAddr of responding machine\fP */
-.DE
-If
-.I done
-is
-.I TRUE ,
-then broadcasting stops and
-.I clnt_broadcast()
-returns successfully.
-Otherwise, the routine waits for another response.
-The request is rebroadcast
-after a few seconds of waiting.
-If no responses come back,
-the routine returns with
-.I RPC_TIMEDOUT .
-.NH 2
-\&Batching
-.IX "batching"
-.IX RPC "batching"
-.LP
-The RPC architecture is designed so that clients send a call message,
-and wait for servers to reply that the call succeeded.
-This implies that clients do not compute
-while servers are processing a call.
-This is inefficient if the client does not want or need
-an acknowledgement for every message sent.
-It is possible for clients to continue computing
-while waiting for a response,
-using RPC batch facilities.
-.LP
-RPC messages can be placed in a \*Qpipeline\*U of calls
-to a desired server; this is called batching.
-Batching assumes that:
-1) each RPC call in the pipeline requires no response from the server,
-and the server does not send a response message; and
-2) the pipeline of calls is transported on a reliable
-byte stream transport such as TCP/IP.
-Since the server does not respond to every call,
-the client can generate new calls in parallel
-with the server executing previous calls.
-Furthermore, the TCP/IP implementation can buffer up
-many call messages, and send them to the server in one
-.I write()
-system call. This overlapped execution
-greatly decreases the interprocess communication overhead of
-the client and server processes,
-and the total elapsed time of a series of calls.
-.LP
-Since the batched calls are buffered,
-the client should eventually do a nonbatched call
-in order to flush the pipeline.
-.LP
-A contrived example of batching follows.
-Assume a string rendering service (like a window system)
-has two similar calls: one renders a string and returns void results,
-while the other renders a string and remains silent.
-The service (using the TCP/IP transport) may look like:
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <suntool/windows.h>
-
-void windowdispatch();
-
-main()
-{
- SVCXPRT *transp;
-
- transp = svctcp_create(RPC_ANYSOCK, 0, 0);
- if (transp == NULL){
- fprintf(stderr, "can't create an RPC server\en");
- exit(1);
- }
- pmap_unset(WINDOWPROG, WINDOWVERS);
- if (!svc_register(transp, WINDOWPROG, WINDOWVERS,
- windowdispatch, IPPROTO_TCP)) {
- fprintf(stderr, "can't register WINDOW service\en");
- exit(1);
- }
- svc_run(); /* \fINever returns\fP */
- fprintf(stderr, "should never reach this point\en");
-}
-
-void
-windowdispatch(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- char *s = NULL;
-
- switch (rqstp->rq_proc) {
- case NULLPROC:
- if (!svc_sendreply(transp, xdr_void, 0))
- fprintf(stderr, "can't reply to RPC call\en");
- return;
- case RENDERSTRING:
- if (!svc_getargs(transp, xdr_wrapstring, &s)) {
- fprintf(stderr, "can't decode arguments\en");
-.ft I
- /*
- * Tell caller he screwed up
- */
-.ft CW
- svcerr_decode(transp);
- break;
- }
-.ft I
- /*
- * Code here to render the string \fIs\fP
- */
-.ft CW
- if (!svc_sendreply(transp, xdr_void, NULL))
- fprintf(stderr, "can't reply to RPC call\en");
- break;
- case RENDERSTRING_BATCHED:
- if (!svc_getargs(transp, xdr_wrapstring, &s)) {
- fprintf(stderr, "can't decode arguments\en");
-.ft I
- /*
- * We are silent in the face of protocol errors
- */
-.ft CW
- break;
- }
-.ft I
- /*
- * Code here to render string s, but send no reply!
- */
-.ft CW
- break;
- default:
- svcerr_noproc(transp);
- return;
- }
-.ft I
- /*
- * Now free string allocated while decoding arguments
- */
-.ft CW
- svc_freeargs(transp, xdr_wrapstring, &s);
-}
-.DE
-Of course the service could have one procedure
-that takes the string and a boolean
-to indicate whether or not the procedure should respond.
-.LP
-In order for a client to take advantage of batching,
-the client must perform RPC calls on a TCP-based transport
-and the actual calls must have the following attributes:
-1) the result's XDR routine must be zero
-.I NULL ),
-and 2) the RPC call's timeout must be zero.
-.KS
-.LP
-Here is an example of a client that uses batching to render a
-bunch of strings; the batching is flushed when the client gets
-a null string (EOF):
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <netdb.h>
-#include <suntool/windows.h>
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct hostent *hp;
- struct timeval pertry_timeout, total_timeout;
- struct sockaddr_in server_addr;
- int sock = RPC_ANYSOCK;
- register CLIENT *client;
- enum clnt_stat clnt_stat;
- char buf[1000], *s = buf;
-
- if ((client = clnttcp_create(&server_addr,
- WINDOWPROG, WINDOWVERS, &sock, 0, 0)) == NULL) {
- perror("clnttcp_create");
- exit(-1);
- }
- total_timeout.tv_sec = 0;
- total_timeout.tv_usec = 0;
- while (scanf("%s", s) != EOF) {
- clnt_stat = clnt_call(client, RENDERSTRING_BATCHED,
- xdr_wrapstring, &s, NULL, NULL, total_timeout);
- if (clnt_stat != RPC_SUCCESS) {
- clnt_perror(client, "batched rpc");
- exit(-1);
- }
- }
-
- /* \fINow flush the pipeline\fP */
-
- total_timeout.tv_sec = 20;
- clnt_stat = clnt_call(client, NULLPROC, xdr_void, NULL,
- xdr_void, NULL, total_timeout);
- if (clnt_stat != RPC_SUCCESS) {
- clnt_perror(client, "rpc");
- exit(-1);
- }
- clnt_destroy(client);
- exit(0);
-}
-.vs
-.DE
-.KE
-Since the server sends no message,
-the clients cannot be notified of any of the failures that may occur.
-Therefore, clients are on their own when it comes to handling errors.
-.LP
-The above example was completed to render
-all of the (2000) lines in the file
-.I /etc/termcap .
-The rendering service did nothing but throw the lines away.
-The example was run in the following four configurations:
-1) machine to itself, regular RPC;
-2) machine to itself, batched RPC;
-3) machine to another, regular RPC; and
-4) machine to another, batched RPC.
-The results are as follows:
-1) 50 seconds;
-2) 16 seconds;
-3) 52 seconds;
-4) 10 seconds.
-Running
-.I fscanf()
-on
-.I /etc/termcap
-only requires six seconds.
-These timings show the advantage of protocols
-that allow for overlapped execution,
-though these protocols are often hard to design.
-.NH 2
-\&Authentication
-.IX "authentication"
-.IX "RPC" "authentication"
-.LP
-In the examples presented so far,
-the caller never identified itself to the server,
-and the server never required an ID from the caller.
-Clearly, some network services, such as a network filesystem,
-require stronger security than what has been presented so far.
-.LP
-In reality, every RPC call is authenticated by
-the RPC package on the server, and similarly,
-the RPC client package generates and sends authentication parameters.
-Just as different transports (TCP/IP or UDP/IP)
-can be used when creating RPC clients and servers,
-different forms of authentication can be associated with RPC clients;
-the default authentication type used as a default is type
-.I none .
-.LP
-The authentication subsystem of the RPC package is open ended.
-That is, numerous types of authentication are easy to support.
-.NH 3
-\&UNIX Authentication
-.IX "UNIX Authentication"
-.IP "\fIThe Client Side\fP"
-.LP
-When a caller creates a new RPC client handle as in:
-.DS
-.ft CW
-clnt = clntudp_create(address, prognum, versnum,
- wait, sockp)
-.DE
-the appropriate transport instance defaults
-the associate authentication handle to be
-.DS
-.ft CW
-clnt->cl_auth = authnone_create();
-.DE
-The RPC client can choose to use
-.I UNIX
-style authentication by setting
-.I clnt\->cl_auth
-after creating the RPC client handle:
-.DS
-.ft CW
-clnt->cl_auth = authunix_create_default();
-.DE
-This causes each RPC call associated with
-.I clnt
-to carry with it the following authentication credentials structure:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * UNIX style credentials.
- */
-.ft CW
-struct authunix_parms {
- u_long aup_time; /* \fIcredentials creation time\fP */
- char *aup_machname; /* \fIhost name where client is\fP */
- int aup_uid; /* \fIclient's UNIX effective uid\fP */
- int aup_gid; /* \fIclient's current group id\fP */
- u_int aup_len; /* \fIelement length of aup_gids\fP */
- int *aup_gids; /* \fIarray of groups user is in\fP */
-};
-.DE
-These fields are set by
-.I authunix_create_default()
-by invoking the appropriate system calls.
-Since the RPC user created this new style of authentication,
-the user is responsible for destroying it with:
-.DS
-.ft CW
-auth_destroy(clnt->cl_auth);
-.DE
-This should be done in all cases, to conserve memory.
-.sp
-.IP "\fIThe Server Side\fP"
-.LP
-Service implementors have a harder time dealing with authentication issues
-since the RPC package passes the service dispatch routine a request
-that has an arbitrary authentication style associated with it.
-Consider the fields of a request handle passed to a service dispatch routine:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * An RPC Service request
- */
-.ft CW
-struct svc_req {
- u_long rq_prog; /* \fIservice program number\fP */
- u_long rq_vers; /* \fIservice protocol vers num\fP */
- u_long rq_proc; /* \fIdesired procedure number\fP */
- struct opaque_auth rq_cred; /* \fIraw credentials from wire\fP */
- caddr_t rq_clntcred; /* \fIcredentials (read only)\fP */
-};
-.DE
-The
-.I rq_cred
-is mostly opaque, except for one field of interest:
-the style or flavor of authentication credentials:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * Authentication info. Mostly opaque to the programmer.
- */
-.ft CW
-struct opaque_auth {
- enum_t oa_flavor; /* \fIstyle of credentials\fP */
- caddr_t oa_base; /* \fIaddress of more auth stuff\fP */
- u_int oa_length; /* \fInot to exceed \fIMAX_AUTH_BYTES */
-};
-.DE
-.IX RPC guarantees
-The RPC package guarantees the following
-to the service dispatch routine:
-.IP 1.
-That the request's
-.I rq_cred
-is well formed. Thus the service implementor may inspect the request's
-.I rq_cred.oa_flavor
-to determine which style of authentication the caller used.
-The service implementor may also wish to inspect the other fields of
-.I rq_cred
-if the style is not one of the styles supported by the RPC package.
-.IP 2.
-That the request's
-.I rq_clntcred
-field is either
-.I NULL
-or points to a well formed structure
-that corresponds to a supported style of authentication credentials.
-Remember that only
-.I unix
-style is currently supported, so (currently)
-.I rq_clntcred
-could be cast to a pointer to an
-.I authunix_parms
-structure. If
-.I rq_clntcred
-is
-.I NULL ,
-the service implementor may wish to inspect the other (opaque) fields of
-.I rq_cred
-in case the service knows about a new type of authentication
-that the RPC package does not know about.
-.LP
-Our remote users service example can be extended so that
-it computes results for all users except UID 16:
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-nuser(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- struct authunix_parms *unix_cred;
- int uid;
- unsigned long nusers;
-
-.ft I
- /*
- * we don't care about authentication for null proc
- */
-.ft CW
- if (rqstp->rq_proc == NULLPROC) {
- if (!svc_sendreply(transp, xdr_void, 0)) {
- fprintf(stderr, "can't reply to RPC call\en");
- return (1);
- }
- return;
- }
-.ft I
- /*
- * now get the uid
- */
-.ft CW
- switch (rqstp->rq_cred.oa_flavor) {
- case AUTH_UNIX:
- unix_cred =
- (struct authunix_parms *)rqstp->rq_clntcred;
- uid = unix_cred->aup_uid;
- break;
- case AUTH_NULL:
- default:
- svcerr_weakauth(transp);
- return;
- }
- switch (rqstp->rq_proc) {
- case RUSERSPROC_NUM:
-.ft I
- /*
- * make sure caller is allowed to call this proc
- */
-.ft CW
- if (uid == 16) {
- svcerr_systemerr(transp);
- return;
- }
-.ft I
- /*
- * Code here to compute the number of users
- * and assign it to the variable \fInusers\fP
- */
-.ft CW
- if (!svc_sendreply(transp, xdr_u_long, &nusers)) {
- fprintf(stderr, "can't reply to RPC call\en");
- return (1);
- }
- return;
- default:
- svcerr_noproc(transp);
- return;
- }
-}
-.vs
-.DE
-A few things should be noted here.
-First, it is customary not to check
-the authentication parameters associated with the
-.I NULLPROC
-(procedure number zero).
-Second, if the authentication parameter's type is not suitable
-for your service, you should call
-.I svcerr_weakauth() .
-And finally, the service protocol itself should return status
-for access denied; in the case of our example, the protocol
-does not have such a status, so we call the service primitive
-.I svcerr_systemerr()
-instead.
-.LP
-The last point underscores the relation between
-the RPC authentication package and the services;
-RPC deals only with
-.I authentication
-and not with individual services'
-.I "access control" .
-The services themselves must implement their own access control policies
-and reflect these policies as return statuses in their protocols.
-.NH 2
-\&DES Authentication
-.IX RPC DES
-.IX RPC authentication
-.LP
-UNIX authentication is quite easy to defeat. Instead of using
-.I authunix_create_default (),
-one can call
-.I authunix_create()
-and then modify the RPC authentication handle it returns by filling in
-whatever user ID and hostname they wish the server to think they have.
-DES authentication is thus recommended for people who want more security
-than UNIX authentication offers.
-.LP
-The details of the DES authentication protocol are complicated and
-are not explained here.
-See
-.I "Remote Procedure Calls: Protocol Specification"
-for the details.
-.LP
-In order for DES authentication to work, the
-.I keyserv(8c)
-daemon must be running on both the server and client machines. The
-users on these machines need public keys assigned by the network
-administrator in the
-.I publickey(5)
-database. And, they need to have decrypted their secret keys
-using their login password. This automatically happens when one
-logs in using
-.I login(1) ,
-or can be done manually using
-.I keylogin(1) .
-The
-.I "Network Services"
-chapter
-./" XXX
-explains more how to setup secure networking.
-.sp
-.IP "\fIClient Side\fP"
-.LP
-If a client wishes to use DES authentication, it must set its
-authentication handle appropriately. Here is an example:
-.DS
-cl->cl_auth =
- authdes_create(servername, 60, &server_addr, NULL);
-.DE
-The first argument is the network name or \*Qnetname\*U of the owner of
-the server process. Typically, server processes are root processes
-and their netname can be derived using the following call:
-.DS
-char servername[MAXNETNAMELEN];
-
-host2netname(servername, rhostname, NULL);
-.DE
-Here,
-.I rhostname
-is the hostname of the machine the server process is running on.
-.I host2netname()
-fills in
-.I servername
-to contain this root process's netname. If the
-server process was run by a regular user, one could use the call
-.I user2netname()
-instead. Here is an example for a server process with the same user
-ID as the client:
-.DS
-char servername[MAXNETNAMELEN];
-
-user2netname(servername, getuid(), NULL);
-.DE
-The last argument to both of these calls,
-.I user2netname()
-and
-.I host2netname (),
-is the name of the naming domain where the server is located. The
-.I NULL
-used here means \*Quse the local domain name.\*U
-.LP
-The second argument to
-.I authdes_create()
-is a lifetime for the credential. Here it is set to sixty
-seconds. What that means is that the credential will expire 60
-seconds from now. If some mischievous user tries to reuse the
-credential, the server RPC subsystem will recognize that it has
-expired and not grant any requests. If the same mischievous user
-tries to reuse the credential within the sixty second lifetime,
-he will still be rejected because the server RPC subsystem
-remembers which credentials it has already seen in the near past,
-and will not grant requests to duplicates.
-.LP
-The third argument to
-.I authdes_create()
-is the address of the host to synchronize with. In order for DES
-authentication to work, the server and client must agree upon the
-time. Here we pass the address of the server itself, so the
-client and server will both be using the same time: the server's
-time. The argument can be
-.I NULL ,
-which means \*Qdon't bother synchronizing.\*U You should only do this
-if you are sure the client and server are already synchronized.
-.LP
-The final argument to
-.I authdes_create()
-is the address of a DES encryption key to use for encrypting
-timestamps and data. If this argument is
-.I NULL ,
-as it is in this example, a random key will be chosen. The client
-may find out the encryption key being used by consulting the
-.I ah_key
-field of the authentication handle.
-.sp
-.IP "\fIServer Side\fP"
-.LP
-The server side is a lot simpler than the client side. Here is the
-previous example rewritten to use
-.I AUTH_DES
-instead of
-.I AUTH_UNIX :
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-#include <sys/time.h>
-#include <rpc/auth_des.h>
- . . .
- . . .
-nuser(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- struct authdes_cred *des_cred;
- int uid;
- int gid;
- int gidlen;
- int gidlist[10];
-.ft I
- /*
- * we don't care about authentication for null proc
- */
-.ft CW
-
- if (rqstp->rq_proc == NULLPROC) {
- /* \fIsame as before\fP */
- }
-
-.ft I
- /*
- * now get the uid
- */
-.ft CW
- switch (rqstp->rq_cred.oa_flavor) {
- case AUTH_DES:
- des_cred =
- (struct authdes_cred *) rqstp->rq_clntcred;
- if (! netname2user(des_cred->adc_fullname.name,
- &uid, &gid, &gidlen, gidlist))
- {
- fprintf(stderr, "unknown user: %s\n",
- des_cred->adc_fullname.name);
- svcerr_systemerr(transp);
- return;
- }
- break;
- case AUTH_NULL:
- default:
- svcerr_weakauth(transp);
- return;
- }
-
-.ft I
- /*
- * The rest is the same as before
- */
-.ft CW
-.vs
-.DE
-Note the use of the routine
-.I netname2user (),
-the inverse of
-.I user2netname ():
-it takes a network ID and converts to a unix ID.
-.I netname2user ()
-also supplies the group IDs which we don't use in this example,
-but which may be useful to other UNIX programs.
-.NH 2
-\&Using Inetd
-.IX inetd "" "using \fIinetd\fP"
-.LP
-An RPC server can be started from
-.I inetd
-The only difference from the usual code is that the service
-creation routine should be called in the following form:
-.ie t .DS
-.el .DS L
-.ft CW
-transp = svcudp_create(0); /* \fIFor UDP\fP */
-transp = svctcp_create(0,0,0); /* \fIFor listener TCP sockets\fP */
-transp = svcfd_create(0,0,0); /* \fIFor connected TCP sockets\fP */
-.DE
-since
-.I inet
-passes a socket as file descriptor 0.
-Also,
-.I svc_register()
-should be called as
-.ie t .DS
-.el .DS L
-.ft CW
-svc_register(transp, PROGNUM, VERSNUM, service, 0);
-.DE
-with the final flag as 0,
-since the program would already be registered by
-.I inetd
-Remember that if you want to exit
-from the server process and return control to
-.I inet
-you need to explicitly exit, since
-.I svc_run()
-never returns.
-.LP
-The format of entries in
-.I /etc/inetd.conf
-for RPC services is in one of the following two forms:
-.ie t .DS
-.el .DS L
-.ft CW
-p_name/version dgram rpc/udp wait/nowait user server args
-p_name/version stream rpc/tcp wait/nowait user server args
-.DE
-where
-.I p_name
-is the symbolic name of the program as it appears in
-.I rpc(5) ,
-.I server
-is the program implementing the server,
-and
-.I program
-and
-.I version
-are the program and version numbers of the service.
-For more information, see
-.I inetd.conf(5) .
-.LP
-If the same program handles multiple versions,
-then the version number can be a range,
-as in this example:
-.ie t .DS
-.el .DS L
-.ft CW
-rstatd/1-2 dgram rpc/udp wait root /usr/etc/rpc.rstatd
-.DE
-.NH 1
-\&More Examples
-.sp 1
-.NH 2
-\&Versions
-.IX "versions"
-.IX "RPC" "versions"
-.LP
-By convention, the first version number of program
-.I PROG
-is
-.I PROGVERS_ORIG
-and the most recent version is
-.I PROGVERS
-Suppose there is a new version of the
-.I user
-program that returns an
-.I "unsigned short"
-rather than a
-.I long .
-If we name this version
-.I RUSERSVERS_SHORT
-then a server that wants to support both versions
-would do a double register.
-.ie t .DS
-.el .DS L
-.ft CW
-if (!svc_register(transp, RUSERSPROG, RUSERSVERS_ORIG,
- nuser, IPPROTO_TCP)) {
- fprintf(stderr, "can't register RUSER service\en");
- exit(1);
-}
-if (!svc_register(transp, RUSERSPROG, RUSERSVERS_SHORT,
- nuser, IPPROTO_TCP)) {
- fprintf(stderr, "can't register RUSER service\en");
- exit(1);
-}
-.DE
-Both versions can be handled by the same C procedure:
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-nuser(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- unsigned long nusers;
- unsigned short nusers2;
-
- switch (rqstp->rq_proc) {
- case NULLPROC:
- if (!svc_sendreply(transp, xdr_void, 0)) {
- fprintf(stderr, "can't reply to RPC call\en");
- return (1);
- }
- return;
- case RUSERSPROC_NUM:
-.ft I
- /*
- * Code here to compute the number of users
- * and assign it to the variable \fInusers\fP
- */
-.ft CW
- nusers2 = nusers;
- switch (rqstp->rq_vers) {
- case RUSERSVERS_ORIG:
- if (!svc_sendreply(transp, xdr_u_long,
- &nusers)) {
- fprintf(stderr,"can't reply to RPC call\en");
- }
- break;
- case RUSERSVERS_SHORT:
- if (!svc_sendreply(transp, xdr_u_short,
- &nusers2)) {
- fprintf(stderr,"can't reply to RPC call\en");
- }
- break;
- }
- default:
- svcerr_noproc(transp);
- return;
- }
-}
-.vs
-.DE
-.KS
-.NH 2
-\&TCP
-.IX "TCP"
-.LP
-Here is an example that is essentially
-.I rcp.
-The initiator of the RPC
-.I snd
-call takes its standard input and sends it to the server
-.I rcv
-which prints it on standard output.
-The RPC call uses TCP.
-This also illustrates an XDR procedure that behaves differently
-on serialization than on deserialization.
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * The xdr routine:
- * on decode, read from wire, write onto fp
- * on encode, read from fp, write onto wire
- */
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-
-xdr_rcp(xdrs, fp)
- XDR *xdrs;
- FILE *fp;
-{
- unsigned long size;
- char buf[BUFSIZ], *p;
-
- if (xdrs->x_op == XDR_FREE)/* nothing to free */
- return 1;
- while (1) {
- if (xdrs->x_op == XDR_ENCODE) {
- if ((size = fread(buf, sizeof(char), BUFSIZ,
- fp)) == 0 && ferror(fp)) {
- fprintf(stderr, "can't fread\en");
- return (1);
- }
- }
- p = buf;
- if (!xdr_bytes(xdrs, &p, &size, BUFSIZ))
- return 0;
- if (size == 0)
- return 1;
- if (xdrs->x_op == XDR_DECODE) {
- if (fwrite(buf, sizeof(char), size,
- fp) != size) {
- fprintf(stderr, "can't fwrite\en");
- return (1);
- }
- }
- }
-}
-.vs
-.DE
-.KE
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * The sender routines
- */
-.ft CW
-#include <stdio.h>
-#include <netdb.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- int xdr_rcp();
- int err;
-
- if (argc < 2) {
- fprintf(stderr, "usage: %s servername\en", argv[0]);
- exit(-1);
- }
- if ((err = callrpctcp(argv[1], RCPPROG, RCPPROC,
- RCPVERS, xdr_rcp, stdin, xdr_void, 0) != 0)) {
- clnt_perrno(err);
- fprintf(stderr, "can't make RPC call\en");
- exit(1);
- }
- exit(0);
-}
-
-callrpctcp(host, prognum, procnum, versnum,
- inproc, in, outproc, out)
- char *host, *in, *out;
- xdrproc_t inproc, outproc;
-{
- struct sockaddr_in server_addr;
- int socket = RPC_ANYSOCK;
- enum clnt_stat clnt_stat;
- struct hostent *hp;
- register CLIENT *client;
- struct timeval total_timeout;
-
- if ((hp = gethostbyname(host)) == NULL) {
- fprintf(stderr, "can't get addr for '%s'\en", host);
- return (-1);
- }
- bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr,
- hp->h_length);
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = 0;
- if ((client = clnttcp_create(&server_addr, prognum,
- versnum, &socket, BUFSIZ, BUFSIZ)) == NULL) {
- perror("rpctcp_create");
- return (-1);
- }
- total_timeout.tv_sec = 20;
- total_timeout.tv_usec = 0;
- clnt_stat = clnt_call(client, procnum,
- inproc, in, outproc, out, total_timeout);
- clnt_destroy(client);
- return (int)clnt_stat;
-}
-.vs
-.DE
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * The receiving routines
- */
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-
-main()
-{
- register SVCXPRT *transp;
- int rcp_service(), xdr_rcp();
-
- if ((transp = svctcp_create(RPC_ANYSOCK,
- BUFSIZ, BUFSIZ)) == NULL) {
- fprintf("svctcp_create: error\en");
- exit(1);
- }
- pmap_unset(RCPPROG, RCPVERS);
- if (!svc_register(transp,
- RCPPROG, RCPVERS, rcp_service, IPPROTO_TCP)) {
- fprintf(stderr, "svc_register: error\en");
- exit(1);
- }
- svc_run(); /* \fInever returns\fP */
- fprintf(stderr, "svc_run should never return\en");
-}
-
-rcp_service(rqstp, transp)
- register struct svc_req *rqstp;
- register SVCXPRT *transp;
-{
- switch (rqstp->rq_proc) {
- case NULLPROC:
- if (svc_sendreply(transp, xdr_void, 0) == 0) {
- fprintf(stderr, "err: rcp_service");
- return (1);
- }
- return;
- case RCPPROC_FP:
- if (!svc_getargs(transp, xdr_rcp, stdout)) {
- svcerr_decode(transp);
- return;
- }
- if (!svc_sendreply(transp, xdr_void, 0)) {
- fprintf(stderr, "can't reply\en");
- return;
- }
- return (0);
- default:
- svcerr_noproc(transp);
- return;
- }
-}
-.vs
-.DE
-.NH 2
-\&Callback Procedures
-.IX RPC "callback procedures"
-.LP
-Occasionally, it is useful to have a server become a client,
-and make an RPC call back to the process which is its client.
-An example is remote debugging,
-where the client is a window system program,
-and the server is a debugger running on the remote machine.
-Most of the time,
-the user clicks a mouse button at the debugging window,
-which converts this to a debugger command,
-and then makes an RPC call to the server
-(where the debugger is actually running),
-telling it to execute that command.
-However, when the debugger hits a breakpoint, the roles are reversed,
-and the debugger wants to make an rpc call to the window program,
-so that it can inform the user that a breakpoint has been reached.
-.LP
-In order to do an RPC callback,
-you need a program number to make the RPC call on.
-Since this will be a dynamically generated program number,
-it should be in the transient range,
-.I "0x40000000 - 0x5fffffff" .
-The routine
-.I gettransient()
-returns a valid program number in the transient range,
-and registers it with the portmapper.
-It only talks to the portmapper running on the same machine as the
-.I gettransient()
-routine itself. The call to
-.I pmap_set()
-is a test and set operation,
-in that it indivisibly tests whether a program number
-has already been registered,
-and if it has not, then reserves it. On return, the
-.I sockp
-argument will contain a socket that can be used
-as the argument to an
-.I svcudp_create()
-or
-.I svctcp_create()
-call.
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-
-gettransient(proto, vers, sockp)
- int proto, vers, *sockp;
-{
- static int prognum = 0x40000000;
- int s, len, socktype;
- struct sockaddr_in addr;
-
- switch(proto) {
- case IPPROTO_UDP:
- socktype = SOCK_DGRAM;
- break;
- case IPPROTO_TCP:
- socktype = SOCK_STREAM;
- break;
- default:
- fprintf(stderr, "unknown protocol type\en");
- return 0;
- }
- if (*sockp == RPC_ANYSOCK) {
- if ((s = socket(AF_INET, socktype, 0)) < 0) {
- perror("socket");
- return (0);
- }
- *sockp = s;
- }
- else
- s = *sockp;
- addr.sin_addr.s_addr = 0;
- addr.sin_family = AF_INET;
- addr.sin_port = 0;
- len = sizeof(addr);
-.ft I
- /*
- * may be already bound, so don't check for error
- */
-.ft CW
- bind(s, &addr, len);
- if (getsockname(s, &addr, &len)< 0) {
- perror("getsockname");
- return (0);
- }
- while (!pmap_set(prognum++, vers, proto,
- ntohs(addr.sin_port))) continue;
- return (prognum-1);
-}
-.vs
-.DE
-.SH
-Note:
-.I
-The call to
-.I ntohs()
-is necessary to ensure that the port number in
-.I "addr.sin_port" ,
-which is in
-.I network
-byte order, is passed in
-.I host
-byte order (as
-.I pmap_set()
-expects). See the
-.I byteorder(3N)
-man page for more details on the conversion of network
-addresses from network to host byte order.
-.KS
-.LP
-The following pair of programs illustrate how to use the
-.I gettransient()
-routine.
-The client makes an RPC call to the server,
-passing it a transient program number.
-Then the client waits around to receive a callback
-from the server at that program number.
-The server registers the program
-.I EXAMPLEPROG
-so that it can receive the RPC call
-informing it of the callback program number.
-Then at some random time (on receiving an
-.I ALRM
-signal in this example), it sends a callback RPC call,
-using the program number it received earlier.
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * client
- */
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-
-int callback();
-char hostname[256];
-
-main()
-{
- int x, ans, s;
- SVCXPRT *xprt;
-
- gethostname(hostname, sizeof(hostname));
- s = RPC_ANYSOCK;
- x = gettransient(IPPROTO_UDP, 1, &s);
- fprintf(stderr, "client gets prognum %d\en", x);
- if ((xprt = svcudp_create(s)) == NULL) {
- fprintf(stderr, "rpc_server: svcudp_create\en");
- exit(1);
- }
-.ft I
- /* protocol is 0 - gettransient does registering
- */
-.ft CW
- (void)svc_register(xprt, x, 1, callback, 0);
- ans = callrpc(hostname, EXAMPLEPROG, EXAMPLEVERS,
- EXAMPLEPROC_CALLBACK, xdr_int, &x, xdr_void, 0);
- if ((enum clnt_stat) ans != RPC_SUCCESS) {
- fprintf(stderr, "call: ");
- clnt_perrno(ans);
- fprintf(stderr, "\en");
- }
- svc_run();
- fprintf(stderr, "Error: svc_run shouldn't return\en");
-}
-
-callback(rqstp, transp)
- register struct svc_req *rqstp;
- register SVCXPRT *transp;
-{
- switch (rqstp->rq_proc) {
- case 0:
- if (!svc_sendreply(transp, xdr_void, 0)) {
- fprintf(stderr, "err: exampleprog\en");
- return (1);
- }
- return (0);
- case 1:
- if (!svc_getargs(transp, xdr_void, 0)) {
- svcerr_decode(transp);
- return (1);
- }
- fprintf(stderr, "client got callback\en");
- if (!svc_sendreply(transp, xdr_void, 0)) {
- fprintf(stderr, "err: exampleprog");
- return (1);
- }
- }
-}
-.vs
-.DE
-.KE
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * server
- */
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/signal.h>
-
-char *getnewprog();
-char hostname[256];
-int docallback();
-int pnum; /* \fIprogram number for callback routine\fP */
-
-main()
-{
- gethostname(hostname, sizeof(hostname));
- registerrpc(EXAMPLEPROG, EXAMPLEVERS,
- EXAMPLEPROC_CALLBACK, getnewprog, xdr_int, xdr_void);
- fprintf(stderr, "server going into svc_run\en");
- signal(SIGALRM, docallback);
- alarm(10);
- svc_run();
- fprintf(stderr, "Error: svc_run shouldn't return\en");
-}
-
-char *
-getnewprog(pnump)
- char *pnump;
-{
- pnum = *(int *)pnump;
- return NULL;
-}
-
-docallback()
-{
- int ans;
-
- ans = callrpc(hostname, pnum, 1, 1, xdr_void, 0,
- xdr_void, 0);
- if (ans != 0) {
- fprintf(stderr, "server: ");
- clnt_perrno(ans);
- fprintf(stderr, "\en");
- }
-}
-.vs
-.DE
diff --git a/lib/librpc/doc/rpc.rfc.ms b/lib/librpc/doc/rpc.rfc.ms
deleted file mode 100644
index af9c2df..0000000
--- a/lib/librpc/doc/rpc.rfc.ms
+++ /dev/null
@@ -1,1302 +0,0 @@
-.\"
-.\" Must use -- tbl -- with this one
-.\"
-.\" @(#)rpc.rfc.ms 2.2 88/08/05 4.0 RPCSRC
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH 'Remote Procedure Calls: Protocol Specification''Page %'
-.EH 'Page %''Remote Procedure Calls: Protocol Specification'
-.if \\n%=1 .bp
-.SH
-\&Remote Procedure Calls: Protocol Specification
-.LP
-.NH 0
-\&Status of this Memo
-.LP
-Note: This chapter specifies a protocol that Sun Microsystems, Inc.,
-and others are using.
-It has been designated RFC1050 by the ARPA Network
-Information Center.
-.LP
-.NH 1
-\&Introduction
-.LP
-This chapter specifies a message protocol used in implementing
-Sun's Remote Procedure Call (RPC) package. (The message protocol is
-specified with the External Data Representation (XDR) language.
-See the
-.I "External Data Representation Standard: Protocol Specification"
-for the details. Here, we assume that the reader is familiar
-with XDR and do not attempt to justify it or its uses). The paper
-by Birrell and Nelson [1] is recommended as an excellent background
-to and justification of RPC.
-.NH 2
-\&Terminology
-.LP
-This chapter discusses servers, services, programs, procedures,
-clients, and versions. A server is a piece of software where network
-services are implemented. A network service is a collection of one
-or more remote programs. A remote program implements one or more
-remote procedures; the procedures, their parameters, and results are
-documented in the specific program's protocol specification (see the
-\fIPort Mapper Program Protocol\fP\, below, for an example). Network
-clients are pieces of software that initiate remote procedure calls
-to services. A server may support more than one version of a remote
-program in order to be forward compatible with changing protocols.
-.LP
-For example, a network file service may be composed of two programs.
-One program may deal with high-level applications such as file system
-access control and locking. The other may deal with low-level file
-IO and have procedures like "read" and "write". A client machine of
-the network file service would call the procedures associated with
-the two programs of the service on behalf of some user on the client
-machine.
-.NH 2
-\&The RPC Model
-.LP
-The remote procedure call model is similar to the local procedure
-call model. In the local case, the caller places arguments to a
-procedure in some well-specified location (such as a result
-register). It then transfers control to the procedure, and
-eventually gains back control. At that point, the results of the
-procedure are extracted from the well-specified location, and the
-caller continues execution.
-.LP
-The remote procedure call is similar, in that one thread of control
-logically winds through two processes\(emone is the caller's process,
-the other is a server's process. That is, the caller process sends a
-call message to the server process and waits (blocks) for a reply
-message. The call message contains the procedure's parameters, among
-other things. The reply message contains the procedure's results,
-among other things. Once the reply message is received, the results
-of the procedure are extracted, and caller's execution is resumed.
-.LP
-On the server side, a process is dormant awaiting the arrival of a
-call message. When one arrives, the server process extracts the
-procedure's parameters, computes the results, sends a reply message,
-and then awaits the next call message.
-.LP
-Note that in this model, only one of the two processes is active at
-any given time. However, this model is only given as an example.
-The RPC protocol makes no restrictions on the concurrency model
-implemented, and others are possible. For example, an implementation
-may choose to have RPC calls be asynchronous, so that the client may
-do useful work while waiting for the reply from the server. Another
-possibility is to have the server create a task to process an
-incoming request, so that the server can be free to receive other
-requests.
-.NH 2
-\&Transports and Semantics
-.LP
-The RPC protocol is independent of transport protocols. That is, RPC
-does not care how a message is passed from one process to another.
-The protocol deals only with specification and interpretation of
-messages.
-.LP
-It is important to point out that RPC does not try to implement any
-kind of reliability and that the application must be aware of the
-type of transport protocol underneath RPC. If it knows it is running
-on top of a reliable transport such as TCP/IP[6], then most of the
-work is already done for it. On the other hand, if it is running on
-top of an unreliable transport such as UDP/IP[7], it must implement
-is own retransmission and time-out policy as the RPC layer does not
-provide this service.
-.LP
-Because of transport independence, the RPC protocol does not attach
-specific semantics to the remote procedures or their execution.
-Semantics can be inferred from (but should be explicitly specified
-by) the underlying transport protocol. For example, consider RPC
-running on top of an unreliable transport such as UDP/IP. If an
-application retransmits RPC messages after short time-outs, the only
-thing it can infer if it receives no reply is that the procedure was
-executed zero or more times. If it does receive a reply, then it can
-infer that the procedure was executed at least once.
-.LP
-A server may wish to remember previously granted requests from a
-client and not regrant them in order to insure some degree of
-execute-at-most-once semantics. A server can do this by taking
-advantage of the transaction ID that is packaged with every RPC
-request. The main use of this transaction is by the client RPC layer
-in matching replies to requests. However, a client application may
-choose to reuse its previous transaction ID when retransmitting a
-request. The server application, knowing this fact, may choose to
-remember this ID after granting a request and not regrant requests
-with the same ID in order to achieve some degree of
-execute-at-most-once semantics. The server is not allowed to examine
-this ID in any other way except as a test for equality.
-.LP
-On the other hand, if using a reliable transport such as TCP/IP, the
-application can infer from a reply message that the procedure was
-executed exactly once, but if it receives no reply message, it cannot
-assume the remote procedure was not executed. Note that even if a
-connection-oriented protocol like TCP is used, an application still
-needs time-outs and reconnection to handle server crashes.
-.LP
-There are other possibilities for transports besides datagram- or
-connection-oriented protocols. For example, a request-reply protocol
-such as VMTP[2] is perhaps the most natural transport for RPC.
-.SH
-.I
-NOTE: At Sun, RPC is currently implemented on top of both TCP/IP
-and UDP/IP transports.
-.LP
-.NH 2
-\&Binding and Rendezvous Independence
-.LP
-The act of binding a client to a service is NOT part of the remote
-procedure call specification. This important and necessary function
-is left up to some higher-level software. (The software may use RPC
-itself\(emsee the \fIPort Mapper Program Protocol\fP\, below).
-.LP
-Implementors should think of the RPC protocol as the jump-subroutine
-instruction ("JSR") of a network; the loader (binder) makes JSR
-useful, and the loader itself uses JSR to accomplish its task.
-Likewise, the network makes RPC useful, using RPC to accomplish this
-task.
-.NH 2
-\&Authentication
-.LP
-The RPC protocol provides the fields necessary for a client to
-identify itself to a service and vice-versa. Security and access
-control mechanisms can be built on top of the message authentication.
-Several different authentication protocols can be supported. A field
-in the RPC header indicates which protocol is being used. More
-information on specific authentication protocols can be found in the
-\fIAuthentication Protocols\fP\,
-below.
-.KS
-.NH 1
-\&RPC Protocol Requirements
-.LP
-The RPC protocol must provide for the following:
-.IP 1.
-Unique specification of a procedure to be called.
-.IP 2.
-Provisions for matching response messages to request messages.
-.KE
-.IP 3.
-Provisions for authenticating the caller to service and vice-versa.
-.LP
-Besides these requirements, features that detect the following are
-worth supporting because of protocol roll-over errors, implementation
-bugs, user error, and network administration:
-.IP 1.
-RPC protocol mismatches.
-.IP 2.
-Remote program protocol version mismatches.
-.IP 3.
-Protocol errors (such as misspecification of a procedure's parameters).
-.IP 4.
-Reasons why remote authentication failed.
-.IP 5.
-Any other reasons why the desired procedure was not called.
-.NH 2
-\&Programs and Procedures
-.LP
-The RPC call message has three unsigned fields: remote program
-number, remote program version number, and remote procedure number.
-The three fields uniquely identify the procedure to be called.
-Program numbers are administered by some central authority (like
-Sun). Once an implementor has a program number, he can implement his
-remote program; the first implementation would most likely have the
-version number of 1. Because most new protocols evolve into better,
-stable, and mature protocols, a version field of the call message
-identifies which version of the protocol the caller is using.
-Version numbers make speaking old and new protocols through the same
-server process possible.
-.LP
-The procedure number identifies the procedure to be called. These
-numbers are documented in the specific program's protocol
-specification. For example, a file service's protocol specification
-may state that its procedure number 5 is "read" and procedure number
-12 is "write".
-.LP
-Just as remote program protocols may change over several versions,
-the actual RPC message protocol could also change. Therefore, the
-call message also has in it the RPC version number, which is always
-equal to two for the version of RPC described here.
-.LP
-The reply message to a request message has enough information to
-distinguish the following error conditions:
-.IP 1.
-The remote implementation of RPC does speak protocol version 2.
-The lowest and highest supported RPC version numbers are returned.
-.IP 2.
-The remote program is not available on the remote system.
-.IP 3.
-The remote program does not support the requested version number.
-The lowest and highest supported remote program version numbers are
-returned.
-.IP 4.
-The requested procedure number does not exist. (This is usually a
-caller side protocol or programming error.)
-.IP 5.
-The parameters to the remote procedure appear to be garbage from the
-server's point of view. (Again, this is usually caused by a
-disagreement about the protocol between client and service.)
-.NH 2
-\&Authentication
-.LP
-Provisions for authentication of caller to service and vice-versa are
-provided as a part of the RPC protocol. The call message has two
-authentication fields, the credentials and verifier. The reply
-message has one authentication field, the response verifier. The RPC
-protocol specification defines all three fields to be the following
-opaque type:
-.DS
-.ft CW
-.vs 11
-enum auth_flavor {
- AUTH_NULL = 0,
- AUTH_UNIX = 1,
- AUTH_SHORT = 2,
- AUTH_DES = 3
- /* \fIand more to be defined\fP */
-};
-
-struct opaque_auth {
- auth_flavor flavor;
- opaque body<400>;
-};
-.DE
-.LP
-In simple English, any
-.I opaque_auth
-structure is an
-.I auth_flavor
-enumeration followed by bytes which are opaque to the RPC protocol
-implementation.
-.LP
-The interpretation and semantics of the data contained within the
-authentication fields is specified by individual, independent
-authentication protocol specifications. (See
-\fIAuthentication Protocols\fP\,
-below, for definitions of the various authentication protocols.)
-.LP
-If authentication parameters were rejected, the response message
-contains information stating why they were rejected.
-.NH 2
-\&Program Number Assignment
-.LP
-Program numbers are given out in groups of
-.I 0x20000000
-(decimal 536870912) according to the following chart:
-.TS
-box tab (&) ;
-lfI lfI
-rfL cfI .
-Program Numbers&Description
-_
-.sp .5
-0 - 1fffffff&Defined by Sun
-20000000 - 3fffffff&Defined by user
-40000000 - 5fffffff&Transient
-60000000 - 7fffffff&Reserved
-80000000 - 9fffffff&Reserved
-a0000000 - bfffffff&Reserved
-c0000000 - dfffffff&Reserved
-e0000000 - ffffffff&Reserved
-.TE
-.LP
-The first group is a range of numbers administered by Sun
-Microsystems and should be identical for all sites. The second range
-is for applications peculiar to a particular site. This range is
-intended primarily for debugging new programs. When a site develops
-an application that might be of general interest, that application
-should be given an assigned number in the first range. The third
-group is for applications that generate program numbers dynamically.
-The final groups are reserved for future use, and should not be used.
-.NH 2
-\&Other Uses of the RPC Protocol
-.LP
-The intended use of this protocol is for calling remote procedures.
-That is, each call message is matched with a response message.
-However, the protocol itself is a message-passing protocol with which
-other (non-RPC) protocols can be implemented. Sun currently uses, or
-perhaps abuses, the RPC message protocol for the following two
-(non-RPC) protocols: batching (or pipelining) and broadcast RPC.
-These two protocols are discussed but not defined below.
-.NH 3
-\&Batching
-.LP
-Batching allows a client to send an arbitrarily large sequence of
-call messages to a server; batching typically uses reliable byte
-stream protocols (like TCP/IP) for its transport. In the case of
-batching, the client never waits for a reply from the server, and the
-server does not send replies to batch requests. A sequence of batch
-calls is usually terminated by a legitimate RPC in order to flush the
-pipeline (with positive acknowledgement).
-.NH 3
-\&Broadcast RPC
-.LP
-In broadcast RPC-based protocols, the client sends a broadcast packet
-to the network and waits for numerous replies. Broadcast RPC uses
-unreliable, packet-based protocols (like UDP/IP) as its transports.
-Servers that support broadcast protocols only respond when the
-request is successfully processed, and are silent in the face of
-errors. Broadcast RPC uses the Port Mapper RPC service to achieve
-its semantics. See the \fIPort Mapper Program Protocol\fP\, below,
-for more information.
-.KS
-.NH 1
-\&The RPC Message Protocol
-.LP
-This section defines the RPC message protocol in the XDR data
-description language. The message is defined in a top-down style.
-.ie t .DS
-.el .DS L
-.ft CW
-enum msg_type {
- CALL = 0,
- REPLY = 1
-};
-
-.ft I
-/*
-* A reply to a call message can take on two forms:
-* The message was either accepted or rejected.
-*/
-.ft CW
-enum reply_stat {
- MSG_ACCEPTED = 0,
- MSG_DENIED = 1
-};
-
-.ft I
-/*
-* Given that a call message was accepted, the following is the
-* status of an attempt to call a remote procedure.
-*/
-.ft CW
-enum accept_stat {
- SUCCESS = 0, /* \fIRPC executed successfully \fP*/
- PROG_UNAVAIL = 1, /* \fIremote hasn't exported program \fP*/
- PROG_MISMATCH = 2, /* \fIremote can't support version # \fP*/
- PROC_UNAVAIL = 3, /* \fIprogram can't support procedure \fP*/
- GARBAGE_ARGS = 4 /* \fIprocedure can't decode params \fP*/
-};
-.DE
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* Reasons why a call message was rejected:
-*/
-.ft CW
-enum reject_stat {
- RPC_MISMATCH = 0, /* \fIRPC version number != 2 \fP*/
- AUTH_ERROR = 1 /* \fIremote can't authenticate caller \fP*/
-};
-
-.ft I
-/*
-* Why authentication failed:
-*/
-.ft CW
-enum auth_stat {
- AUTH_BADCRED = 1, /* \fIbad credentials \fP*/
- AUTH_REJECTEDCRED = 2, /* \fIclient must begin new session \fP*/
- AUTH_BADVERF = 3, /* \fIbad verifier \fP*/
- AUTH_REJECTEDVERF = 4, /* \fIverifier expired or replayed \fP*/
- AUTH_TOOWEAK = 5 /* \fIrejected for security reasons \fP*/
-};
-.DE
-.KE
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* The RPC message:
-* All messages start with a transaction identifier, xid,
-* followed by a two-armed discriminated union. The union's
-* discriminant is a msg_type which switches to one of the two
-* types of the message. The xid of a \fIREPLY\fP message always
-* matches that of the initiating \fICALL\fP message. NB: The xid
-* field is only used for clients matching reply messages with
-* call messages or for servers detecting retransmissions; the
-* service side cannot treat this id as any type of sequence
-* number.
-*/
-.ft CW
-struct rpc_msg {
- unsigned int xid;
- union switch (msg_type mtype) {
- case CALL:
- call_body cbody;
- case REPLY:
- reply_body rbody;
- } body;
-};
-.DE
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* Body of an RPC request call:
-* In version 2 of the RPC protocol specification, rpcvers must
-* be equal to 2. The fields prog, vers, and proc specify the
-* remote program, its version number, and the procedure within
-* the remote program to be called. After these fields are two
-* authentication parameters: cred (authentication credentials)
-* and verf (authentication verifier). The two authentication
-* parameters are followed by the parameters to the remote
-* procedure, which are specified by the specific program
-* protocol.
-*/
-.ft CW
-struct call_body {
- unsigned int rpcvers; /* \fImust be equal to two (2) \fP*/
- unsigned int prog;
- unsigned int vers;
- unsigned int proc;
- opaque_auth cred;
- opaque_auth verf;
- /* \fIprocedure specific parameters start here \fP*/
-};
-.DE
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* Body of a reply to an RPC request:
-* The call message was either accepted or rejected.
-*/
-.ft CW
-union reply_body switch (reply_stat stat) {
- case MSG_ACCEPTED:
- accepted_reply areply;
- case MSG_DENIED:
- rejected_reply rreply;
-} reply;
-.DE
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* Reply to an RPC request that was accepted by the server:
-* there could be an error even though the request was accepted.
-* The first field is an authentication verifier that the server
-* generates in order to validate itself to the caller. It is
-* followed by a union whose discriminant is an enum
-* accept_stat. The \fISUCCESS\fP arm of the union is protocol
-* specific. The \fIPROG_UNAVAIL\fP, \fIPROC_UNAVAIL\fP, and \fIGARBAGE_ARGP\fP
-* arms of the union are void. The \fIPROG_MISMATCH\fP arm specifies
-* the lowest and highest version numbers of the remote program
-* supported by the server.
-*/
-.ft CW
-struct accepted_reply {
- opaque_auth verf;
- union switch (accept_stat stat) {
- case SUCCESS:
- opaque results[0];
- /* \fIprocedure-specific results start here\fP */
- case PROG_MISMATCH:
- struct {
- unsigned int low;
- unsigned int high;
- } mismatch_info;
- default:
-.ft I
- /*
- * Void. Cases include \fIPROG_UNAVAIL, PROC_UNAVAIL\fP,
- * and \fIGARBAGE_ARGS\fP.
- */
-.ft CW
- void;
- } reply_data;
-};
-.DE
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* Reply to an RPC request that was rejected by the server:
-* The request can be rejected for two reasons: either the
-* server is not running a compatible version of the RPC
-* protocol (\fIRPC_MISMATCH\fP), or the server refuses to
-* authenticate the caller (\fIAUTH_ERROR\fP). In case of an RPC
-* version mismatch, the server returns the lowest and highest
-* supported RPC version numbers. In case of refused
-* authentication, failure status is returned.
-*/
-.ft CW
-union rejected_reply switch (reject_stat stat) {
- case RPC_MISMATCH:
- struct {
- unsigned int low;
- unsigned int high;
- } mismatch_info;
- case AUTH_ERROR:
- auth_stat stat;
-};
-.DE
-.NH 1
-\&Authentication Protocols
-.LP
-As previously stated, authentication parameters are opaque, but
-open-ended to the rest of the RPC protocol. This section defines
-some "flavors" of authentication implemented at (and supported by)
-Sun. Other sites are free to invent new authentication types, with
-the same rules of flavor number assignment as there is for program
-number assignment.
-.NH 2
-\&Null Authentication
-.LP
-Often calls must be made where the caller does not know who he is or
-the server does not care who the caller is. In this case, the flavor
-value (the discriminant of the \fIopaque_auth\fP's union) of the RPC
-message's credentials, verifier, and response verifier is
-.I AUTH_NULL .
-The bytes of the opaque_auth's body are undefined.
-It is recommended that the opaque length be zero.
-.NH 2
-\&UNIX Authentication
-.LP
-The caller of a remote procedure may wish to identify himself as he
-is identified on a UNIX system. The value of the credential's
-discriminant of an RPC call message is
-.I AUTH_UNIX .
-The bytes of
-the credential's opaque body encode the following structure:
-.DS
-.ft CW
-struct auth_unix {
- unsigned int stamp;
- string machinename<255>;
- unsigned int uid;
- unsigned int gid;
- unsigned int gids<10>;
-};
-.DE
-The
-.I stamp
-is an arbitrary ID which the caller machine may
-generate. The
-.I machinename
-is the name of the caller's machine (like "krypton"). The
-.I uid
-is the caller's effective user ID. The
-.I gid
-is the caller's effective group ID. The
-.I gids
-is a
-counted array of groups which contain the caller as a member. The
-verifier accompanying the credentials should be of
-.I AUTH_NULL
-(defined above).
-.LP
-The value of the discriminant of the response verifier received in
-the reply message from the server may be
-.I AUTH_NULL
-or
-.I AUTH_SHORT .
-In the case of
-.I AUTH_SHORT ,
-the bytes of the response verifier's string encode an opaque
-structure. This new opaque structure may now be passed to the server
-instead of the original
-.I AUTH_UNIX
-flavor credentials. The server keeps a cache which maps shorthand
-opaque structures (passed back by way of an
-.I AUTH_SHORT
-style response verifier) to the original credentials of the caller.
-The caller can save network bandwidth and server cpu cycles by using
-the new credentials.
-.LP
-The server may flush the shorthand opaque structure at any time. If
-this happens, the remote procedure call message will be rejected due
-to an authentication error. The reason for the failure will be
-.I AUTH_REJECTEDCRED .
-At this point, the caller may wish to try the original
-.I AUTH_UNIX
-style of credentials.
-.KS
-.NH 2
-\&DES Authentication
-.LP
-UNIX authentication suffers from two major problems:
-.IP 1.
-The naming is too UNIX-system oriented.
-.IP 2.
-There is no verifier, so credentials can easily be faked.
-.LP
-DES authentication attempts to fix these two problems.
-.KE
-.NH 3
-\&Naming
-.LP
-The first problem is handled by addressing the caller by a simple
-string of characters instead of by an operating system specific
-integer. This string of characters is known as the "netname" or
-network name of the caller. The server is not allowed to interpret
-the contents of the caller's name in any other way except to
-identify the caller. Thus, netnames should be unique for every
-caller in the internet.
-.LP
-It is up to each operating system's implementation of DES
-authentication to generate netnames for its users that insure this
-uniqueness when they call upon remote servers. Operating systems
-already know how to distinguish users local to their systems. It is
-usually a simple matter to extend this mechanism to the network.
-For example, a UNIX user at Sun with a user ID of 515 might be
-assigned the following netname: "unix.515@sun.com". This netname
-contains three items that serve to insure it is unique. Going
-backwards, there is only one naming domain called "sun.com" in the
-internet. Within this domain, there is only one UNIX user with
-user ID 515. However, there may be another user on another
-operating system, for example VMS, within the same naming domain
-that, by coincidence, happens to have the same user ID. To insure
-that these two users can be distinguished we add the operating
-system name. So one user is "unix.515@sun.com" and the other is
-"vms.515@sun.com".
-.LP
-The first field is actually a naming method rather than an
-operating system name. It just happens that today there is almost
-a one-to-one correspondence between naming methods and operating
-systems. If the world could agree on a naming standard, the first
-field could be the name of that standard, instead of an operating
-system name.
-.LP
-.NH 3
-\&DES Authentication Verifiers
-.LP
-Unlike UNIX authentication, DES authentication does have a verifier
-so the server can validate the client's credential (and
-vice-versa). The contents of this verifier is primarily an
-encrypted timestamp. The server can decrypt this timestamp, and if
-it is close to what the real time is, then the client must have
-encrypted it correctly. The only way the client could encrypt it
-correctly is to know the "conversation key" of the RPC session. And
-if the client knows the conversation key, then it must be the real
-client.
-.LP
-The conversation key is a DES [5] key which the client generates
-and notifies the server of in its first RPC call. The conversation
-key is encrypted using a public key scheme in this first
-transaction. The particular public key scheme used in DES
-authentication is Diffie-Hellman [3] with 192-bit keys. The
-details of this encryption method are described later.
-.LP
-The client and the server need the same notion of the current time
-in order for all of this to work. If network time synchronization
-cannot be guaranteed, then client can synchronize with the server
-before beginning the conversation, perhaps by consulting the
-Internet Time Server (TIME[4]).
-.LP
-The way a server determines if a client timestamp is valid is
-somewhat complicated. For any other transaction but the first, the
-server just checks for two things:
-.IP 1.
-the timestamp is greater than the one previously seen from the
-same client.
-.IP 2.
-the timestamp has not expired.
-.LP
-A timestamp is expired if the server's time is later than the sum
-of the client's timestamp plus what is known as the client's
-"window". The "window" is a number the client passes (encrypted)
-to the server in its first transaction. You can think of it as a
-lifetime for the credential.
-.LP
-This explains everything but the first transaction. In the first
-transaction, the server checks only that the timestamp has not
-expired. If this was all that was done though, then it would be
-quite easy for the client to send random data in place of the
-timestamp with a fairly good chance of succeeding. As an added
-check, the client sends an encrypted item in the first transaction
-known as the "window verifier" which must be equal to the window
-minus 1, or the server will reject the credential.
-.LP
-The client too must check the verifier returned from the server to
-be sure it is legitimate. The server sends back to the client the
-encrypted timestamp it received from the client, minus one second.
-If the client gets anything different than this, it will reject it.
-.LP
-.NH 3
-\&Nicknames and Clock Synchronization
-.LP
-After the first transaction, the server's DES authentication
-subsystem returns in its verifier to the client an integer
-"nickname" which the client may use in its further transactions
-instead of passing its netname, encrypted DES key and window every
-time. The nickname is most likely an index into a table on the
-server which stores for each client its netname, decrypted DES key
-and window.
-.LP
-Though they originally were synchronized, the client's and server's
-clocks can get out of sync again. When this happens the client RPC
-subsystem most likely will get back
-.I RPC_AUTHERROR
-at which point it should resynchronize.
-.LP
-A client may still get the
-.I RPC_AUTHERROR
-error even though it is
-synchronized with the server. The reason is that the server's
-nickname table is a limited size, and it may flush entries whenever
-it wants. A client should resend its original credential in this
-case and the server will give it a new nickname. If a server
-crashes, the entire nickname table gets flushed, and all clients
-will have to resend their original credentials.
-.KS
-.NH 3
-\&DES Authentication Protocol (in XDR language)
-.ie t .DS
-.el .DS L
-.ft I
-/*
-* There are two kinds of credentials: one in which the client uses
-* its full network name, and one in which it uses its "nickname"
-* (just an unsigned integer) given to it by the server. The
-* client must use its fullname in its first transaction with the
-* server, in which the server will return to the client its
-* nickname. The client may use its nickname in all further
-* transactions with the server. There is no requirement to use the
-* nickname, but it is wise to use it for performance reasons.
-*/
-.ft CW
-enum authdes_namekind {
- ADN_FULLNAME = 0,
- ADN_NICKNAME = 1
-};
-
-.ft I
-/*
-* A 64-bit block of encrypted DES data
-*/
-.ft CW
-typedef opaque des_block[8];
-
-.ft I
-/*
-* Maximum length of a network user's name
-*/
-.ft CW
-const MAXNETNAMELEN = 255;
-
-.ft I
-/*
-* A fullname contains the network name of the client, an encrypted
-* conversation key and the window. The window is actually a
-* lifetime for the credential. If the time indicated in the
-* verifier timestamp plus the window has past, then the server
-* should expire the request and not grant it. To insure that
-* requests are not replayed, the server should insist that
-* timestamps are greater than the previous one seen, unless it is
-* the first transaction. In the first transaction, the server
-* checks instead that the window verifier is one less than the
-* window.
-*/
-.ft CW
-struct authdes_fullname {
-string name<MAXNETNAMELEN>; /* \fIname of client \f(CW*/
-des_block key; /* \fIPK encrypted conversation key \f(CW*/
-unsigned int window; /* \fIencrypted window \f(CW*/
-};
-
-.ft I
-/*
-* A credential is either a fullname or a nickname
-*/
-.ft CW
-union authdes_cred switch (authdes_namekind adc_namekind) {
- case ADN_FULLNAME:
- authdes_fullname adc_fullname;
- case ADN_NICKNAME:
- unsigned int adc_nickname;
-};
-
-.ft I
-/*
-* A timestamp encodes the time since midnight, January 1, 1970.
-*/
-.ft CW
-struct timestamp {
- unsigned int seconds; /* \fIseconds \fP*/
- unsigned int useconds; /* \fIand microseconds \fP*/
-};
-
-.ft I
-/*
-* Verifier: client variety
-* The window verifier is only used in the first transaction. In
-* conjunction with a fullname credential, these items are packed
-* into the following structure before being encrypted:
-*
-* \f(CWstruct {\fP
-* \f(CWadv_timestamp; \fP-- one DES block
-* \f(CWadc_fullname.window; \fP-- one half DES block
-* \f(CWadv_winverf; \fP-- one half DES block
-* \f(CW}\fP
-* This structure is encrypted using CBC mode encryption with an
-* input vector of zero. All other encryptions of timestamps use
-* ECB mode encryption.
-*/
-.ft CW
-struct authdes_verf_clnt {
- timestamp adv_timestamp; /* \fIencrypted timestamp \fP*/
- unsigned int adv_winverf; /* \fIencrypted window verifier \fP*/
-};
-
-.ft I
-/*
-* Verifier: server variety
-* The server returns (encrypted) the same timestamp the client
-* gave it minus one second. It also tells the client its nickname
-* to be used in future transactions (unencrypted).
-*/
-.ft CW
-struct authdes_verf_svr {
-timestamp adv_timeverf; /* \fIencrypted verifier \fP*/
-unsigned int adv_nickname; /* \fInew nickname for client \fP*/
-};
-.DE
-.KE
-.NH 3
-\&Diffie-Hellman Encryption
-.LP
-In this scheme, there are two constants,
-.I BASE
-and
-.I MODULUS .
-The
-particular values Sun has chosen for these for the DES
-authentication protocol are:
-.ie t .DS
-.el .DS L
-.ft CW
-const BASE = 3;
-const MODULUS =
- "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"; /* \fIhex \fP*/
-.DE
-.ft R
-The way this scheme works is best explained by an example. Suppose
-there are two people "A" and "B" who want to send encrypted
-messages to each other. So, A and B both generate "secret" keys at
-random which they do not reveal to anyone. Let these keys be
-represented as SK(A) and SK(B). They also publish in a public
-directory their "public" keys. These keys are computed as follows:
-.ie t .DS
-.el .DS L
-.ft CW
-PK(A) = ( BASE ** SK(A) ) mod MODULUS
-PK(B) = ( BASE ** SK(B) ) mod MODULUS
-.DE
-.ft R
-The "**" notation is used here to represent exponentiation. Now,
-both A and B can arrive at the "common" key between them,
-represented here as CK(A, B), without revealing their secret keys.
-.LP
-A computes:
-.ie t .DS
-.el .DS L
-.ft CW
-CK(A, B) = ( PK(B) ** SK(A)) mod MODULUS
-.DE
-.ft R
-while B computes:
-.ie t .DS
-.el .DS L
-.ft CW
-CK(A, B) = ( PK(A) ** SK(B)) mod MODULUS
-.DE
-.ft R
-These two can be shown to be equivalent:
-.ie t .DS
-.el .DS L
-.ft CW
-(PK(B) ** SK(A)) mod MODULUS = (PK(A) ** SK(B)) mod MODULUS
-.DE
-.ft R
-We drop the "mod MODULUS" parts and assume modulo arithmetic to
-simplify things:
-.ie t .DS
-.el .DS L
-.ft CW
-PK(B) ** SK(A) = PK(A) ** SK(B)
-.DE
-.ft R
-Then, replace PK(B) by what B computed earlier and likewise for
-PK(A).
-.ie t .DS
-.el .DS L
-.ft CW
-((BASE ** SK(B)) ** SK(A) = (BASE ** SK(A)) ** SK(B)
-.DE
-.ft R
-which leads to:
-.ie t .DS
-.el .DS L
-.ft CW
-BASE ** (SK(A) * SK(B)) = BASE ** (SK(A) * SK(B))
-.DE
-.ft R
-This common key CK(A, B) is not used to encrypt the timestamps used
-in the protocol. Rather, it is used only to encrypt a conversation
-key which is then used to encrypt the timestamps. The reason for
-doing this is to use the common key as little as possible, for fear
-that it could be broken. Breaking the conversation key is a far
-less serious offense, since conversations are relatively
-short-lived.
-.LP
-The conversation key is encrypted using 56-bit DES keys, yet the
-common key is 192 bits. To reduce the number of bits, 56 bits are
-selected from the common key as follows. The middle-most 8-bytes
-are selected from the common key, and then parity is added to the
-lower order bit of each byte, producing a 56-bit key with 8 bits of
-parity.
-.KS
-.NH 1
-\&Record Marking Standard
-.LP
-When RPC messages are passed on top of a byte stream protocol (like
-TCP/IP), it is necessary, or at least desirable, to delimit one
-message from another in order to detect and possibly recover from
-user protocol errors. This is called record marking (RM). Sun uses
-this RM/TCP/IP transport for passing RPC messages on TCP streams.
-One RPC message fits into one RM record.
-.LP
-A record is composed of one or more record fragments. A record
-fragment is a four-byte header followed by 0 to (2**31) - 1 bytes of
-fragment data. The bytes encode an unsigned binary number; as with
-XDR integers, the byte order is from highest to lowest. The number
-encodes two values\(ema boolean which indicates whether the fragment
-is the last fragment of the record (bit value 1 implies the fragment
-is the last fragment) and a 31-bit unsigned binary value which is the
-length in bytes of the fragment's data. The boolean value is the
-highest-order bit of the header; the length is the 31 low-order bits.
-(Note that this record specification is NOT in XDR standard form!)
-.KE
-.KS
-.NH 1
-\&The RPC Language
-.LP
-Just as there was a need to describe the XDR data-types in a formal
-language, there is also need to describe the procedures that operate
-on these XDR data-types in a formal language as well. We use the RPC
-Language for this purpose. It is an extension to the XDR language.
-The following example is used to describe the essence of the
-language.
-.NH 2
-\&An Example Service Described in the RPC Language
-.LP
-Here is an example of the specification of a simple ping program.
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
-* Simple ping program
-*/
-.ft CW
-program PING_PROG {
- /* \fILatest and greatest version\fP */
- version PING_VERS_PINGBACK {
- void
- PINGPROC_NULL(void) = 0;
-
-.ft I
- /*
- * Ping the caller, return the round-trip time
- * (in microseconds). Returns -1 if the operation
- * timed out.
- */
-.ft CW
- int
- PINGPROC_PINGBACK(void) = 1;
-} = 2;
-
-.ft I
-/*
-* Original version
-*/
-.ft CW
-version PING_VERS_ORIG {
- void
- PINGPROC_NULL(void) = 0;
- } = 1;
-} = 1;
-
-const PING_VERS = 2; /* \fIlatest version \fP*/
-.vs
-.DE
-.KE
-.LP
-The first version described is
-.I PING_VERS_PINGBACK
-with two procedures,
-.I PINGPROC_NULL
-and
-.I PINGPROC_PINGBACK .
-.I PINGPROC_NULL
-takes no arguments and returns no results, but it is useful for
-computing round-trip times from the client to the server and back
-again. By convention, procedure 0 of any RPC protocol should have
-the same semantics, and never require any kind of authentication.
-The second procedure is used for the client to have the server do a
-reverse ping operation back to the client, and it returns the amount
-of time (in microseconds) that the operation used. The next version,
-.I PING_VERS_ORIG ,
-is the original version of the protocol
-and it does not contain
-.I PINGPROC_PINGBACK
-procedure. It is useful
-for compatibility with old client programs, and as this program
-matures it may be dropped from the protocol entirely.
-.KS
-.NH 2
-\&The RPC Language Specification
-.LP
-The RPC language is identical to the XDR language, except for the
-added definition of a
-.I program-def
-described below.
-.DS
-.ft CW
-program-def:
- "program" identifier "{"
- version-def
- version-def *
- "}" "=" constant ";"
-
-version-def:
- "version" identifier "{"
- procedure-def
- procedure-def *
- "}" "=" constant ";"
-
-procedure-def:
- type-specifier identifier "(" type-specifier ")"
- "=" constant ";"
-.DE
-.KE
-.NH 2
-\&Syntax Notes
-.IP 1.
-The following keywords are added and cannot be used as
-identifiers: "program" and "version";
-.IP 2.
-A version name cannot occur more than once within the scope of
-a program definition. Nor can a version number occur more than once
-within the scope of a program definition.
-.IP 3.
-A procedure name cannot occur more than once within the scope
-of a version definition. Nor can a procedure number occur more than
-once within the scope of version definition.
-.IP 4.
-Program identifiers are in the same name space as constant and
-type identifiers.
-.IP 5.
-Only unsigned constants can be assigned to programs, versions
-and procedures.
-.NH 1
-\&Port Mapper Program Protocol
-.LP
-The port mapper program maps RPC program and version numbers to
-transport-specific port numbers. This program makes dynamic binding
-of remote programs possible.
-.LP
-This is desirable because the range of reserved port numbers is very
-small and the number of potential remote programs is very large. By
-running only the port mapper on a reserved port, the port numbers of
-other remote programs can be ascertained by querying the port mapper.
-.LP
-The port mapper also aids in broadcast RPC. A given RPC program will
-usually have different port number bindings on different machines, so
-there is no way to directly broadcast to all of these programs. The
-port mapper, however, does have a fixed port number. So, to
-broadcast to a given program, the client actually sends its message
-to the port mapper located at the broadcast address. Each port
-mapper that picks up the broadcast then calls the local service
-specified by the client. When the port mapper gets the reply from
-the local service, it sends the reply on back to the client.
-.KS
-.NH 2
-\&Port Mapper Protocol Specification (in RPC Language)
-.ie t .DS
-.el .DS L
-.ft CW
-.vs 11
-const PMAP_PORT = 111; /* \fIportmapper port number \fP*/
-
-.ft I
-/*
-* A mapping of (program, version, protocol) to port number
-*/
-.ft CW
-struct mapping {
- unsigned int prog;
- unsigned int vers;
- unsigned int prot;
- unsigned int port;
-};
-
-.ft I
-/*
-* Supported values for the "prot" field
-*/
-.ft CW
-const IPPROTO_TCP = 6; /* \fIprotocol number for TCP/IP \fP*/
-const IPPROTO_UDP = 17; /* \fIprotocol number for UDP/IP \fP*/
-
-.ft I
-/*
-* A list of mappings
-*/
-.ft CW
-struct *pmaplist {
- mapping map;
- pmaplist next;
-};
-.vs
-.DE
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
-* Arguments to callit
-*/
-.ft CW
-struct call_args {
- unsigned int prog;
- unsigned int vers;
- unsigned int proc;
- opaque args<>;
-};
-
-.ft I
-/*
-* Results of callit
-*/
-.ft CW
-struct call_result {
- unsigned int port;
- opaque res<>;
-};
-.vs
-.DE
-.KE
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
-* Port mapper procedures
-*/
-.ft CW
-program PMAP_PROG {
- version PMAP_VERS {
- void
- PMAPPROC_NULL(void) = 0;
-
- bool
- PMAPPROC_SET(mapping) = 1;
-
- bool
- PMAPPROC_UNSET(mapping) = 2;
-
- unsigned int
- PMAPPROC_GETPORT(mapping) = 3;
-
- pmaplist
- PMAPPROC_DUMP(void) = 4;
-
- call_result
- PMAPPROC_CALLIT(call_args) = 5;
- } = 2;
-} = 100000;
-.vs
-.DE
-.NH 2
-\&Port Mapper Operation
-.LP
-The portmapper program currently supports two protocols (UDP/IP and
-TCP/IP). The portmapper is contacted by talking to it on assigned
-port number 111 (SUNRPC [8]) on either of these protocols. The
-following is a description of each of the portmapper procedures:
-.IP \fBPMAPPROC_NULL:\fP
-This procedure does no work. By convention, procedure zero of any
-protocol takes no parameters and returns no results.
-.IP \fBPMAPPROC_SET:\fP
-When a program first becomes available on a machine, it registers
-itself with the port mapper program on the same machine. The program
-passes its program number "prog", version number "vers", transport
-protocol number "prot", and the port "port" on which it awaits
-service request. The procedure returns a boolean response whose
-value is
-.I TRUE
-if the procedure successfully established the mapping and
-.I FALSE
-otherwise. The procedure refuses to establish
-a mapping if one already exists for the tuple "(prog, vers, prot)".
-.IP \fBPMAPPROC_UNSET:\fP
-When a program becomes unavailable, it should unregister itself with
-the port mapper program on the same machine. The parameters and
-results have meanings identical to those of
-.I PMAPPROC_SET .
-The protocol and port number fields of the argument are ignored.
-.IP \fBPMAPPROC_GETPORT:\fP
-Given a program number "prog", version number "vers", and transport
-protocol number "prot", this procedure returns the port number on
-which the program is awaiting call requests. A port value of zeros
-means the program has not been registered. The "port" field of the
-argument is ignored.
-.IP \fBPMAPPROC_DUMP:\fP
-This procedure enumerates all entries in the port mapper's database.
-The procedure takes no parameters and returns a list of program,
-version, protocol, and port values.
-.IP \fBPMAPPROC_CALLIT:\fP
-This procedure allows a caller to call another remote procedure on
-the same machine without knowing the remote procedure's port number.
-It is intended for supporting broadcasts to arbitrary remote programs
-via the well-known port mapper's port. The parameters "prog",
-"vers", "proc", and the bytes of "args" are the program number,
-version number, procedure number, and parameters of the remote
-procedure.
-.LP
-.B Note:
-.RS
-.IP 1.
-This procedure only sends a response if the procedure was
-successfully executed and is silent (no response) otherwise.
-.IP 2.
-The port mapper communicates with the remote program using UDP/IP
-only.
-.RE
-.LP
-The procedure returns the remote program's port number, and the bytes
-of results are the results of the remote procedure.
-.bp
-.NH 1
-\&References
-.LP
-[1] Birrell, Andrew D. & Nelson, Bruce Jay; "Implementing Remote
-Procedure Calls"; XEROX CSL-83-7, October 1983.
-.LP
-[2] Cheriton, D.; "VMTP: Versatile Message Transaction Protocol",
-Preliminary Version 0.3; Stanford University, January 1987.
-.LP
-[3] Diffie & Hellman; "New Directions in Cryptography"; IEEE
-Transactions on Information Theory IT-22, November 1976.
-.LP
-[4] Harrenstien, K.; "Time Server", RFC 738; Information Sciences
-Institute, October 1977.
-.LP
-[5] National Bureau of Standards; "Data Encryption Standard"; Federal
-Information Processing Standards Publication 46, January 1977.
-.LP
-[6] Postel, J.; "Transmission Control Protocol - DARPA Internet
-Program Protocol Specification", RFC 793; Information Sciences
-Institute, September 1981.
-.LP
-[7] Postel, J.; "User Datagram Protocol", RFC 768; Information Sciences
-Institute, August 1980.
-.LP
-[8] Reynolds, J. & Postel, J.; "Assigned Numbers", RFC 923; Information
-Sciences Institute, October 1984.
diff --git a/lib/librpc/doc/rpcgen.ms b/lib/librpc/doc/rpcgen.ms
deleted file mode 100644
index b4e50e5..0000000
--- a/lib/librpc/doc/rpcgen.ms
+++ /dev/null
@@ -1,1299 +0,0 @@
-.\"
-.\" Must use -- tbl -- for this one
-.\"
-.\" @(#)rpcgen.ms 2.2 88/08/04 4.0 RPCSRC
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH '\fBrpcgen\fP Programming Guide''Page %'
-.EH 'Page %''\fBrpcgen\fP Programming Guide'
-.if \\n%=1 .bp
-.SH
-\&\fBrpcgen\fP Programming Guide
-.NH 0
-\&The \fBrpcgen\fP Protocol Compiler
-.IX rpcgen "" \fIrpcgen\fP "" PAGE MAJOR
-.LP
-.IX RPC "" "" \fIrpcgen\fP
-The details of programming applications to use Remote Procedure Calls
-can be overwhelming. Perhaps most daunting is the writing of the XDR
-routines necessary to convert procedure arguments and results into
-their network format and vice-versa.
-.LP
-Fortunately,
-.I rpcgen(1)
-exists to help programmers write RPC applications simply and directly.
-.I rpcgen
-does most of the dirty work, allowing programmers to debug
-the main features of their application, instead of requiring them to
-spend most of their time debugging their network interface code.
-.LP
-.I rpcgen
-is a compiler. It accepts a remote program interface definition written
-in a language, called RPC Language, which is similar to C. It produces a C
-language output which includes stub versions of the client routines, a
-server skeleton, XDR filter routines for both parameters and results, and a
-header file that contains common definitions. The client stubs interface
-with the RPC library and effectively hide the network from their callers.
-The server stub similarly hides the network from the server procedures that
-are to be invoked by remote clients.
-.I rpcgen 's
-output files can be compiled and linked in the usual way. The developer
-writes server procedures\(emin any language that observes Sun calling
-conventions\(emand links them with the server skeleton produced by
-.I rpcgen
-to get an executable server program. To use a remote program, a programmer
-writes an ordinary main program that makes local procedure calls to the
-client stubs produced by
-.I rpcgen .
-Linking this program with
-.I rpcgen 's
-stubs creates an executable program. (At present the main program must be
-written in C).
-.I rpcgen
-options can be used to suppress stub generation and to specify the transport
-to be used by the server stub.
-.LP
-Like all compilers,
-.I rpcgen
-reduces development time
-that would otherwise be spent coding and debugging low-level routines.
-All compilers, including
-.I rpcgen ,
-do this at a small cost in efficiency
-and flexibility. However, many compilers allow escape hatches for
-programmers to mix low-level code with high-level code.
-.I rpcgen
-is no exception. In speed-critical applications, hand-written routines
-can be linked with the
-.I rpcgen
-output without any difficulty. Also, one may proceed by using
-.I rpcgen
-output as a starting point, and then rewriting it as necessary.
-(If you need a discussion of RPC programming without
-.I rpcgen ,
-see the
-.I "Remote Procedure Call Programming Guide)\.
-.NH 1
-\&Converting Local Procedures into Remote Procedures
-.IX rpcgen "local procedures" \fIrpcgen\fP
-.IX rpcgen "remote procedures" \fIrpcgen\fP
-.LP
-Assume an application that runs on a single machine, one which we want
-to convert to run over the network. Here we will demonstrate such a
-conversion by way of a simple example\(ema program that prints a
-message to the console:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * printmsg.c: print a message on the console
- */
-.ft CW
-#include <stdio.h>
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char *message;
-
- if (argc < 2) {
- fprintf(stderr, "usage: %s <message>\en", argv[0]);
- exit(1);
- }
- message = argv[1];
-
- if (!printmessage(message)) {
- fprintf(stderr, "%s: couldn't print your message\en",
- argv[0]);
- exit(1);
- }
- printf("Message Delivered!\en");
- exit(0);
-}
-.ft I
-/*
- * Print a message to the console.
- * Return a boolean indicating whether the message was actually printed.
- */
-.ft CW
-printmessage(msg)
- char *msg;
-{
- FILE *f;
-
- f = fopen("/dev/console", "w");
- if (f == NULL) {
- return (0);
- }
- fprintf(f, "%s\en", msg);
- fclose(f);
- return(1);
-}
-.DE
-.LP
-And then, of course:
-.ie t .DS
-.el .DS L
-.ft CW
-example% \fBcc printmsg.c -o printmsg\fP
-example% \fBprintmsg "Hello, there."\fP
-Message delivered!
-example%
-.DE
-.LP
-If
-.I printmessage()
-was turned into a remote procedure,
-then it could be called from anywhere in the network.
-Ideally, one would just like to stick a keyword like
-.I remote
-in front of a
-procedure to turn it into a remote procedure. Unfortunately,
-we have to live within the constraints of the C language, since
-it existed long before RPC did. But even without language
-support, it's not very difficult to make a procedure remote.
-.LP
-In general, it's necessary to figure out what the types are for
-all procedure inputs and outputs. In this case, we have a
-procedure
-.I printmessage()
-which takes a string as input, and returns an integer
-as output. Knowing this, we can write a protocol specification in RPC
-language that describes the remote version of
-.I printmessage ().
-Here it is:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * msg.x: Remote message printing protocol
- */
-.ft CW
-
-program MESSAGEPROG {
- version MESSAGEVERS {
- int PRINTMESSAGE(string) = 1;
- } = 1;
-} = 99;
-.DE
-.LP
-Remote procedures are part of remote programs, so we actually declared
-an entire remote program here which contains the single procedure
-.I PRINTMESSAGE .
-This procedure was declared to be in version 1 of the
-remote program. No null procedure (procedure 0) is necessary because
-.I rpcgen
-generates it automatically.
-.LP
-Notice that everything is declared with all capital letters. This is
-not required, but is a good convention to follow.
-.LP
-Notice also that the argument type is \*Qstring\*U and not \*Qchar *\*U. This
-is because a \*Qchar *\*U in C is ambiguous. Programmers usually intend it
-to mean a null-terminated string of characters, but it could also
-represent a pointer to a single character or a pointer to an array of
-characters. In RPC language, a null-terminated string is
-unambiguously called a \*Qstring\*U.
-.LP
-There are just two more things to write. First, there is the remote
-procedure itself. Here's the definition of a remote procedure
-to implement the
-.I PRINTMESSAGE
-procedure we declared above:
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * msg_proc.c: implementation of the remote procedure "printmessage"
- */
-.ft CW
-
-#include <stdio.h>
-#include <rpc/rpc.h> /* \fIalways needed\fP */
-#include "msg.h" /* \fIneed this too: msg.h will be generated by rpcgen\fP */
-
-.ft I
-/*
- * Remote verson of "printmessage"
- */
-.ft CW
-int *
-printmessage_1(msg)
- char **msg;
-{
- static int result; /* \fImust be static!\fP */
- FILE *f;
-
- f = fopen("/dev/console", "w");
- if (f == NULL) {
- result = 0;
- return (&result);
- }
- fprintf(f, "%s\en", *msg);
- fclose(f);
- result = 1;
- return (&result);
-}
-.vs
-.DE
-.LP
-Notice here that the declaration of the remote procedure
-.I printmessage_1()
-differs from that of the local procedure
-.I printmessage()
-in three ways:
-.IP 1.
-It takes a pointer to a string instead of a string itself. This
-is true of all remote procedures: they always take pointers to their
-arguments rather than the arguments themselves.
-.IP 2.
-It returns a pointer to an integer instead of an integer itself. This is
-also generally true of remote procedures: they always return a pointer
-to their results.
-.IP 3.
-It has an \*Q_1\*U appended to its name. In general, all remote
-procedures called by
-.I rpcgen
-are named by the following rule: the name in the program definition
-(here
-.I PRINTMESSAGE )
-is converted to all
-lower-case letters, an underbar (\*Q_\*U) is appended to it, and
-finally the version number (here 1) is appended.
-.LP
-The last thing to do is declare the main client program that will call
-the remote procedure. Here it is:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * rprintmsg.c: remote version of "printmsg.c"
- */
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h> /* \fIalways needed\fP */
-#include "msg.h" /* \fIneed this too: msg.h will be generated by rpcgen\fP */
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- CLIENT *cl;
- int *result;
- char *server;
- char *message;
-
- if (argc < 3) {
- fprintf(stderr, "usage: %s host message\en", argv[0]);
- exit(1);
- }
-
-.ft I
- /*
- * Save values of command line arguments
- */
-.ft CW
- server = argv[1];
- message = argv[2];
-
-.ft I
- /*
- * Create client "handle" used for calling \fIMESSAGEPROG\fP on the
- * server designated on the command line. We tell the RPC package
- * to use the "tcp" protocol when contacting the server.
- */
-.ft CW
- cl = clnt_create(server, MESSAGEPROG, MESSAGEVERS, "tcp");
- if (cl == NULL) {
-.ft I
- /*
- * Couldn't establish connection with server.
- * Print error message and die.
- */
-.ft CW
- clnt_pcreateerror(server);
- exit(1);
- }
-
-.ft I
- /*
- * Call the remote procedure "printmessage" on the server
- */
-.ft CW
- result = printmessage_1(&message, cl);
- if (result == NULL) {
-.ft I
- /*
- * An error occurred while calling the server.
- * Print error message and die.
- */
-.ft CW
- clnt_perror(cl, server);
- exit(1);
- }
-
-.ft I
- /*
- * Okay, we successfully called the remote procedure.
- */
-.ft CW
- if (*result == 0) {
-.ft I
- /*
- * Server was unable to print our message.
- * Print error message and die.
- */
-.ft CW
- fprintf(stderr, "%s: %s couldn't print your message\en",
- argv[0], server);
- exit(1);
- }
-
-.ft I
- /*
- * The message got printed on the server's console
- */
-.ft CW
- printf("Message delivered to %s!\en", server);
-}
-.DE
-There are two things to note here:
-.IP 1.
-.IX "client handle, used by rpcgen" "" "client handle, used by \fIrpcgen\fP"
-First a client \*Qhandle\*U is created using the RPC library routine
-.I clnt_create ().
-This client handle will be passed to the stub routines
-which call the remote procedure.
-.IP 2.
-The remote procedure
-.I printmessage_1()
-is called exactly the same way as it is declared in
-.I msg_proc.c
-except for the inserted client handle as the first argument.
-.LP
-Here's how to put all of the pieces together:
-.ie t .DS
-.el .DS L
-.ft CW
-example% \fBrpcgen msg.x\fP
-example% \fBcc rprintmsg.c msg_clnt.c -o rprintmsg\fP
-example% \fBcc msg_proc.c msg_svc.c -o msg_server\fP
-.DE
-Two programs were compiled here: the client program
-.I rprintmsg
-and the server program
-.I msg_server .
-Before doing this though,
-.I rpcgen
-was used to fill in the missing pieces.
-.LP
-Here is what
-.I rpcgen
-did with the input file
-.I msg.x :
-.IP 1.
-It created a header file called
-.I msg.h
-that contained
-.I #define 's
-for
-.I MESSAGEPROG ,
-.I MESSAGEVERS
-and
-.I PRINTMESSAGE
-for use in the other modules.
-.IP 2.
-It created client \*Qstub\*U routines in the
-.I msg_clnt.c
-file. In this case there is only one, the
-.I printmessage_1()
-that was referred to from the
-.I printmsg
-client program. The name of the output file for
-client stub routines is always formed in this way: if the name of the
-input file is
-.I FOO.x ,
-the client stubs output file is called
-.I FOO_clnt.c .
-.IP 3.
-It created the server program which calls
-.I printmessage_1()
-in
-.I msg_proc.c .
-This server program is named
-.I msg_svc.c .
-The rule for naming the server output file is similar to the
-previous one: for an input file called
-.I FOO.x ,
-the output server file is named
-.I FOO_svc.c .
-.LP
-Now we're ready to have some fun. First, copy the server to a
-remote machine and run it. For this example, the
-machine is called \*Qmoon\*U. Server processes are run in the
-background, because they never exit.
-.ie t .DS
-.el .DS L
-.ft CW
-moon% \fBmsg_server &\fP
-.DE
-Then on our local machine (\*Qsun\*U) we can print a message on \*Qmoon\*Us
-console.
-.ie t .DS
-.el .DS L
-.ft CW
-sun% \fBprintmsg moon "Hello, moon."\fP
-.DE
-The message will get printed to \*Qmoon\*Us console. You can print a
-message on anybody's console (including your own) with this program if
-you are able to copy the server to their machine and run it.
-.NH 1
-\&Generating XDR Routines
-.IX RPC "generating XDR routines"
-.LP
-The previous example only demonstrated the automatic generation of
-client and server RPC code.
-.I rpcgen
-may also be used to generate XDR routines, that is, the routines
-necessary to convert local data
-structures into network format and vice-versa. This example presents
-a complete RPC service\(ema remote directory listing service, which uses
-.I rpcgen
-not only to generate stub routines, but also to generate the XDR
-routines. Here is the protocol description file:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * dir.x: Remote directory listing protocol
- */
-.ft CW
-const MAXNAMELEN = 255; /* \fImaximum length of a directory entry\fP */
-
-typedef string nametype<MAXNAMELEN>; /* \fIa directory entry\fP */
-
-typedef struct namenode *namelist; /* \fIa link in the listing\fP */
-
-.ft I
-/*
- * A node in the directory listing
- */
-.ft CW
-struct namenode {
- nametype name; /* \fIname of directory entry\fP */
- namelist next; /* \fInext entry\fP */
-};
-
-.ft I
-/*
- * The result of a READDIR operation.
- */
-.ft CW
-union readdir_res switch (int errno) {
-case 0:
- namelist list; /* \fIno error: return directory listing\fP */
-default:
- void; /* \fIerror occurred: nothing else to return\fP */
-};
-
-.ft I
-/*
- * The directory program definition
- */
-.ft CW
-program DIRPROG {
- version DIRVERS {
- readdir_res
- READDIR(nametype) = 1;
- } = 1;
-} = 76;
-.DE
-.SH
-Note:
-.I
-Types (like
-.I readdir_res
-in the example above) can be defined using
-the \*Qstruct\*U, \*Qunion\*U and \*Qenum\*U keywords, but those keywords
-should not be used in subsequent declarations of variables of those types.
-For example, if you define a union \*Qfoo\*U, you should declare using
-only \*Qfoo\*U and not \*Qunion foo\*U. In fact,
-.I rpcgen
-compiles
-RPC unions into C structures and it is an error to declare them using the
-\*Qunion\*U keyword.
-.LP
-Running
-.I rpcgen
-on
-.I dir.x
-creates four output files. Three are the same as before: header file,
-client stub routines and server skeleton. The fourth are the XDR routines
-necessary for converting the data types we declared into XDR format and
-vice-versa. These are output in the file
-.I dir_xdr.c .
-.LP
-Here is the implementation of the
-.I READDIR
-procedure.
-.ie t .DS
-.el .DS L
-.vs 11
-.ft I
-/*
- * dir_proc.c: remote readdir implementation
- */
-.ft CW
-#include <rpc/rpc.h>
-#include <sys/dir.h>
-#include "dir.h"
-
-extern int errno;
-extern char *malloc();
-extern char *strdup();
-
-readdir_res *
-readdir_1(dirname)
- nametype *dirname;
-{
- DIR *dirp;
- struct direct *d;
- namelist nl;
- namelist *nlp;
- static readdir_res res; /* \fImust be static\fP! */
-
-.ft I
- /*
- * Open directory
- */
-.ft CW
- dirp = opendir(*dirname);
- if (dirp == NULL) {
- res.errno = errno;
- return (&res);
- }
-
-.ft I
- /*
- * Free previous result
- */
-.ft CW
- xdr_free(xdr_readdir_res, &res);
-
-.ft I
- /*
- * Collect directory entries.
- * Memory allocated here will be freed by \fIxdr_free\fP
- * next time \fIreaddir_1\fP is called
- */
-.ft CW
- nlp = &res.readdir_res_u.list;
- while (d = readdir(dirp)) {
- nl = *nlp = (namenode *) malloc(sizeof(namenode));
- nl->name = strdup(d->d_name);
- nlp = &nl->next;
- }
- *nlp = NULL;
-
-.ft I
- /*
- * Return the result
- */
-.ft CW
- res.errno = 0;
- closedir(dirp);
- return (&res);
-}
-.vs
-.DE
-Finally, there is the client side program to call the server:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * rls.c: Remote directory listing client
- */
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h> /* \fIalways need this\fP */
-#include "dir.h" /* \fIwill be generated by rpcgen\fI */
-
-extern int errno;
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- CLIENT *cl;
- char *server;
- char *dir;
- readdir_res *result;
- namelist nl;
-
-
- if (argc != 3) {
- fprintf(stderr, "usage: %s host directory\en",
- argv[0]);
- exit(1);
- }
-
-.ft I
- /*
- * Remember what our command line arguments refer to
- */
-.ft CW
- server = argv[1];
- dir = argv[2];
-
-.ft I
- /*
- * Create client "handle" used for calling \fIMESSAGEPROG\fP on the
- * server designated on the command line. We tell the RPC package
- * to use the "tcp" protocol when contacting the server.
- */
-.ft CW
- cl = clnt_create(server, DIRPROG, DIRVERS, "tcp");
- if (cl == NULL) {
-.ft I
- /*
- * Couldn't establish connection with server.
- * Print error message and die.
- */
-.ft CW
- clnt_pcreateerror(server);
- exit(1);
- }
-
-.ft I
- /*
- * Call the remote procedure \fIreaddir\fP on the server
- */
-.ft CW
- result = readdir_1(&dir, cl);
- if (result == NULL) {
-.ft I
- /*
- * An error occurred while calling the server.
- * Print error message and die.
- */
-.ft CW
- clnt_perror(cl, server);
- exit(1);
- }
-
-.ft I
- /*
- * Okay, we successfully called the remote procedure.
- */
-.ft CW
- if (result->errno != 0) {
-.ft I
- /*
- * A remote system error occurred.
- * Print error message and die.
- */
-.ft CW
- errno = result->errno;
- perror(dir);
- exit(1);
- }
-
-.ft I
- /*
- * Successfully got a directory listing.
- * Print it out.
- */
-.ft CW
- for (nl = result->readdir_res_u.list; nl != NULL;
- nl = nl->next) {
- printf("%s\en", nl->name);
- }
- exit(0);
-}
-.DE
-Compile everything, and run.
-.DS
-.ft CW
-sun% \fBrpcgen dir.x\fP
-sun% \fBcc rls.c dir_clnt.c dir_xdr.c -o rls\fP
-sun% \fBcc dir_svc.c dir_proc.c dir_xdr.c -o dir_svc\fP
-
-sun% \fBdir_svc &\fP
-
-moon% \fBrls sun /usr/pub\fP
-\&.
-\&..
-ascii
-eqnchar
-greek
-kbd
-marg8
-tabclr
-tabs
-tabs4
-moon%
-.DE
-.LP
-.IX "debugging with rpcgen" "" "debugging with \fIrpcgen\fP"
-A final note about
-.I rpcgen :
-The client program and the server procedure can be tested together
-as a single program by simply linking them with each other rather
-than with the client and server stubs. The procedure calls will be
-executed as ordinary local procedure calls and the program can be
-debugged with a local debugger such as
-.I dbx .
-When the program is working, the client program can be linked to
-the client stub produced by
-.I rpcgen
-and the server procedures can be linked to the server stub produced
-by
-.I rpcgen .
-.SH
-.I NOTE :
-\fIIf you do this, you may want to comment out calls to RPC library
-routines, and have client-side routines call server routines
-directly.\fP
-.LP
-.NH 1
-\&The C-Preprocessor
-.IX rpcgen "C-preprocessor" \fIrpcgen\fP
-.LP
-The C-preprocessor is run on all input files before they are
-compiled, so all the preprocessor directives are legal within a \*Q.x\*U
-file. Four symbols may be defined, depending upon which output file is
-getting generated. The symbols are:
-.TS
-box tab (&);
-lfI lfI
-lfL l .
-Symbol&Usage
-_
-RPC_HDR&for header-file output
-RPC_XDR&for XDR routine output
-RPC_SVC&for server-skeleton output
-RPC_CLNT&for client stub output
-.TE
-.LP
-Also,
-.I rpcgen
-does a little preprocessing of its own. Any line that
-begins with a percent sign is passed directly into the output file,
-without any interpretation of the line. Here is a simple example that
-demonstrates the preprocessing features.
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * time.x: Remote time protocol
- */
-.ft CW
-program TIMEPROG {
- version TIMEVERS {
- unsigned int TIMEGET(void) = 1;
- } = 1;
-} = 44;
-
-#ifdef RPC_SVC
-%int *
-%timeget_1()
-%{
-% static int thetime;
-%
-% thetime = time(0);
-% return (&thetime);
-%}
-#endif
-.DE
-The '%' feature is not generally recommended, as there is no guarantee
-that the compiler will stick the output where you intended.
-.NH 1
-\&\fBrpcgen\fP Programming Notes
-.IX rpcgen "other operations" \fIrpcgen\fP
-.sp
-.NH 2
-\&Timeout Changes
-.IX rpcgen "timeout changes" \fIrpcgen\fP
-.LP
-RPC sets a default timeout of 25 seconds for RPC calls when
-.I clnt_create()
-is used. This timeout may be changed using
-.I clnt_control()
-Here is a small code fragment to demonstrate use of
-.I clnt_control ():
-.ID
-struct timeval tv;
-CLIENT *cl;
-.sp .5
-cl = clnt_create("somehost", SOMEPROG, SOMEVERS, "tcp");
-if (cl == NULL) {
- exit(1);
-}
-tv.tv_sec = 60; /* \fIchange timeout to 1 minute\fP */
-tv.tv_usec = 0;
-clnt_control(cl, CLSET_TIMEOUT, &tv);
-.DE
-.NH 2
-\&Handling Broadcast on the Server Side
-.IX "broadcast RPC"
-.IX rpcgen "broadcast RPC" \fIrpcgen\fP
-.LP
-When a procedure is known to be called via broadcast RPC,
-it is usually wise for the server to not reply unless it can provide
-some useful information to the client. This prevents the network
-from getting flooded by useless replies.
-.LP
-To prevent the server from replying, a remote procedure can
-return NULL as its result, and the server code generated by
-.I rpcgen
-will detect this and not send out a reply.
-.LP
-Here is an example of a procedure that replies only if it
-thinks it is an NFS server:
-.ID
-void *
-reply_if_nfsserver()
-{
- char notnull; /* \fIjust here so we can use its address\fP */
-.sp .5
- if (access("/etc/exports", F_OK) < 0) {
- return (NULL); /* \fIprevent RPC from replying\fP */
- }
-.ft I
- /*
- * return non-null pointer so RPC will send out a reply
- */
-.ft L
- return ((void *)&notnull);
-}
-.DE
-Note that if procedure returns type \*Qvoid *\*U, they must return a non-NULL
-pointer if they want RPC to reply for them.
-.NH 2
-\&Other Information Passed to Server Procedures
-.LP
-Server procedures will often want to know more about an RPC call
-than just its arguments. For example, getting authentication information
-is important to procedures that want to implement some level of security.
-This extra information is actually supplied to the server procedure as a
-second argument. Here is an example to demonstrate its use. What we've
-done here is rewrite the previous
-.I printmessage_1()
-procedure to only allow root users to print a message to the console.
-.ID
-int *
-printmessage_1(msg, rq)
- char **msg;
- struct svc_req *rq;
-{
- static in result; /* \fIMust be static\fP */
- FILE *f;
- struct suthunix_parms *aup;
-.sp .5
- aup = (struct authunix_parms *)rq->rq_clntcred;
- if (aup->aup_uid != 0) {
- result = 0;
- return (&result);
- }
-.sp
-.ft I
- /*
- * Same code as before.
- */
-.ft L
-}
-.DE
-.NH 1
-\&RPC Language
-.IX RPCL
-.IX rpcgen "RPC Language" \fIrpcgen\fP
-.LP
-RPC language is an extension of XDR language. The sole extension is
-the addition of the
-.I program
-type. For a complete description of the XDR language syntax, see the
-.I "External Data Representation Standard: Protocol Specification"
-chapter. For a description of the RPC extensions to the XDR language,
-see the
-.I "Remote Procedure Calls: Protocol Specification"
-chapter.
-.LP
-However, XDR language is so close to C that if you know C, you know most
-of it already. We describe here the syntax of the RPC language,
-showing a few examples along the way. We also show how the various
-RPC and XDR type definitions get compiled into C type definitions in
-the output header file.
-.KS
-.NH 2
-Definitions
-\&
-.IX rpcgen definitions \fIrpcgen\fP
-.LP
-An RPC language file consists of a series of definitions.
-.DS L
-.ft CW
- definition-list:
- definition ";"
- definition ";" definition-list
-.DE
-.KE
-It recognizes five types of definitions.
-.DS L
-.ft CW
- definition:
- enum-definition
- struct-definition
- union-definition
- typedef-definition
- const-definition
- program-definition
-.DE
-.NH 2
-Structures
-\&
-.IX rpcgen structures \fIrpcgen\fP
-.LP
-An XDR struct is declared almost exactly like its C counterpart. It
-looks like the following:
-.DS L
-.ft CW
- struct-definition:
- "struct" struct-ident "{"
- declaration-list
- "}"
-
- declaration-list:
- declaration ";"
- declaration ";" declaration-list
-.DE
-As an example, here is an XDR structure to a two-dimensional
-coordinate, and the C structure that it gets compiled into in the
-output header file.
-.DS
-.ft CW
- struct coord { struct coord {
- int x; --> int x;
- int y; int y;
- }; };
- typedef struct coord coord;
-.DE
-The output is identical to the input, except for the added
-.I typedef
-at the end of the output. This allows one to use \*Qcoord\*U instead of
-\*Qstruct coord\*U when declaring items.
-.NH 2
-Unions
-\&
-.IX rpcgen unions \fIrpcgen\fP
-.LP
-XDR unions are discriminated unions, and look quite different from C
-unions. They are more analogous to Pascal variant records than they
-are to C unions.
-.DS L
-.ft CW
- union-definition:
- "union" union-ident "switch" "(" declaration ")" "{"
- case-list
- "}"
-
- case-list:
- "case" value ":" declaration ";"
- "default" ":" declaration ";"
- "case" value ":" declaration ";" case-list
-.DE
-Here is an example of a type that might be returned as the result of a
-\*Qread data\*U operation. If there is no error, return a block of data.
-Otherwise, don't return anything.
-.DS L
-.ft CW
- union read_result switch (int errno) {
- case 0:
- opaque data[1024];
- default:
- void;
- };
-.DE
-It gets compiled into the following:
-.DS L
-.ft CW
- struct read_result {
- int errno;
- union {
- char data[1024];
- } read_result_u;
- };
- typedef struct read_result read_result;
-.DE
-Notice that the union component of the output struct has the name as
-the type name, except for the trailing \*Q_u\*U.
-.NH 2
-Enumerations
-\&
-.IX rpcgen enumerations \fIrpcgen\fP
-.LP
-XDR enumerations have the same syntax as C enumerations.
-.DS L
-.ft CW
- enum-definition:
- "enum" enum-ident "{"
- enum-value-list
- "}"
-
- enum-value-list:
- enum-value
- enum-value "," enum-value-list
-
- enum-value:
- enum-value-ident
- enum-value-ident "=" value
-.DE
-Here is a short example of an XDR enum, and the C enum that it gets
-compiled into.
-.DS L
-.ft CW
- enum colortype { enum colortype {
- RED = 0, RED = 0,
- GREEN = 1, --> GREEN = 1,
- BLUE = 2 BLUE = 2,
- }; };
- typedef enum colortype colortype;
-.DE
-.NH 2
-Typedef
-\&
-.IX rpcgen typedef \fIrpcgen\fP
-.LP
-XDR typedefs have the same syntax as C typedefs.
-.DS L
-.ft CW
- typedef-definition:
- "typedef" declaration
-.DE
-Here is an example that defines a
-.I fname_type
-used for declaring
-file name strings that have a maximum length of 255 characters.
-.DS L
-.ft CW
-typedef string fname_type<255>; --> typedef char *fname_type;
-.DE
-.NH 2
-Constants
-\&
-.IX rpcgen constants \fIrpcgen\fP
-.LP
-XDR constants symbolic constants that may be used wherever a
-integer constant is used, for example, in array size specifications.
-.DS L
-.ft CW
- const-definition:
- "const" const-ident "=" integer
-.DE
-For example, the following defines a constant
-.I DOZEN
-equal to 12.
-.DS L
-.ft CW
- const DOZEN = 12; --> #define DOZEN 12
-.DE
-.NH 2
-Programs
-\&
-.IX rpcgen programs \fIrpcgen\fP
-.LP
-RPC programs are declared using the following syntax:
-.DS L
-.ft CW
- program-definition:
- "program" program-ident "{"
- version-list
- "}" "=" value
-
- version-list:
- version ";"
- version ";" version-list
-
- version:
- "version" version-ident "{"
- procedure-list
- "}" "=" value
-
- procedure-list:
- procedure ";"
- procedure ";" procedure-list
-
- procedure:
- type-ident procedure-ident "(" type-ident ")" "=" value
-.DE
-For example, here is the time protocol, revisited:
-.ie t .DS
-.el .DS L
-.ft I
-/*
- * time.x: Get or set the time. Time is represented as number of seconds
- * since 0:00, January 1, 1970.
- */
-.ft CW
-program TIMEPROG {
- version TIMEVERS {
- unsigned int TIMEGET(void) = 1;
- void TIMESET(unsigned) = 2;
- } = 1;
-} = 44;
-.DE
-This file compiles into #defines in the output header file:
-.ie t .DS
-.el .DS L
-.ft CW
-#define TIMEPROG 44
-#define TIMEVERS 1
-#define TIMEGET 1
-#define TIMESET 2
-.DE
-.NH 2
-Declarations
-\&
-.IX rpcgen declarations \fIrpcgen\fP
-.LP
-In XDR, there are only four kinds of declarations.
-.DS L
-.ft CW
- declaration:
- simple-declaration
- fixed-array-declaration
- variable-array-declaration
- pointer-declaration
-.DE
-\fB1) Simple declarations\fP are just like simple C declarations.
-.DS L
-.ft CW
- simple-declaration:
- type-ident variable-ident
-.DE
-Example:
-.DS L
-.ft CW
- colortype color; --> colortype color;
-.DE
-\fB2) Fixed-length Array Declarations\fP are just like C array declarations:
-.DS L
-.ft CW
- fixed-array-declaration:
- type-ident variable-ident "[" value "]"
-.DE
-Example:
-.DS L
-.ft CW
- colortype palette[8]; --> colortype palette[8];
-.DE
-\fB3) Variable-Length Array Declarations\fP have no explicit syntax
-in C, so XDR invents its own using angle-brackets.
-.DS L
-.ft CW
-variable-array-declaration:
- type-ident variable-ident "<" value ">"
- type-ident variable-ident "<" ">"
-.DE
-The maximum size is specified between the angle brackets. The size may
-be omitted, indicating that the array may be of any size.
-.DS L
-.ft CW
- int heights<12>; /* \fIat most 12 items\fP */
- int widths<>; /* \fIany number of items\fP */
-.DE
-Since variable-length arrays have no explicit syntax in C, these
-declarations are actually compiled into \*Qstruct\*Us. For example, the
-\*Qheights\*U declaration gets compiled into the following struct:
-.DS L
-.ft CW
- struct {
- u_int heights_len; /* \fI# of items in array\fP */
- int *heights_val; /* \fIpointer to array\fP */
- } heights;
-.DE
-Note that the number of items in the array is stored in the \*Q_len\*U
-component and the pointer to the array is stored in the \*Q_val\*U
-component. The first part of each of these component's names is the
-same as the name of the declared XDR variable.
-.LP
-\fB4) Pointer Declarations\fP are made in
-XDR exactly as they are in C. You can't
-really send pointers over the network, but you can use XDR pointers
-for sending recursive data types such as lists and trees. The type is
-actually called \*Qoptional-data\*U, not \*Qpointer\*U, in XDR language.
-.DS L
-.ft CW
- pointer-declaration:
- type-ident "*" variable-ident
-.DE
-Example:
-.DS L
-.ft CW
- listitem *next; --> listitem *next;
-.DE
-.NH 2
-\&Special Cases
-.IX rpcgen "special cases" \fIrpcgen\fP
-.LP
-There are a few exceptions to the rules described above.
-.LP
-.B Booleans:
-C has no built-in boolean type. However, the RPC library does a
-boolean type called
-.I bool_t
-that is either
-.I TRUE
-or
-.I FALSE .
-Things declared as type
-.I bool
-in XDR language are compiled into
-.I bool_t
-in the output header file.
-.LP
-Example:
-.DS L
-.ft CW
- bool married; --> bool_t married;
-.DE
-.B Strings:
-C has no built-in string type, but instead uses the null-terminated
-\*Qchar *\*U convention. In XDR language, strings are declared using the
-\*Qstring\*U keyword, and compiled into \*Qchar *\*Us in the output header
-file. The maximum size contained in the angle brackets specifies the
-maximum number of characters allowed in the strings (not counting the
-.I NULL
-character). The maximum size may be left off, indicating a string
-of arbitrary length.
-.LP
-Examples:
-.DS L
-.ft CW
- string name<32>; --> char *name;
- string longname<>; --> char *longname;
-.DE
-.B "Opaque Data:"
-Opaque data is used in RPC and XDR to describe untyped data, that is,
-just sequences of arbitrary bytes. It may be declared either as a
-fixed or variable length array.
-.DS L
-Examples:
-.ft CW
- opaque diskblock[512]; --> char diskblock[512];
-
- opaque filedata<1024>; --> struct {
- u_int filedata_len;
- char *filedata_val;
- } filedata;
-.DE
-.B Voids:
-In a void declaration, the variable is not named. The declaration is
-just \*Qvoid\*U and nothing else. Void declarations can only occur in two
-places: union definitions and program definitions (as the argument or
-result of a remote procedure).
diff --git a/lib/librpc/doc/xdr.nts.ms b/lib/librpc/doc/xdr.nts.ms
deleted file mode 100644
index 6c2d482..0000000
--- a/lib/librpc/doc/xdr.nts.ms
+++ /dev/null
@@ -1,1966 +0,0 @@
-.\"
-.\" Must use -- eqn -- with this one
-.\"
-.\" @(#)xdr.nts.ms 2.2 88/08/05 4.0 RPCSRC
-.EQ
-delim $$
-.EN
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH 'External Data Representation: Sun Technical Notes''Page %'
-.EH 'Page %''External Data Representation: Sun Technical Notes'
-.if \\n%=1 .bp
-.SH
-\&External Data Representation: Sun Technical Notes
-.IX XDR "Sun technical notes"
-.LP
-This chapter contains technical notes on Sun's implementation of the
-External Data Representation (XDR) standard, a set of library routines
-that allow a C programmer to describe arbitrary data structures in a
-machinex-independent fashion.
-For a formal specification of the XDR
-standard, see the
-.I "External Data Representation Standard: Protocol Specification".
-XDR is the backbone of Sun's Remote Procedure Call package, in the
-sense that data for remote procedure calls is transmitted using the
-standard. XDR library routines should be used to transmit data
-that is accessed (read or written) by more than one type of machine.\**
-.FS
-.IX XDR "system routines"
-For a compete specification of the system External Data Representation
-routines, see the
-.I xdr(3N)
-manual page.
-.FE
-.LP
-This chapter contains a short tutorial overview of the XDR library
-routines, a guide to accessing currently available XDR streams, and
-information on defining new streams and data types. XDR was designed
-to work across different languages, operating systems, and machine
-architectures. Most users (particularly RPC users) will only need
-the information in the
-.I "Number Filters",
-.I "Floating Point Filters",
-and
-.I "Enumeration Filters"
-sections.
-Programmers wishing to implement RPC and XDR on new machines
-will be interested in the rest of the chapter, as well as the
-.I "External Data Representaiton Standard: Protocol Specification",
-which will be their primary reference.
-.SH
-Note:
-.I
-.I rpcgen
-can be used to write XDR routines even in cases where no RPC calls are
-being made.
-.LP
-On Sun systems,
-C programs that want to use XDR routines
-must include the file
-.I <rpc/rpc.h> ,
-which contains all the necessary interfaces to the XDR system.
-Since the C library
-.I libc.a
-contains all the XDR routines,
-compile as normal.
-.DS
-example% \fBcc\0\fIprogram\fP.c\fI
-.DE
-.ne 3i
-.NH 0
-\&Justification
-.IX XDR justification
-.LP
-Consider the following two programs,
-.I writer :
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-.sp.5
-main() /* \fIwriter.c\fP */
-{
- long i;
-.sp.5
- for (i = 0; i < 8; i++) {
- if (fwrite((char *)&i, sizeof(i), 1, stdout) != 1) {
- fprintf(stderr, "failed!\en");
- exit(1);
- }
- }
- exit(0);
-}
-.DE
-and
-.I reader :
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-.sp.5
-main() /* \fIreader.c\fP */
-{
- long i, j;
-.sp.5
- for (j = 0; j < 8; j++) {
- if (fread((char *)&i, sizeof (i), 1, stdin) != 1) {
- fprintf(stderr, "failed!\en");
- exit(1);
- }
- printf("%ld ", i);
- }
- printf("\en");
- exit(0);
-}
-.DE
-The two programs appear to be portable, because (a) they pass
-.I lint
-checking, and (b) they exhibit the same behavior when executed
-on two different hardware architectures, a Sun and a VAX.
-.LP
-Piping the output of the
-.I writer
-program to the
-.I reader
-program gives identical results on a Sun or a VAX.
-.DS
-.ft CW
-sun% \fBwriter | reader\fP
-0 1 2 3 4 5 6 7
-sun%
-
-
-vax% \fBwriter | reader\fP
-0 1 2 3 4 5 6 7
-vax%
-.DE
-With the advent of local area networks and 4.2BSD came the concept
-of \*Qnetwork pipes\*U \(em a process produces data on one machine,
-and a second process consumes data on another machine.
-A network pipe can be constructed with
-.I writer
-and
-.I reader .
-Here are the results if the first produces data on a Sun,
-and the second consumes data on a VAX.
-.DS
-.ft CW
-sun% \fBwriter | rsh vax reader\fP
-0 16777216 33554432 50331648 67108864 83886080 100663296
-117440512
-sun%
-.DE
-Identical results can be obtained by executing
-.I writer
-on the VAX and
-.I reader
-on the Sun. These results occur because the byte ordering
-of long integers differs between the VAX and the Sun,
-even though word size is the same.
-Note that $16777216$ is $2 sup 24$ \(em
-when four bytes are reversed, the 1 winds up in the 24th bit.
-.LP
-Whenever data is shared by two or more machine types, there is
-a need for portable data. Programs can be made data-portable by
-replacing the
-.I read()
-and
-.I write()
-calls with calls to an XDR library routine
-.I xdr_long() ,
-a filter that knows the standard representation
-of a long integer in its external form.
-Here are the revised versions of
-.I writer :
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h> /* \fIxdr is a sub-library of rpc\fP */
-.sp.5
-main() /* \fIwriter.c\fP */
-{
- XDR xdrs;
- long i;
-.sp.5
- xdrstdio_create(&xdrs, stdout, XDR_ENCODE);
- for (i = 0; i < 8; i++) {
- if (!xdr_long(&xdrs, &i)) {
- fprintf(stderr, "failed!\en");
- exit(1);
- }
- }
- exit(0);
-}
-.DE
-and
-.I reader :
-.ie t .DS
-.el .DS L
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h> /* \fIxdr is a sub-library of rpc\fP */
-.sp.5
-main() /* \fIreader.c\fP */
-{
- XDR xdrs;
- long i, j;
-.sp.5
- xdrstdio_create(&xdrs, stdin, XDR_DECODE);
- for (j = 0; j < 8; j++) {
- if (!xdr_long(&xdrs, &i)) {
- fprintf(stderr, "failed!\en");
- exit(1);
- }
- printf("%ld ", i);
- }
- printf("\en");
- exit(0);
-}
-.DE
-The new programs were executed on a Sun,
-on a VAX, and from a Sun to a VAX;
-the results are shown below.
-.DS
-.ft CW
-sun% \fBwriter | reader\fP
-0 1 2 3 4 5 6 7
-sun%
-
-vax% \fBwriter | reader\fP
-0 1 2 3 4 5 6 7
-vax%
-
-sun% \fBwriter | rsh vax reader\fP
-0 1 2 3 4 5 6 7
-sun%
-.DE
-.SH
-Note:
-.I
-.IX XDR "portable data"
-Integers are just the tip of the portable-data iceberg. Arbitrary
-data structures present portability problems, particularly with
-respect to alignment and pointers. Alignment on word boundaries
-may cause the size of a structure to vary from machine to machine.
-And pointers, which are very convenient to use, have no meaning
-outside the machine where they are defined.
-.LP
-.NH 1
-\&A Canonical Standard
-.IX XDR "canonical standard"
-.LP
-XDR's approach to standardizing data representations is
-.I canonical .
-That is, XDR defines a single byte order (Big Endian), a single
-floating-point representation (IEEE), and so on. Any program running on
-any machine can use XDR to create portable data by translating its
-local representation to the XDR standard representations; similarly, any
-program running on any machine can read portable data by translating the
-XDR standard representaions to its local equivalents. The single standard
-completely decouples programs that create or send portable data from those
-that use or receive portable data. The advent of a new machine or a new
-language has no effect upon the community of existing portable data creators
-and users. A new machine joins this community by being \*Qtaught\*U how to
-convert the standard representations and its local representations; the
-local representations of other machines are irrelevant. Conversely, to
-existing programs running on other machines, the local representations of
-the new machine are also irrelevant; such programs can immediately read
-portable data produced by the new machine because such data conforms to the
-canonical standards that they already understand.
-.LP
-There are strong precedents for XDR's canonical approach. For example,
-TCP/IP, UDP/IP, XNS, Ethernet, and, indeed, all protocols below layer five
-of the ISO model, are canonical protocols. The advantage of any canonical
-approach is simplicity; in the case of XDR, a single set of conversion
-routines is written once and is never touched again. The canonical approach
-has a disadvantage, but it is unimportant in real-world data transfer
-applications. Suppose two Little-Endian machines are transferring integers
-according to the XDR standard. The sending machine converts the integers
-from Little-Endian byte order to XDR (Big-Endian) byte order; the receiving
-machine performs the reverse conversion. Because both machines observe the
-same byte order, their conversions are unnecessary. The point, however, is
-not necessity, but cost as compared to the alternative.
-.LP
-The time spent converting to and from a canonical representation is
-insignificant, especially in networking applications. Most of the time
-required to prepare a data structure for transfer is not spent in conversion
-but in traversing the elements of the data structure. To transmit a tree,
-for example, each leaf must be visited and each element in a leaf record must
-be copied to a buffer and aligned there; storage for the leaf may have to be
-deallocated as well. Similarly, to receive a tree, storage must be
-allocated for each leaf, data must be moved from the buffer to the leaf and
-properly aligned, and pointers must be constructed to link the leaves
-together. Every machine pays the cost of traversing and copying data
-structures whether or not conversion is required. In networking
-applications, communications overhead\(emthe time required to move the data
-down through the sender's protocol layers, across the network and up through
-the receiver's protocol layers\(emdwarfs conversion overhead.
-.NH 1
-\&The XDR Library
-.IX "XDR" "library"
-.LP
-The XDR library not only solves data portability problems, it also
-allows you to write and read arbitrary C constructs in a consistent,
-specified, well-documented manner. Thus, it can make sense to use the
-library even when the data is not shared among machines on a network.
-.LP
-The XDR library has filter routines for
-strings (null-terminated arrays of bytes),
-structures, unions, and arrays, to name a few.
-Using more primitive routines,
-you can write your own specific XDR routines
-to describe arbitrary data structures,
-including elements of arrays, arms of unions,
-or objects pointed at from other structures.
-The structures themselves may contain arrays of arbitrary elements,
-or pointers to other structures.
-.LP
-Let's examine the two programs more closely.
-There is a family of XDR stream creation routines
-in which each member treats the stream of bits differently.
-In our example, data is manipulated using standard I/O routines,
-so we use
-.I xdrstdio_create ().
-.IX xdrstdio_create() "" "\fIxdrstdio_create()\fP"
-The parameters to XDR stream creation routines
-vary according to their function.
-In our example,
-.I xdrstdio_create()
-takes a pointer to an XDR structure that it initializes,
-a pointer to a
-.I FILE
-that the input or output is performed on, and the operation.
-The operation may be
-.I XDR_ENCODE
-for serializing in the
-.I writer
-program, or
-.I XDR_DECODE
-for deserializing in the
-.I reader
-program.
-.LP
-Note: RPC users never need to create XDR streams;
-the RPC system itself creates these streams,
-which are then passed to the users.
-.LP
-The
-.I xdr_long()
-.IX xdr_long() "" "\fIxdr_long()\fP"
-primitive is characteristic of most XDR library
-primitives and all client XDR routines.
-First, the routine returns
-.I FALSE
-(0) if it fails, and
-.I TRUE
-(1) if it succeeds.
-Second, for each data type,
-.I xxx ,
-there is an associated XDR routine of the form:
-.DS
-.ft CW
-xdr_xxx(xdrs, xp)
- XDR *xdrs;
- xxx *xp;
-{
-}
-.DE
-In our case,
-.I xxx
-is long, and the corresponding XDR routine is
-a primitive,
-.I xdr_long() .
-The client could also define an arbitrary structure
-.I xxx
-in which case the client would also supply the routine
-.I xdr_xxx (),
-describing each field by calling XDR routines
-of the appropriate type.
-In all cases the first parameter,
-.I xdrs
-can be treated as an opaque handle,
-and passed to the primitive routines.
-.LP
-XDR routines are direction independent;
-that is, the same routines are called to serialize or deserialize data.
-This feature is critical to software engineering of portable data.
-The idea is to call the same routine for either operation \(em
-this almost guarantees that serialized data can also be deserialized.
-One routine is used by both producer and consumer of networked data.
-This is implemented by always passing the address
-of an object rather than the object itself \(em
-only in the case of deserialization is the object modified.
-This feature is not shown in our trivial example,
-but its value becomes obvious when nontrivial data structures
-are passed among machines.
-If needed, the user can obtain the
-direction of the XDR operation.
-See the
-.I "XDR Operation Directions"
-section below for details.
-.LP
-Let's look at a slightly more complicated example.
-Assume that a person's gross assets and liabilities
-are to be exchanged among processes.
-Also assume that these values are important enough
-to warrant their own data type:
-.ie t .DS
-.el .DS L
-.ft CW
-struct gnumbers {
- long g_assets;
- long g_liabilities;
-};
-.DE
-The corresponding XDR routine describing this structure would be:
-.ie t .DS
-.el .DS L
-.ft CW
-bool_t /* \fITRUE is success, FALSE is failure\fP */
-xdr_gnumbers(xdrs, gp)
- XDR *xdrs;
- struct gnumbers *gp;
-{
- if (xdr_long(xdrs, &gp->g_assets) &&
- xdr_long(xdrs, &gp->g_liabilities))
- return(TRUE);
- return(FALSE);
-}
-.DE
-Note that the parameter
-.I xdrs
-is never inspected or modified;
-it is only passed on to the subcomponent routines.
-It is imperative to inspect the return value of each XDR routine call,
-and to give up immediately and return
-.I FALSE
-if the subroutine fails.
-.LP
-This example also shows that the type
-.I bool_t
-is declared as an integer whose only values are
-.I TRUE
-(1) and
-.I FALSE
-(0). This document uses the following definitions:
-.ie t .DS
-.el .DS L
-.ft CW
-#define bool_t int
-#define TRUE 1
-#define FALSE 0
-.DE
-.LP
-Keeping these conventions in mind,
-.I xdr_gnumbers()
-can be rewritten as follows:
-.ie t .DS
-.el .DS L
-.ft CW
-xdr_gnumbers(xdrs, gp)
- XDR *xdrs;
- struct gnumbers *gp;
-{
- return(xdr_long(xdrs, &gp->g_assets) &&
- xdr_long(xdrs, &gp->g_liabilities));
-}
-.DE
-This document uses both coding styles.
-.NH 1
-\&XDR Library Primitives
-.IX "library primitives for XDR"
-.IX XDR "library primitives"
-.LP
-This section gives a synopsis of each XDR primitive.
-It starts with basic data types and moves on to constructed data types.
-Finally, XDR utilities are discussed.
-The interface to these primitives
-and utilities is defined in the include file
-.I <rpc/xdr.h> ,
-automatically included by
-.I <rpc/rpc.h> .
-.NH 2
-\&Number Filters
-.IX "XDR library" "number filters"
-.LP
-The XDR library provides primitives to translate between numbers
-and their corresponding external representations.
-Primitives cover the set of numbers in:
-.DS
-.ft CW
-[signed, unsigned] * [short, int, long]
-.DE
-.ne 2i
-Specifically, the eight primitives are:
-.DS
-.ft CW
-bool_t xdr_char(xdrs, cp)
- XDR *xdrs;
- char *cp;
-.sp.5
-bool_t xdr_u_char(xdrs, ucp)
- XDR *xdrs;
- unsigned char *ucp;
-.sp.5
-bool_t xdr_int(xdrs, ip)
- XDR *xdrs;
- int *ip;
-.sp.5
-bool_t xdr_u_int(xdrs, up)
- XDR *xdrs;
- unsigned *up;
-.sp.5
-bool_t xdr_long(xdrs, lip)
- XDR *xdrs;
- long *lip;
-.sp.5
-bool_t xdr_u_long(xdrs, lup)
- XDR *xdrs;
- u_long *lup;
-.sp.5
-bool_t xdr_short(xdrs, sip)
- XDR *xdrs;
- short *sip;
-.sp.5
-bool_t xdr_u_short(xdrs, sup)
- XDR *xdrs;
- u_short *sup;
-.DE
-The first parameter,
-.I xdrs ,
-is an XDR stream handle.
-The second parameter is the address of the number
-that provides data to the stream or receives data from it.
-All routines return
-.I TRUE
-if they complete successfully, and
-.I FALSE
-otherwise.
-.NH 2
-\&Floating Point Filters
-.IX "XDR library" "floating point filters"
-.LP
-The XDR library also provides primitive routines
-for C's floating point types:
-.DS
-.ft CW
-bool_t xdr_float(xdrs, fp)
- XDR *xdrs;
- float *fp;
-.sp.5
-bool_t xdr_double(xdrs, dp)
- XDR *xdrs;
- double *dp;
-.DE
-The first parameter,
-.I xdrs
-is an XDR stream handle.
-The second parameter is the address
-of the floating point number that provides data to the stream
-or receives data from it.
-Both routines return
-.I TRUE
-if they complete successfully, and
-.I FALSE
-otherwise.
-.LP
-Note: Since the numbers are represented in IEEE floating point,
-routines may fail when decoding a valid IEEE representation
-into a machine-specific representation, or vice-versa.
-.NH 2
-\&Enumeration Filters
-.IX "XDR library" "enumeration filters"
-.LP
-The XDR library provides a primitive for generic enumerations.
-The primitive assumes that a C
-.I enum
-has the same representation inside the machine as a C integer.
-The boolean type is an important instance of the
-.I enum .
-The external representation of a boolean is always
-.I TRUE
-(1) or
-.I FALSE
-(0).
-.DS
-.ft CW
-#define bool_t int
-#define FALSE 0
-#define TRUE 1
-.sp.5
-#define enum_t int
-.sp.5
-bool_t xdr_enum(xdrs, ep)
- XDR *xdrs;
- enum_t *ep;
-.sp.5
-bool_t xdr_bool(xdrs, bp)
- XDR *xdrs;
- bool_t *bp;
-.DE
-The second parameters
-.I ep
-and
-.I bp
-are addresses of the associated type that provides data to, or
-receives data from, the stream
-.I xdrs .
-.NH 2
-\&No Data
-.IX "XDR library" "no data"
-.LP
-Occasionally, an XDR routine must be supplied to the RPC system,
-even when no data is passed or required.
-The library provides such a routine:
-.DS
-.ft CW
-bool_t xdr_void(); /* \fIalways returns TRUE\fP */
-.DE
-.NH 2
-\&Constructed Data Type Filters
-.IX "XDR library" "constructed data type filters"
-.LP
-Constructed or compound data type primitives
-require more parameters and perform more complicated functions
-then the primitives discussed above.
-This section includes primitives for
-strings, arrays, unions, and pointers to structures.
-.LP
-Constructed data type primitives may use memory management.
-In many cases, memory is allocated when deserializing data with
-.I XDR_DECODE
-Therefore, the XDR package must provide means to deallocate memory.
-This is done by an XDR operation,
-.I XDR_FREE
-To review, the three XDR directional operations are
-.I XDR_ENCODE ,
-.I XDR_DECODE
-and
-.I XDR_FREE .
-.NH 3
-\&Strings
-.IX "XDR library" "strings"
-.LP
-In C, a string is defined as a sequence of bytes
-terminated by a null byte,
-which is not considered when calculating string length.
-However, when a string is passed or manipulated,
-a pointer to it is employed.
-Therefore, the XDR library defines a string to be a
-.I "char *"
-and not a sequence of characters.
-The external representation of a string is drastically different
-from its internal representation.
-Externally, strings are represented as
-sequences of ASCII characters,
-while internally, they are represented with character pointers.
-Conversion between the two representations
-is accomplished with the routine
-.I xdr_string ():
-.IX xdr_string() "" \fIxdr_string()\fP
-.DS
-.ft CW
-bool_t xdr_string(xdrs, sp, maxlength)
- XDR *xdrs;
- char **sp;
- u_int maxlength;
-.DE
-The first parameter
-.I xdrs
-is the XDR stream handle.
-The second parameter
-.I sp
-is a pointer to a string (type
-.I "char **" .
-The third parameter
-.I maxlength
-specifies the maximum number of bytes allowed during encoding or decoding.
-its value is usually specified by a protocol. For example, a protocol
-specification may say that a file name may be no longer than 255 characters.
-.LP
-The routine returns
-.I FALSE
-if the number of characters exceeds
-.I maxlength ,
-and
-.I TRUE
-if it doesn't.
-.SH
-Keep
-.I maxlength
-small. If it is too big you can blow the heap, since
-.I xdr_string()
-will call
-.I malloc()
-for space.
-.LP
-The behavior of
-.I xdr_string()
-.IX xdr_string() "" \fIxdr_string()\fP
-is similar to the behavior of other routines
-discussed in this section. The direction
-.I XDR_ENCODE
-is easiest to understand. The parameter
-.I sp
-points to a string of a certain length;
-if the string does not exceed
-.I maxlength ,
-the bytes are serialized.
-.LP
-The effect of deserializing a string is subtle.
-First the length of the incoming string is determined;
-it must not exceed
-.I maxlength .
-Next
-.I sp
-is dereferenced; if the the value is
-.I NULL ,
-then a string of the appropriate length is allocated and
-.I *sp
-is set to this string.
-If the original value of
-.I *sp
-is non-null, then the XDR package assumes
-that a target area has been allocated,
-which can hold strings no longer than
-.I maxlength .
-In either case, the string is decoded into the target area.
-The routine then appends a null character to the string.
-.LP
-In the
-.I XDR_FREE
-operation, the string is obtained by dereferencing
-.I sp .
-If the string is not
-.I NULL ,
-it is freed and
-.I *sp
-is set to
-.I NULL .
-In this operation,
-.I xdr_string()
-ignores the
-.I maxlength
-parameter.
-.NH 3
-\&Byte Arrays
-.IX "XDR library" "byte arrays"
-.LP
-Often variable-length arrays of bytes are preferable to strings.
-Byte arrays differ from strings in the following three ways:
-1) the length of the array (the byte count) is explicitly
-located in an unsigned integer,
-2) the byte sequence is not terminated by a null character, and
-3) the external representation of the bytes is the same as their
-internal representation.
-The primitive
-.I xdr_bytes()
-.IX xdr_bytes() "" \fIxdr_bytes()\fP
-converts between the internal and external
-representations of byte arrays:
-.DS
-.ft CW
-bool_t xdr_bytes(xdrs, bpp, lp, maxlength)
- XDR *xdrs;
- char **bpp;
- u_int *lp;
- u_int maxlength;
-.DE
-The usage of the first, second and fourth parameters
-are identical to the first, second and third parameters of
-.I xdr_string (),
-respectively.
-The length of the byte area is obtained by dereferencing
-.I lp
-when serializing;
-.I *lp
-is set to the byte length when deserializing.
-.NH 3
-\&Arrays
-.IX "XDR library" "arrays"
-.LP
-The XDR library package provides a primitive
-for handling arrays of arbitrary elements.
-The
-.I xdr_bytes()
-routine treats a subset of generic arrays,
-in which the size of array elements is known to be 1,
-and the external description of each element is built-in.
-The generic array primitive,
-.I xdr_array() ,
-.IX xdr_array() "" \fIxdr_array()\fP
-requires parameters identical to those of
-.I xdr_bytes()
-plus two more:
-the size of array elements,
-and an XDR routine to handle each of the elements.
-This routine is called to encode or decode
-each element of the array.
-.DS
-.ft CW
-bool_t
-xdr_array(xdrs, ap, lp, maxlength, elementsiz, xdr_element)
- XDR *xdrs;
- char **ap;
- u_int *lp;
- u_int maxlength;
- u_int elementsiz;
- bool_t (*xdr_element)();
-.DE
-The parameter
-.I ap
-is the address of the pointer to the array.
-If
-.I *ap
-is
-.I NULL
-when the array is being deserialized,
-XDR allocates an array of the appropriate size and sets
-.I *ap
-to that array.
-The element count of the array is obtained from
-.I *lp
-when the array is serialized;
-.I *lp
-is set to the array length when the array is deserialized.
-The parameter
-.I maxlength
-is the maximum number of elements that the array is allowed to have;
-.I elementsiz
-is the byte size of each element of the array
-(the C function
-.I sizeof()
-can be used to obtain this value).
-The
-.I xdr_element()
-.IX xdr_element() "" \fIxdr_element()\fP
-routine is called to serialize, deserialize, or free
-each element of the array.
-.br
-.LP
-Before defining more constructed data types, it is appropriate to
-present three examples.
-.LP
-.I "Example A:"
-.br
-A user on a networked machine can be identified by
-(a) the machine name, such as
-.I krypton :
-see the
-.I gethostname
-man page; (b) the user's UID: see the
-.I geteuid
-man page; and (c) the group numbers to which the user belongs:
-see the
-.I getgroups
-man page. A structure with this information and its associated
-XDR routine could be coded like this:
-.ie t .DS
-.el .DS L
-.ft CW
-struct netuser {
- char *nu_machinename;
- int nu_uid;
- u_int nu_glen;
- int *nu_gids;
-};
-#define NLEN 255 /* \fImachine names < 256 chars\fP */
-#define NGRPS 20 /* \fIuser can't be in > 20 groups\fP */
-.sp.5
-bool_t
-xdr_netuser(xdrs, nup)
- XDR *xdrs;
- struct netuser *nup;
-{
- return(xdr_string(xdrs, &nup->nu_machinename, NLEN) &&
- xdr_int(xdrs, &nup->nu_uid) &&
- xdr_array(xdrs, &nup->nu_gids, &nup->nu_glen,
- NGRPS, sizeof (int), xdr_int));
-}
-.DE
-.LP
-.I "Example B:"
-.br
-A party of network users could be implemented
-as an array of
-.I netuser
-structure.
-The declaration and its associated XDR routines
-are as follows:
-.ie t .DS
-.el .DS L
-.ft CW
-struct party {
- u_int p_len;
- struct netuser *p_nusers;
-};
-#define PLEN 500 /* \fImax number of users in a party\fP */
-.sp.5
-bool_t
-xdr_party(xdrs, pp)
- XDR *xdrs;
- struct party *pp;
-{
- return(xdr_array(xdrs, &pp->p_nusers, &pp->p_len, PLEN,
- sizeof (struct netuser), xdr_netuser));
-}
-.DE
-.LP
-.I "Example C:"
-.br
-The well-known parameters to
-.I main ,
-.I argc
-and
-.I argv
-can be combined into a structure.
-An array of these structures can make up a history of commands.
-The declarations and XDR routines might look like:
-.ie t .DS
-.el .DS L
-.ft CW
-struct cmd {
- u_int c_argc;
- char **c_argv;
-};
-#define ALEN 1000 /* \fIargs cannot be > 1000 chars\fP */
-#define NARGC 100 /* \fIcommands cannot have > 100 args\fP */
-
-struct history {
- u_int h_len;
- struct cmd *h_cmds;
-};
-#define NCMDS 75 /* \fIhistory is no more than 75 commands\fP */
-
-bool_t
-xdr_wrap_string(xdrs, sp)
- XDR *xdrs;
- char **sp;
-{
- return(xdr_string(xdrs, sp, ALEN));
-}
-.DE
-.ie t .DS
-.el .DS L
-.ft CW
-bool_t
-xdr_cmd(xdrs, cp)
- XDR *xdrs;
- struct cmd *cp;
-{
- return(xdr_array(xdrs, &cp->c_argv, &cp->c_argc, NARGC,
- sizeof (char *), xdr_wrap_string));
-}
-.DE
-.ie t .DS
-.el .DS L
-.ft CW
-bool_t
-xdr_history(xdrs, hp)
- XDR *xdrs;
- struct history *hp;
-{
- return(xdr_array(xdrs, &hp->h_cmds, &hp->h_len, NCMDS,
- sizeof (struct cmd), xdr_cmd));
-}
-.DE
-The most confusing part of this example is that the routine
-.I xdr_wrap_string()
-is needed to package the
-.I xdr_string()
-routine, because the implementation of
-.I xdr_array()
-only passes two parameters to the array element description routine;
-.I xdr_wrap_string()
-supplies the third parameter to
-.I xdr_string ().
-.LP
-By now the recursive nature of the XDR library should be obvious.
-Let's continue with more constructed data types.
-.NH 3
-\&Opaque Data
-.IX "XDR library" "opaque data"
-.LP
-In some protocols, handles are passed from a server to client.
-The client passes the handle back to the server at some later time.
-Handles are never inspected by clients;
-they are obtained and submitted.
-That is to say, handles are opaque.
-The
-.I xdr_opaque()
-.IX xdr_opaque() "" \fIxdr_opaque()\fP
-primitive is used for describing fixed sized, opaque bytes.
-.DS
-.ft CW
-bool_t xdr_opaque(xdrs, p, len)
- XDR *xdrs;
- char *p;
- u_int len;
-.DE
-The parameter
-.I p
-is the location of the bytes;
-.I len
-is the number of bytes in the opaque object.
-By definition, the actual data
-contained in the opaque object are not machine portable.
-.NH 3
-\&Fixed Sized Arrays
-.IX "XDR library" "fixed sized arrays"
-.LP
-The XDR library provides a primitive,
-.I xdr_vector (),
-for fixed-length arrays.
-.ie t .DS
-.el .DS L
-.ft CW
-#define NLEN 255 /* \fImachine names must be < 256 chars\fP */
-#define NGRPS 20 /* \fIuser belongs to exactly 20 groups\fP */
-.sp.5
-struct netuser {
- char *nu_machinename;
- int nu_uid;
- int nu_gids[NGRPS];
-};
-.sp.5
-bool_t
-xdr_netuser(xdrs, nup)
- XDR *xdrs;
- struct netuser *nup;
-{
- int i;
-.sp.5
- if (!xdr_string(xdrs, &nup->nu_machinename, NLEN))
- return(FALSE);
- if (!xdr_int(xdrs, &nup->nu_uid))
- return(FALSE);
- if (!xdr_vector(xdrs, nup->nu_gids, NGRPS, sizeof(int),
- xdr_int)) {
- return(FALSE);
- }
- return(TRUE);
-}
-.DE
-.NH 3
-\&Discriminated Unions
-.IX "XDR library" "discriminated unions"
-.LP
-The XDR library supports discriminated unions.
-A discriminated union is a C union and an
-.I enum_t
-value that selects an \*Qarm\*U of the union.
-.DS
-.ft CW
-struct xdr_discrim {
- enum_t value;
- bool_t (*proc)();
-};
-.sp.5
-bool_t xdr_union(xdrs, dscmp, unp, arms, defaultarm)
- XDR *xdrs;
- enum_t *dscmp;
- char *unp;
- struct xdr_discrim *arms;
- bool_t (*defaultarm)(); /* \fImay equal NULL\fP */
-.DE
-First the routine translates the discriminant of the union located at
-.I *dscmp .
-The discriminant is always an
-.I enum_t .
-Next the union located at
-.I *unp
-is translated.
-The parameter
-.I arms
-is a pointer to an array of
-.I xdr_discrim
-structures.
-Each structure contains an ordered pair of
-.I [value,proc] .
-If the union's discriminant is equal to the associated
-.I value ,
-then the
-.I proc
-is called to translate the union.
-The end of the
-.I xdr_discrim
-structure array is denoted by a routine of value
-.I NULL
-(0). If the discriminant is not found in the
-.I arms
-array, then the
-.I defaultarm
-procedure is called if it is non-null;
-otherwise the routine returns
-.I FALSE .
-.LP
-.I "Example D:"
-Suppose the type of a union may be integer,
-character pointer (a string), or a
-.I gnumbers
-structure.
-Also, assume the union and its current type
-are declared in a structure.
-The declaration is:
-.ie t .DS
-.el .DS L
-.ft CW
-enum utype { INTEGER=1, STRING=2, GNUMBERS=3 };
-.sp.5
-struct u_tag {
- enum utype utype; /* \fIthe union's discriminant\fP */
- union {
- int ival;
- char *pval;
- struct gnumbers gn;
- } uval;
-};
-.DE
-The following constructs and XDR procedure (de)serialize
-the discriminated union:
-.ie t .DS
-.el .DS L
-.ft CW
-struct xdr_discrim u_tag_arms[4] = {
- { INTEGER, xdr_int },
- { GNUMBERS, xdr_gnumbers }
- { STRING, xdr_wrap_string },
- { __dontcare__, NULL }
- /* \fIalways terminate arms with a NULL xdr_proc\fP */
-}
-.sp.5
-bool_t
-xdr_u_tag(xdrs, utp)
- XDR *xdrs;
- struct u_tag *utp;
-{
- return(xdr_union(xdrs, &utp->utype, &utp->uval,
- u_tag_arms, NULL));
-}
-.DE
-The routine
-.I xdr_gnumbers()
-was presented above in
-.I "The XDR Library"
-section.
-.I xdr_wrap_string()
-was presented in example C.
-The default
-.I arm
-parameter to
-.I xdr_union()
-(the last parameter) is
-.I NULL
-in this example. Therefore the value of the union's discriminant
-may legally take on only values listed in the
-.I u_tag_arms
-array. This example also demonstrates that
-the elements of the arm's array do not need to be sorted.
-.LP
-It is worth pointing out that the values of the discriminant
-may be sparse, though in this example they are not.
-It is always good
-practice to assign explicitly integer values to each element of the
-discriminant's type.
-This practice both documents the external
-representation of the discriminant and guarantees that different
-C compilers emit identical discriminant values.
-.LP
-Exercise: Implement
-.I xdr_union()
-using the other primitives in this section.
-.NH 3
-\&Pointers
-.IX "XDR library" "pointers"
-.LP
-In C it is often convenient to put pointers
-to another structure within a structure.
-The
-.I xdr_reference()
-.IX xdr_reference() "" \fIxdr_reference()\fP
-primitive makes it easy to serialize, deserialize, and free
-these referenced structures.
-.DS
-.ft CW
-bool_t xdr_reference(xdrs, pp, size, proc)
- XDR *xdrs;
- char **pp;
- u_int ssize;
- bool_t (*proc)();
-.DE
-.LP
-Parameter
-.I pp
-is the address of
-the pointer to the structure;
-parameter
-.I ssize
-is the size in bytes of the structure (use the C function
-.I sizeof()
-to obtain this value); and
-.I proc
-is the XDR routine that describes the structure.
-When decoding data, storage is allocated if
-.I *pp
-is
-.I NULL .
-.LP
-There is no need for a primitive
-.I xdr_struct()
-to describe structures within structures,
-because pointers are always sufficient.
-.LP
-Exercise: Implement
-.I xdr_reference()
-using
-.I xdr_array ().
-Warning:
-.I xdr_reference()
-and
-.I xdr_array()
-are NOT interchangeable external representations of data.
-.LP
-.I "Example E:"
-Suppose there is a structure containing a person's name
-and a pointer to a
-.I gnumbers
-structure containing the person's gross assets and liabilities.
-The construct is:
-.DS
-.ft CW
-struct pgn {
- char *name;
- struct gnumbers *gnp;
-};
-.DE
-The corresponding XDR routine for this structure is:
-.DS
-.ft CW
-bool_t
-xdr_pgn(xdrs, pp)
- XDR *xdrs;
- struct pgn *pp;
-{
- if (xdr_string(xdrs, &pp->name, NLEN) &&
- xdr_reference(xdrs, &pp->gnp,
- sizeof(struct gnumbers), xdr_gnumbers))
- return(TRUE);
- return(FALSE);
-}
-.DE
-.IX "pointer semantics and XDR"
-.I "Pointer Semantics and XDR"
-.LP
-In many applications, C programmers attach double meaning to
-the values of a pointer. Typically the value
-.I NULL
-(or zero) means data is not needed,
-yet some application-specific interpretation applies.
-In essence, the C programmer is encoding
-a discriminated union efficiently
-by overloading the interpretation of the value of a pointer.
-For instance, in example E a
-.I NULL
-pointer value for
-.I gnp
-could indicate that
-the person's assets and liabilities are unknown.
-That is, the pointer value encodes two things:
-whether or not the data is known;
-and if it is known, where it is located in memory.
-Linked lists are an extreme example of the use
-of application-specific pointer interpretation.
-.LP
-The primitive
-.I xdr_reference()
-.IX xdr_reference() "" \fIxdr_reference()\fP
-cannot and does not attach any special
-meaning to a null-value pointer during serialization.
-That is, passing an address of a pointer whose value is
-.I NULL
-to
-.I xdr_reference()
-when serialing data will most likely cause a memory fault and, on the UNIX
-system, a core dump.
-.LP
-.I xdr_pointer()
-correctly handles
-.I NULL
-pointers. For more information about its use, see
-the
-.I "Linked Lists"
-topics below.
-.LP
-.I Exercise:
-After reading the section on
-.I "Linked Lists" ,
-return here and extend example E so that
-it can correctly deal with
-.I NULL
-pointer values.
-.LP
-.I Exercise:
-Using the
-.I xdr_union (),
-.I xdr_reference()
-and
-.I xdr_void()
-primitives, implement a generic pointer handling primitive
-that implicitly deals with
-.I NULL
-pointers. That is, implement
-.I xdr_pointer ().
-.NH 2
-\&Non-filter Primitives
-.IX "XDR" "non-filter primitives"
-.LP
-XDR streams can be manipulated with
-the primitives discussed in this section.
-.DS
-.ft CW
-u_int xdr_getpos(xdrs)
- XDR *xdrs;
-.sp.5
-bool_t xdr_setpos(xdrs, pos)
- XDR *xdrs;
- u_int pos;
-.sp.5
-xdr_destroy(xdrs)
- XDR *xdrs;
-.DE
-The routine
-.I xdr_getpos()
-.IX xdr_getpos() "" \fIxdr_getpos()\fP
-returns an unsigned integer
-that describes the current position in the data stream.
-Warning: In some XDR streams, the returned value of
-.I xdr_getpos()
-is meaningless;
-the routine returns a \-1 in this case
-(though \-1 should be a legitimate value).
-.LP
-The routine
-.I xdr_setpos()
-.IX xdr_setpos() "" \fIxdr_setpos()\fP
-sets a stream position to
-.I pos .
-Warning: In some XDR streams, setting a position is impossible;
-in such cases,
-.I xdr_setpos()
-will return
-.I FALSE .
-This routine will also fail if the requested position is out-of-bounds.
-The definition of bounds varies from stream to stream.
-.LP
-The
-.I xdr_destroy()
-.IX xdr_destroy() "" \fIxdr_destroy()\fP
-primitive destroys the XDR stream.
-Usage of the stream
-after calling this routine is undefined.
-.NH 2
-\&XDR Operation Directions
-.IX XDR "operation directions"
-.IX "direction of XDR operations"
-.LP
-At times you may wish to optimize XDR routines by taking
-advantage of the direction of the operation \(em
-.I XDR_ENCODE
-.I XDR_DECODE
-or
-.I XDR_FREE
-The value
-.I xdrs->x_op
-always contains the direction of the XDR operation.
-Programmers are not encouraged to take advantage of this information.
-Therefore, no example is presented here. However, an example in the
-.I "Linked Lists"
-topic below, demonstrates the usefulness of the
-.I xdrs->x_op
-field.
-.NH 2
-\&XDR Stream Access
-.IX "XDR" "stream access"
-.LP
-An XDR stream is obtained by calling the appropriate creation routine.
-These creation routines take arguments that are tailored to the
-specific properties of the stream.
-.LP
-Streams currently exist for (de)serialization of data to or from
-standard I/O
-.I FILE
-streams, TCP/IP connections and UNIX files, and memory.
-.NH 3
-\&Standard I/O Streams
-.IX "XDR" "standard I/O streams"
-.LP
-XDR streams can be interfaced to standard I/O using the
-.I xdrstdio_create()
-.IX xdrstdio_create() "" \fIxdrstdio_create()\fP
-routine as follows:
-.DS
-.ft CW
-#include <stdio.h>
-#include <rpc/rpc.h> /* \fIxdr streams part of rpc\fP */
-.sp.5
-void
-xdrstdio_create(xdrs, fp, x_op)
- XDR *xdrs;
- FILE *fp;
- enum xdr_op x_op;
-.DE
-The routine
-.I xdrstdio_create()
-initializes an XDR stream pointed to by
-.I xdrs .
-The XDR stream interfaces to the standard I/O library.
-Parameter
-.I fp
-is an open file, and
-.I x_op
-is an XDR direction.
-.NH 3
-\&Memory Streams
-.IX "XDR" "memory streams"
-.LP
-Memory streams allow the streaming of data into or out of
-a specified area of memory:
-.DS
-.ft CW
-#include <rpc/rpc.h>
-.sp.5
-void
-xdrmem_create(xdrs, addr, len, x_op)
- XDR *xdrs;
- char *addr;
- u_int len;
- enum xdr_op x_op;
-.DE
-The routine
-.I xdrmem_create()
-.IX xdrmem_create() "" \fIxdrmem_create()\fP
-initializes an XDR stream in local memory.
-The memory is pointed to by parameter
-.I addr ;
-parameter
-.I len
-is the length in bytes of the memory.
-The parameters
-.I xdrs
-and
-.I x_op
-are identical to the corresponding parameters of
-.I xdrstdio_create ().
-Currently, the UDP/IP implementation of RPC uses
-.I xdrmem_create ().
-Complete call or result messages are built in memory before calling the
-.I sendto()
-system routine.
-.NH 3
-\&Record (TCP/IP) Streams
-.IX "XDR" "record (TCP/IP) streams"
-.LP
-A record stream is an XDR stream built on top of
-a record marking standard that is built on top of the
-UNIX file or 4.2 BSD connection interface.
-.DS
-.ft CW
-#include <rpc/rpc.h> /* \fIxdr streams part of rpc\fP */
-.sp.5
-xdrrec_create(xdrs,
- sendsize, recvsize, iohandle, readproc, writeproc)
- XDR *xdrs;
- u_int sendsize, recvsize;
- char *iohandle;
- int (*readproc)(), (*writeproc)();
-.DE
-The routine
-.I xdrrec_create()
-provides an XDR stream interface that allows for a bidirectional,
-arbitrarily long sequence of records.
-The contents of the records are meant to be data in XDR form.
-The stream's primary use is for interfacing RPC to TCP connections.
-However, it can be used to stream data into or out of normal
-UNIX files.
-.LP
-The parameter
-.I xdrs
-is similar to the corresponding parameter described above.
-The stream does its own data buffering similar to that of standard I/O.
-The parameters
-.I sendsize
-and
-.I recvsize
-determine the size in bytes of the output and input buffers, respectively;
-if their values are zero (0), then predetermined defaults are used.
-When a buffer needs to be filled or flushed, the routine
-.I readproc()
-or
-.I writeproc()
-is called, respectively.
-The usage and behavior of these
-routines are similar to the UNIX system calls
-.I read()
-and
-.I write ().
-However,
-the first parameter to each of these routines is the opaque parameter
-.I iohandle .
-The other two parameters
-.I buf ""
-and
-.I nbytes )
-and the results
-(byte count) are identical to the system routines.
-If
-.I xxx
-is
-.I readproc()
-or
-.I writeproc (),
-then it has the following form:
-.DS
-.ft CW
-.ft I
-/*
- * returns the actual number of bytes transferred.
- * -1 is an error
- */
-.ft CW
-int
-xxx(iohandle, buf, len)
- char *iohandle;
- char *buf;
- int nbytes;
-.DE
-The XDR stream provides means for delimiting records in the byte stream.
-The implementation details of delimiting records in a stream are
-discussed in the
-.I "Advanced Topics"
-topic below.
-The primitives that are specific to record streams are as follows:
-.DS
-.ft CW
-bool_t
-xdrrec_endofrecord(xdrs, flushnow)
- XDR *xdrs;
- bool_t flushnow;
-.sp.5
-bool_t
-xdrrec_skiprecord(xdrs)
- XDR *xdrs;
-.sp.5
-bool_t
-xdrrec_eof(xdrs)
- XDR *xdrs;
-.DE
-The routine
-.I xdrrec_endofrecord()
-.IX xdrrec_endofrecord() "" \fIxdrrec_endofrecord()\fP
-causes the current outgoing data to be marked as a record.
-If the parameter
-.I flushnow
-is
-.I TRUE ,
-then the stream's
-.I writeproc
-will be called; otherwise,
-.I writeproc
-will be called when the output buffer has been filled.
-.LP
-The routine
-.I xdrrec_skiprecord()
-.IX xdrrec_skiprecord() "" \fIxdrrec_skiprecord()\fP
-causes an input stream's position to be moved past
-the current record boundary and onto the
-beginning of the next record in the stream.
-.LP
-If there is no more data in the stream's input buffer,
-then the routine
-.I xdrrec_eof()
-.IX xdrrec_eof() "" \fIxdrrec_eof()\fP
-returns
-.I TRUE .
-That is not to say that there is no more data
-in the underlying file descriptor.
-.NH 2
-\&XDR Stream Implementation
-.IX "XDR" "stream implementation"
-.IX "stream implementation in XDR"
-.LP
-This section provides the abstract data types needed
-to implement new instances of XDR streams.
-.NH 3
-\&The XDR Object
-.IX "XDR" "object"
-.LP
-The following structure defines the interface to an XDR stream:
-.ie t .DS
-.el .DS L
-.ft CW
-enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 };
-.sp.5
-typedef struct {
- enum xdr_op x_op; /* \fIoperation; fast added param\fP */
- struct xdr_ops {
- bool_t (*x_getlong)(); /* \fIget long from stream\fP */
- bool_t (*x_putlong)(); /* \fIput long to stream\fP */
- bool_t (*x_getbytes)(); /* \fIget bytes from stream\fP */
- bool_t (*x_putbytes)(); /* \fIput bytes to stream\fP */
- u_int (*x_getpostn)(); /* \fIreturn stream offset\fP */
- bool_t (*x_setpostn)(); /* \fIreposition offset\fP */
- caddr_t (*x_inline)(); /* \fIptr to buffered data\fP */
- VOID (*x_destroy)(); /* \fIfree private area\fP */
- } *x_ops;
- caddr_t x_public; /* \fIusers' data\fP */
- caddr_t x_private; /* \fIpointer to private data\fP */
- caddr_t x_base; /* \fIprivate for position info\fP */
- int x_handy; /* \fIextra private word\fP */
-} XDR;
-.DE
-The
-.I x_op
-field is the current operation being performed on the stream.
-This field is important to the XDR primitives,
-but should not affect a stream's implementation.
-That is, a stream's implementation should not depend
-on this value.
-The fields
-.I x_private ,
-.I x_base ,
-and
-.I x_handy
-are private to the particular
-stream's implementation.
-The field
-.I x_public
-is for the XDR client and should never be used by
-the XDR stream implementations or the XDR primitives.
-.I x_getpostn() ,
-.I x_setpostn()
-and
-.I x_destroy()
-are macros for accessing operations. The operation
-.I x_inline()
-takes two parameters:
-an XDR *, and an unsigned integer, which is a byte count.
-The routine returns a pointer to a piece of
-the stream's internal buffer.
-The caller can then use the buffer segment for any purpose.
-From the stream's point of view, the bytes in the
-buffer segment have been consumed or put.
-The routine may return
-.I NULL
-if it cannot return a buffer segment of the requested size.
-(The
-.I x_inline()
-routine is for cycle squeezers.
-Use of the resulting buffer is not data-portable.
-Users are encouraged not to use this feature.)
-.LP
-The operations
-.I x_getbytes()
-and
-.I x_putbytes()
-blindly get and put sequences of bytes
-from or to the underlying stream;
-they return
-.I TRUE
-if they are successful, and
-.I FALSE
-otherwise. The routines have identical parameters (replace
-.I xxx ):
-.DS
-.ft CW
-bool_t
-xxxbytes(xdrs, buf, bytecount)
- XDR *xdrs;
- char *buf;
- u_int bytecount;
-.DE
-The operations
-.I x_getlong()
-and
-.I x_putlong()
-receive and put
-long numbers from and to the data stream.
-It is the responsibility of these routines
-to translate the numbers between the machine representation
-and the (standard) external representation.
-The UNIX primitives
-.I htonl()
-and
-.I ntohl()
-can be helpful in accomplishing this.
-The higher-level XDR implementation assumes that
-signed and unsigned long integers contain the same number of bits,
-and that nonnegative integers
-have the same bit representations as unsigned integers.
-The routines return
-.I TRUE
-if they succeed, and
-.I FALSE
-otherwise. They have identical parameters:
-.DS
-.ft CW
-bool_t
-xxxlong(xdrs, lp)
- XDR *xdrs;
- long *lp;
-.DE
-Implementors of new XDR streams must make an XDR structure
-(with new operation routines) available to clients,
-using some kind of create routine.
-.NH 1
-\&Advanced Topics
-.IX XDR "advanced topics"
-.LP
-This section describes techniques for passing data structures that
-are not covered in the preceding sections. Such structures include
-linked lists (of arbitrary lengths). Unlike the simpler examples
-covered in the earlier sections, the following examples are written
-using both the XDR C library routines and the XDR data description
-language.
-The
-.I "External Data Representation Standard: Protocol Specification"
-describes this
-language in complete detail.
-.NH 2
-\&Linked Lists
-.IX XDR "linked lists"
-.LP
-The last example in the
-.I Pointers
-topic earlier in this chapter
-presented a C data structure and its associated XDR
-routines for a individual's gross assets and liabilities.
-The example is duplicated below:
-.ie t .DS
-.el .DS L
-.ft CW
-struct gnumbers {
- long g_assets;
- long g_liabilities;
-};
-.sp.5
-bool_t
-xdr_gnumbers(xdrs, gp)
- XDR *xdrs;
- struct gnumbers *gp;
-{
- if (xdr_long(xdrs, &(gp->g_assets)))
- return(xdr_long(xdrs, &(gp->g_liabilities)));
- return(FALSE);
-}
-.DE
-.LP
-Now assume that we wish to implement a linked list of such information.
-A data structure could be constructed as follows:
-.ie t .DS
-.el .DS L
-.ft CW
-struct gnumbers_node {
- struct gnumbers gn_numbers;
- struct gnumbers_node *gn_next;
-};
-.sp .5
-typedef struct gnumbers_node *gnumbers_list;
-.DE
-.LP
-The head of the linked list can be thought of as the data object;
-that is, the head is not merely a convenient shorthand for a
-structure. Similarly the
-.I gn_next
-field is used to indicate whether or not the object has terminated.
-Unfortunately, if the object continues, the
-.I gn_next
-field is also the address of where it continues. The link addresses
-carry no useful information when the object is serialized.
-.LP
-The XDR data description of this linked list is described by the
-recursive declaration of
-.I gnumbers_list :
-.ie t .DS
-.el .DS L
-.ft CW
-struct gnumbers {
- int g_assets;
- int g_liabilities;
-};
-.sp .5
-struct gnumbers_node {
- gnumbers gn_numbers;
- gnumbers_node *gn_next;
-};
-.DE
-.LP
-In this description, the boolean indicates whether there is more data
-following it. If the boolean is
-.I FALSE ,
-then it is the last data field of the structure. If it is
-.I TRUE ,
-then it is followed by a gnumbers structure and (recursively) by a
-.I gnumbers_list .
-Note that the C declaration has no boolean explicitly declared in it
-(though the
-.I gn_next
-field implicitly carries the information), while the XDR data
-description has no pointer explicitly declared in it.
-.LP
-Hints for writing the XDR routines for a
-.I gnumbers_list
-follow easily from the XDR description above. Note how the primitive
-.I xdr_pointer()
-is used to implement the XDR union above.
-.ie t .DS
-.el .DS L
-.ft CW
-bool_t
-xdr_gnumbers_node(xdrs, gn)
- XDR *xdrs;
- gnumbers_node *gn;
-{
- return(xdr_gnumbers(xdrs, &gn->gn_numbers) &&
- xdr_gnumbers_list(xdrs, &gp->gn_next));
-}
-.sp .5
-bool_t
-xdr_gnumbers_list(xdrs, gnp)
- XDR *xdrs;
- gnumbers_list *gnp;
-{
- return(xdr_pointer(xdrs, gnp,
- sizeof(struct gnumbers_node),
- xdr_gnumbers_node));
-}
-.DE
-.LP
-The unfortunate side effect of XDR'ing a list with these routines
-is that the C stack grows linearly with respect to the number of
-node in the list. This is due to the recursion. The following
-routine collapses the above two mutually recursive into a single,
-non-recursive one.
-.ie t .DS
-.el .DS L
-.ft CW
-bool_t
-xdr_gnumbers_list(xdrs, gnp)
- XDR *xdrs;
- gnumbers_list *gnp;
-{
- bool_t more_data;
- gnumbers_list *nextp;
-.sp .5
- for (;;) {
- more_data = (*gnp != NULL);
- if (!xdr_bool(xdrs, &more_data)) {
- return(FALSE);
- }
- if (! more_data) {
- break;
- }
- if (xdrs->x_op == XDR_FREE) {
- nextp = &(*gnp)->gn_next;
- }
- if (!xdr_reference(xdrs, gnp,
- sizeof(struct gnumbers_node), xdr_gnumbers)) {
-
- return(FALSE);
- }
- gnp = (xdrs->x_op == XDR_FREE) ?
- nextp : &(*gnp)->gn_next;
- }
- *gnp = NULL;
- return(TRUE);
-}
-.DE
-.LP
-The first task is to find out whether there is more data or not,
-so that this boolean information can be serialized. Notice that
-this statement is unnecessary in the
-.I XDR_DECODE
-case, since the value of more_data is not known until we
-deserialize it in the next statement.
-.LP
-The next statement XDR's the more_data field of the XDR union.
-Then if there is truly no more data, we set this last pointer to
-.I NULL
-to indicate the end of the list, and return
-.I TRUE
-because we are done. Note that setting the pointer to
-.I NULL
-is only important in the
-.I XDR_DECODE
-case, since it is already
-.I NULL
-in the
-.I XDR_ENCODE
-and
-XDR_FREE
-cases.
-.LP
-Next, if the direction is
-.I XDR_FREE ,
-the value of
-.I nextp
-is set to indicate the location of the next pointer in the list.
-We do this now because we need to dereference gnp to find the
-location of the next item in the list, and after the next
-statement the storage pointed to by
-.I gnp
-will be freed up and no be longer valid. We can't do this for all
-directions though, because in the
-.I XDR_DECODE
-direction the value of
-.I gnp
-won't be set until the next statement.
-.LP
-Next, we XDR the data in the node using the primitive
-.I xdr_reference ().
-.I xdr_reference()
-is like
-.I xdr_pointer()
-which we used before, but it does not
-send over the boolean indicating whether there is more data.
-We use it instead of
-.I xdr_pointer()
-because we have already XDR'd this information ourselves. Notice
-that the xdr routine passed is not the same type as an element
-in the list. The routine passed is
-.I xdr_gnumbers (),
-for XDR'ing gnumbers, but each element in the list is actually of
-type
-.I gnumbers_node .
-We don't pass
-.I xdr_gnumbers_node()
-because it is recursive, and instead use
-.I xdr_gnumbers()
-which XDR's all of the non-recursive part. Note that this trick
-will work only if the
-.I gn_numbers
-field is the first item in each element, so that their addresses
-are identical when passed to
-.I xdr_reference ().
-.LP
-Finally, we update
-.I gnp
-to point to the next item in the list. If the direction is
-.I XDR_FREE ,
-we set it to the previously saved value, otherwise we can
-dereference
-.I gnp
-to get the proper value. Though harder to understand than the
-recursive version, this non-recursive routine is far less likely
-to blow the C stack. It will also run more efficiently since
-a lot of procedure call overhead has been removed. Most lists
-are small though (in the hundreds of items or less) and the
-recursive version should be sufficient for them.
-.EQ
-delim off
-.EN
diff --git a/lib/librpc/doc/xdr.rfc.ms b/lib/librpc/doc/xdr.rfc.ms
deleted file mode 100644
index d4baff5..0000000
--- a/lib/librpc/doc/xdr.rfc.ms
+++ /dev/null
@@ -1,1058 +0,0 @@
-.\"
-.\" Must use -- tbl -- with this one
-.\"
-.\" @(#)xdr.rfc.ms 2.2 88/08/05 4.0 RPCSRC
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH 'External Data Representation Standard''Page %'
-.EH 'Page %''External Data Representation Standard'
-.IX "External Data Representation"
-.if \\n%=1 .bp
-.SH
-\&External Data Representation Standard: Protocol Specification
-.IX XDR RFC
-.IX XDR "protocol specification"
-.LP
-.NH 0
-\&Status of this Standard
-.nr OF 1
-.IX XDR "RFC status"
-.LP
-Note: This chapter specifies a protocol that Sun Microsystems, Inc., and
-others are using. It has been designated RFC1014 by the ARPA Network
-Information Center.
-.NH 1
-Introduction
-\&
-.LP
-XDR is a standard for the description and encoding of data. It is
-useful for transferring data between different computer
-architectures, and has been used to communicate data between such
-diverse machines as the Sun Workstation, VAX, IBM-PC, and Cray.
-XDR fits into the ISO presentation layer, and is roughly analogous in
-purpose to X.409, ISO Abstract Syntax Notation. The major difference
-between these two is that XDR uses implicit typing, while X.409 uses
-explicit typing.
-.LP
-XDR uses a language to describe data formats. The language can only
-be used only to describe data; it is not a programming language.
-This language allows one to describe intricate data formats in a
-concise manner. The alternative of using graphical representations
-(itself an informal language) quickly becomes incomprehensible when
-faced with complexity. The XDR language itself is similar to the C
-language [1], just as Courier [4] is similar to Mesa. Protocols such
-as Sun RPC (Remote Procedure Call) and the NFS (Network File System)
-use XDR to describe the format of their data.
-.LP
-The XDR standard makes the following assumption: that bytes (or
-octets) are portable, where a byte is defined to be 8 bits of data.
-A given hardware device should encode the bytes onto the various
-media in such a way that other hardware devices may decode the bytes
-without loss of meaning. For example, the Ethernet standard
-suggests that bytes be encoded in "little-endian" style [2], or least
-significant bit first.
-.NH 2
-\&Basic Block Size
-.IX XDR "basic block size"
-.IX XDR "block size"
-.LP
-The representation of all items requires a multiple of four bytes (or
-32 bits) of data. The bytes are numbered 0 through n-1. The bytes
-are read or written to some byte stream such that byte m always
-precedes byte m+1. If the n bytes needed to contain the data are not
-a multiple of four, then the n bytes are followed by enough (0 to 3)
-residual zero bytes, r, to make the total byte count a multiple of 4.
-.LP
-We include the familiar graphic box notation for illustration and
-comparison. In most illustrations, each box (delimited by a plus
-sign at the 4 corners and vertical bars and dashes) depicts a byte.
-Ellipses (...) between boxes show zero or more additional bytes where
-required.
-.ie t .DS
-.el .DS L
-\fIA Block\fP
-
-\f(CW+--------+--------+...+--------+--------+...+--------+
-| byte 0 | byte 1 |...|byte n-1| 0 |...| 0 |
-+--------+--------+...+--------+--------+...+--------+
-|<-----------n bytes---------->|<------r bytes------>|
-|<-----------n+r (where (n+r) mod 4 = 0)>----------->|\fP
-
-.DE
-.NH 1
-\&XDR Data Types
-.IX XDR "data types"
-.IX "XDR data types"
-.LP
-Each of the sections that follow describes a data type defined in the
-XDR standard, shows how it is declared in the language, and includes
-a graphic illustration of its encoding.
-.LP
-For each data type in the language we show a general paradigm
-declaration. Note that angle brackets (< and >) denote
-variable length sequences of data and square brackets ([ and ]) denote
-fixed-length sequences of data. "n", "m" and "r" denote integers.
-For the full language specification and more formal definitions of
-terms such as "identifier" and "declaration", refer to
-.I "The XDR Language Specification" ,
-below.
-.LP
-For some data types, more specific examples are included.
-A more extensive example of a data description is in
-.I "An Example of an XDR Data Description"
-below.
-.NH 2
-\&Integer
-.IX XDR integer
-.LP
-An XDR signed integer is a 32-bit datum that encodes an integer in
-the range [-2147483648,2147483647]. The integer is represented in
-two's complement notation. The most and least significant bytes are
-0 and 3, respectively. Integers are declared as follows:
-.ie t .DS
-.el .DS L
-\fIInteger\fP
-
-\f(CW(MSB) (LSB)
-+-------+-------+-------+-------+
-|byte 0 |byte 1 |byte 2 |byte 3 |
-+-------+-------+-------+-------+
-<------------32 bits------------>\fP
-.DE
-.NH 2
-\&Unsigned Integer
-.IX XDR "unsigned integer"
-.IX XDR "integer, unsigned"
-.LP
-An XDR unsigned integer is a 32-bit datum that encodes a nonnegative
-integer in the range [0,4294967295]. It is represented by an
-unsigned binary number whose most and least significant bytes are 0
-and 3, respectively. An unsigned integer is declared as follows:
-.ie t .DS
-.el .DS L
-\fIUnsigned Integer\fP
-
-\f(CW(MSB) (LSB)
-+-------+-------+-------+-------+
-|byte 0 |byte 1 |byte 2 |byte 3 |
-+-------+-------+-------+-------+
-<------------32 bits------------>\fP
-.DE
-.NH 2
-\&Enumeration
-.IX XDR enumeration
-.LP
-Enumerations have the same representation as signed integers.
-Enumerations are handy for describing subsets of the integers.
-Enumerated data is declared as follows:
-.ft CW
-.DS
-enum { name-identifier = constant, ... } identifier;
-.DE
-For example, the three colors red, yellow, and blue could be
-described by an enumerated type:
-.DS
-.ft CW
-enum { RED = 2, YELLOW = 3, BLUE = 5 } colors;
-.DE
-It is an error to encode as an enum any other integer than those that
-have been given assignments in the enum declaration.
-.NH 2
-\&Boolean
-.IX XDR boolean
-.LP
-Booleans are important enough and occur frequently enough to warrant
-their own explicit type in the standard. Booleans are declared as
-follows:
-.DS
-.ft CW
-bool identifier;
-.DE
-This is equivalent to:
-.DS
-.ft CW
-enum { FALSE = 0, TRUE = 1 } identifier;
-.DE
-.NH 2
-\&Hyper Integer and Unsigned Hyper Integer
-.IX XDR "hyper integer"
-.IX XDR "integer, hyper"
-.LP
-The standard also defines 64-bit (8-byte) numbers called hyper
-integer and unsigned hyper integer. Their representations are the
-obvious extensions of integer and unsigned integer defined above.
-They are represented in two's complement notation. The most and
-least significant bytes are 0 and 7, respectively. Their
-declarations:
-.ie t .DS
-.el .DS L
-\fIHyper Integer\fP
-\fIUnsigned Hyper Integer\fP
-
-\f(CW(MSB) (LSB)
-+-------+-------+-------+-------+-------+-------+-------+-------+
-|byte 0 |byte 1 |byte 2 |byte 3 |byte 4 |byte 5 |byte 6 |byte 7 |
-+-------+-------+-------+-------+-------+-------+-------+-------+
-<----------------------------64 bits---------------------------->\fP
-.DE
-.NH 2
-\&Floating-point
-.IX XDR "integer, floating point"
-.IX XDR "floating-point integer"
-.LP
-The standard defines the floating-point data type "float" (32 bits or
-4 bytes). The encoding used is the IEEE standard for normalized
-single-precision floating-point numbers [3]. The following three
-fields describe the single-precision floating-point number:
-.RS
-.IP \fBS\fP:
-The sign of the number. Values 0 and 1 represent positive and
-negative, respectively. One bit.
-.IP \fBE\fP:
-The exponent of the number, base 2. 8 bits are devoted to this
-field. The exponent is biased by 127.
-.IP \fBF\fP:
-The fractional part of the number's mantissa, base 2. 23 bits
-are devoted to this field.
-.RE
-.LP
-Therefore, the floating-point number is described by:
-.DS
-(-1)**S * 2**(E-Bias) * 1.F
-.DE
-It is declared as follows:
-.ie t .DS
-.el .DS L
-\fISingle-Precision Floating-Point\fP
-
-\f(CW+-------+-------+-------+-------+
-|byte 0 |byte 1 |byte 2 |byte 3 |
-S| E | F |
-+-------+-------+-------+-------+
-1|<- 8 ->|<-------23 bits------>|
-<------------32 bits------------>\fP
-.DE
-Just as the most and least significant bytes of a number are 0 and 3,
-the most and least significant bits of a single-precision floating-
-point number are 0 and 31. The beginning bit (and most significant
-bit) offsets of S, E, and F are 0, 1, and 9, respectively. Note that
-these numbers refer to the mathematical positions of the bits, and
-NOT to their actual physical locations (which vary from medium to
-medium).
-.LP
-The IEEE specifications should be consulted concerning the encoding
-for signed zero, signed infinity (overflow), and denormalized numbers
-(underflow) [3]. According to IEEE specifications, the "NaN" (not a
-number) is system dependent and should not be used externally.
-.NH 2
-\&Double-precision Floating-point
-.IX XDR "integer, double-precision floating point"
-.IX XDR "double-precision floating-point integer"
-.LP
-The standard defines the encoding for the double-precision floating-
-point data type "double" (64 bits or 8 bytes). The encoding used is
-the IEEE standard for normalized double-precision floating-point
-numbers [3]. The standard encodes the following three fields, which
-describe the double-precision floating-point number:
-.RS
-.IP \fBS\fP:
-The sign of the number. Values 0 and 1 represent positive and
-negative, respectively. One bit.
-.IP \fBE\fP:
-The exponent of the number, base 2. 11 bits are devoted to this
-field. The exponent is biased by 1023.
-.IP \fBF\fP:
-The fractional part of the number's mantissa, base 2. 52 bits
-are devoted to this field.
-.RE
-.LP
-Therefore, the floating-point number is described by:
-.DS
-(-1)**S * 2**(E-Bias) * 1.F
-.DE
-It is declared as follows:
-.ie t .DS
-.el .DS L
-\fIDouble-Precision Floating-Point\fP
-
-\f(CW+------+------+------+------+------+------+------+------+
-|byte 0|byte 1|byte 2|byte 3|byte 4|byte 5|byte 6|byte 7|
-S| E | F |
-+------+------+------+------+------+------+------+------+
-1|<--11-->|<-----------------52 bits------------------->|
-<-----------------------64 bits------------------------->\fP
-.DE
-Just as the most and least significant bytes of a number are 0 and 3,
-the most and least significant bits of a double-precision floating-
-point number are 0 and 63. The beginning bit (and most significant
-bit) offsets of S, E , and F are 0, 1, and 12, respectively. Note
-that these numbers refer to the mathematical positions of the bits,
-and NOT to their actual physical locations (which vary from medium to
-medium).
-.LP
-The IEEE specifications should be consulted concerning the encoding
-for signed zero, signed infinity (overflow), and denormalized numbers
-(underflow) [3]. According to IEEE specifications, the "NaN" (not a
-number) is system dependent and should not be used externally.
-.NH 2
-\&Fixed-length Opaque Data
-.IX XDR "fixed-length opaque data"
-.IX XDR "opaque data, fixed length"
-.LP
-At times, fixed-length uninterpreted data needs to be passed among
-machines. This data is called "opaque" and is declared as follows:
-.DS
-.ft CW
-opaque identifier[n];
-.DE
-where the constant n is the (static) number of bytes necessary to
-contain the opaque data. If n is not a multiple of four, then the n
-bytes are followed by enough (0 to 3) residual zero bytes, r, to make
-the total byte count of the opaque object a multiple of four.
-.ie t .DS
-.el .DS L
-\fIFixed-Length Opaque\fP
-
-\f(CW0 1 ...
-+--------+--------+...+--------+--------+...+--------+
-| byte 0 | byte 1 |...|byte n-1| 0 |...| 0 |
-+--------+--------+...+--------+--------+...+--------+
-|<-----------n bytes---------->|<------r bytes------>|
-|<-----------n+r (where (n+r) mod 4 = 0)------------>|\fP
-.DE
-.NH 2
-\&Variable-length Opaque Data
-.IX XDR "variable-length opaque data"
-.IX XDR "opaque data, variable length"
-.LP
-The standard also provides for variable-length (counted) opaque data,
-defined as a sequence of n (numbered 0 through n-1) arbitrary bytes
-to be the number n encoded as an unsigned integer (as described
-below), and followed by the n bytes of the sequence.
-.LP
-Byte m of the sequence always precedes byte m+1 of the sequence, and
-byte 0 of the sequence always follows the sequence's length (count).
-enough (0 to 3) residual zero bytes, r, to make the total byte count
-a multiple of four. Variable-length opaque data is declared in the
-following way:
-.DS
-.ft CW
-opaque identifier<m>;
-.DE
-or
-.DS
-.ft CW
-opaque identifier<>;
-.DE
-The constant m denotes an upper bound of the number of bytes that the
-sequence may contain. If m is not specified, as in the second
-declaration, it is assumed to be (2**32) - 1, the maximum length.
-The constant m would normally be found in a protocol specification.
-For example, a filing protocol may state that the maximum data
-transfer size is 8192 bytes, as follows:
-.DS
-.ft CW
-opaque filedata<8192>;
-.DE
-This can be illustrated as follows:
-.ie t .DS
-.el .DS L
-\fIVariable-Length Opaque\fP
-
-\f(CW0 1 2 3 4 5 ...
-+-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+
-| length n |byte0|byte1|...| n-1 | 0 |...| 0 |
-+-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+
-|<-------4 bytes------->|<------n bytes------>|<---r bytes--->|
-|<----n+r (where (n+r) mod 4 = 0)---->|\fP
-.DE
-.LP
-It is an error to encode a length greater than the maximum
-described in the specification.
-.NH 2
-\&String
-.IX XDR string
-.LP
-The standard defines a string of n (numbered 0 through n-1) ASCII
-bytes to be the number n encoded as an unsigned integer (as described
-above), and followed by the n bytes of the string. Byte m of the
-string always precedes byte m+1 of the string, and byte 0 of the
-string always follows the string's length. If n is not a multiple of
-four, then the n bytes are followed by enough (0 to 3) residual zero
-bytes, r, to make the total byte count a multiple of four. Counted
-byte strings are declared as follows:
-.DS
-.ft CW
-string object<m>;
-.DE
-or
-.DS
-.ft CW
-string object<>;
-.DE
-The constant m denotes an upper bound of the number of bytes that a
-string may contain. If m is not specified, as in the second
-declaration, it is assumed to be (2**32) - 1, the maximum length.
-The constant m would normally be found in a protocol specification.
-For example, a filing protocol may state that a file name can be no
-longer than 255 bytes, as follows:
-.DS
-.ft CW
-string filename<255>;
-.DE
-Which can be illustrated as:
-.ie t .DS
-.el .DS L
-\fIA String\fP
-
-\f(CW0 1 2 3 4 5 ...
-+-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+
-| length n |byte0|byte1|...| n-1 | 0 |...| 0 |
-+-----+-----+-----+-----+-----+-----+...+-----+-----+...+-----+
-|<-------4 bytes------->|<------n bytes------>|<---r bytes--->|
-|<----n+r (where (n+r) mod 4 = 0)---->|\fP
-.DE
-.LP
-It is an error to encode a length greater than the maximum
-described in the specification.
-.NH 2
-\&Fixed-length Array
-.IX XDR "fixed-length array"
-.IX XDR "array, fixed length"
-.LP
-Declarations for fixed-length arrays of homogeneous elements are in
-the following form:
-.DS
-.ft CW
-type-name identifier[n];
-.DE
-Fixed-length arrays of elements numbered 0 through n-1 are encoded by
-individually encoding the elements of the array in their natural
-order, 0 through n-1. Each element's size is a multiple of four
-bytes. Though all elements are of the same type, the elements may
-have different sizes. For example, in a fixed-length array of
-strings, all elements are of type "string", yet each element will
-vary in its length.
-.ie t .DS
-.el .DS L
-\fIFixed-Length Array\fP
-
-\f(CW+---+---+---+---+---+---+---+---+...+---+---+---+---+
-| element 0 | element 1 |...| element n-1 |
-+---+---+---+---+---+---+---+---+...+---+---+---+---+
-|<--------------------n elements------------------->|\fP
-.DE
-.NH 2
-\&Variable-length Array
-.IX XDR "variable-length array"
-.IX XDR "array, variable length"
-.LP
-Counted arrays provide the ability to encode variable-length arrays
-of homogeneous elements. The array is encoded as the element count n
-(an unsigned integer) followed by the encoding of each of the array's
-elements, starting with element 0 and progressing through element n-
-1. The declaration for variable-length arrays follows this form:
-.DS
-.ft CW
-type-name identifier<m>;
-.DE
-or
-.DS
-.ft CW
-type-name identifier<>;
-.DE
-The constant m specifies the maximum acceptable element count of an
-array; if m is not specified, as in the second declaration, it is
-assumed to be (2**32) - 1.
-.ie t .DS
-.el .DS L
-\fICounted Array\fP
-
-\f(CW0 1 2 3
-+--+--+--+--+--+--+--+--+--+--+--+--+...+--+--+--+--+
-| n | element 0 | element 1 |...|element n-1|
-+--+--+--+--+--+--+--+--+--+--+--+--+...+--+--+--+--+
-|<-4 bytes->|<--------------n elements------------->|\fP
-.DE
-It is an error to encode a value of n that is greater than the
-maximum described in the specification.
-.NH 2
-\&Structure
-.IX XDR structure
-.LP
-Structures are declared as follows:
-.DS
-.ft CW
-struct {
- component-declaration-A;
- component-declaration-B;
- \&...
-} identifier;
-.DE
-The components of the structure are encoded in the order of their
-declaration in the structure. Each component's size is a multiple of
-four bytes, though the components may be different sizes.
-.ie t .DS
-.el .DS L
-\fIStructure\fP
-
-\f(CW+-------------+-------------+...
-| component A | component B |...
-+-------------+-------------+...\fP
-.DE
-.NH 2
-\&Discriminated Union
-.IX XDR "discriminated union"
-.IX XDR union discriminated
-.LP
-A discriminated union is a type composed of a discriminant followed
-by a type selected from a set of prearranged types according to the
-value of the discriminant. The type of discriminant is either "int",
-"unsigned int", or an enumerated type, such as "bool". The component
-types are called "arms" of the union, and are preceded by the value
-of the discriminant which implies their encoding. Discriminated
-unions are declared as follows:
-.DS
-.ft CW
-union switch (discriminant-declaration) {
- case discriminant-value-A:
- arm-declaration-A;
- case discriminant-value-B:
- arm-declaration-B;
- \&...
- default: default-declaration;
-} identifier;
-.DE
-Each "case" keyword is followed by a legal value of the discriminant.
-The default arm is optional. If it is not specified, then a valid
-encoding of the union cannot take on unspecified discriminant values.
-The size of the implied arm is always a multiple of four bytes.
-.LP
-The discriminated union is encoded as its discriminant followed by
-the encoding of the implied arm.
-.ie t .DS
-.el .DS L
-\fIDiscriminated Union\fP
-
-\f(CW0 1 2 3
-+---+---+---+---+---+---+---+---+
-| discriminant | implied arm |
-+---+---+---+---+---+---+---+---+
-|<---4 bytes--->|\fP
-.DE
-.NH 2
-\&Void
-.IX XDR void
-.LP
-An XDR void is a 0-byte quantity. Voids are useful for describing
-operations that take no data as input or no data as output. They are
-also useful in unions, where some arms may contain data and others do
-not. The declaration is simply as follows:
-.DS
-.ft CW
-void;
-.DE
-Voids are illustrated as follows:
-.ie t .DS
-.el .DS L
-\fIVoid\fP
-
-\f(CW ++
- ||
- ++
---><-- 0 bytes\fP
-.DE
-.NH 2
-\&Constant
-.IX XDR constant
-.LP
-The data declaration for a constant follows this form:
-.DS
-.ft CW
-const name-identifier = n;
-.DE
-"const" is used to define a symbolic name for a constant; it does not
-declare any data. The symbolic constant may be used anywhere a
-regular constant may be used. For example, the following defines a
-symbolic constant DOZEN, equal to 12.
-.DS
-.ft CW
-const DOZEN = 12;
-.DE
-.NH 2
-\&Typedef
-.IX XDR typedef
-.LP
-"typedef" does not declare any data either, but serves to define new
-identifiers for declaring data. The syntax is:
-.DS
-.ft CW
-typedef declaration;
-.DE
-The new type name is actually the variable name in the declaration
-part of the typedef. For example, the following defines a new type
-called "eggbox" using an existing type called "egg":
-.DS
-.ft CW
-typedef egg eggbox[DOZEN];
-.DE
-Variables declared using the new type name have the same type as the
-new type name would have in the typedef, if it was considered a
-variable. For example, the following two declarations are equivalent
-in declaring the variable "fresheggs":
-.DS
-.ft CW
-eggbox fresheggs;
-egg fresheggs[DOZEN];
-.DE
-When a typedef involves a struct, enum, or union definition, there is
-another (preferred) syntax that may be used to define the same type.
-In general, a typedef of the following form:
-.DS
-.ft CW
-typedef <<struct, union, or enum definition>> identifier;
-.DE
-may be converted to the alternative form by removing the "typedef"
-part and placing the identifier after the "struct", "union", or
-"enum" keyword, instead of at the end. For example, here are the two
-ways to define the type "bool":
-.DS
-.ft CW
-typedef enum { /* \fIusing typedef\fP */
- FALSE = 0,
- TRUE = 1
- } bool;
-
-enum bool { /* \fIpreferred alternative\fP */
- FALSE = 0,
- TRUE = 1
- };
-.DE
-The reason this syntax is preferred is one does not have to wait
-until the end of a declaration to figure out the name of the new
-type.
-.NH 2
-\&Optional-data
-.IX XDR "optional data"
-.IX XDR "data, optional"
-.LP
-Optional-data is one kind of union that occurs so frequently that we
-give it a special syntax of its own for declaring it. It is declared
-as follows:
-.DS
-.ft CW
-type-name *identifier;
-.DE
-This is equivalent to the following union:
-.DS
-.ft CW
-union switch (bool opted) {
- case TRUE:
- type-name element;
- case FALSE:
- void;
-} identifier;
-.DE
-It is also equivalent to the following variable-length array
-declaration, since the boolean "opted" can be interpreted as the
-length of the array:
-.DS
-.ft CW
-type-name identifier<1>;
-.DE
-Optional-data is not so interesting in itself, but it is very useful
-for describing recursive data-structures such as linked-lists and
-trees. For example, the following defines a type "stringlist" that
-encodes lists of arbitrary length strings:
-.DS
-.ft CW
-struct *stringlist {
- string item<>;
- stringlist next;
-};
-.DE
-It could have been equivalently declared as the following union:
-.DS
-.ft CW
-union stringlist switch (bool opted) {
- case TRUE:
- struct {
- string item<>;
- stringlist next;
- } element;
- case FALSE:
- void;
-};
-.DE
-or as a variable-length array:
-.DS
-.ft CW
-struct stringlist<1> {
- string item<>;
- stringlist next;
-};
-.DE
-Both of these declarations obscure the intention of the stringlist
-type, so the optional-data declaration is preferred over both of
-them. The optional-data type also has a close correlation to how
-recursive data structures are represented in high-level languages
-such as Pascal or C by use of pointers. In fact, the syntax is the
-same as that of the C language for pointers.
-.NH 2
-\&Areas for Future Enhancement
-.IX XDR futures
-.LP
-The XDR standard lacks representations for bit fields and bitmaps,
-since the standard is based on bytes. Also missing are packed (or
-binary-coded) decimals.
-.LP
-The intent of the XDR standard was not to describe every kind of data
-that people have ever sent or will ever want to send from machine to
-machine. Rather, it only describes the most commonly used data-types
-of high-level languages such as Pascal or C so that applications
-written in these languages will be able to communicate easily over
-some medium.
-.LP
-One could imagine extensions to XDR that would let it describe almost
-any existing protocol, such as TCP. The minimum necessary for this
-are support for different block sizes and byte-orders. The XDR
-discussed here could then be considered the 4-byte big-endian member
-of a larger XDR family.
-.NH 1
-\&Discussion
-.sp 2
-.NH 2
-\&Why a Language for Describing Data?
-.IX XDR language
-.LP
-There are many advantages in using a data-description language such
-as XDR versus using diagrams. Languages are more formal than
-diagrams and lead to less ambiguous descriptions of data.
-Languages are also easier to understand and allow one to think of
-other issues instead of the low-level details of bit-encoding.
-Also, there is a close analogy between the types of XDR and a
-high-level language such as C or Pascal. This makes the
-implementation of XDR encoding and decoding modules an easier task.
-Finally, the language specification itself is an ASCII string that
-can be passed from machine to machine to perform on-the-fly data
-interpretation.
-.NH 2
-\&Why Only one Byte-Order for an XDR Unit?
-.IX XDR "byte order"
-.LP
-Supporting two byte-orderings requires a higher level protocol for
-determining in which byte-order the data is encoded. Since XDR is
-not a protocol, this can't be done. The advantage of this, though,
-is that data in XDR format can be written to a magnetic tape, for
-example, and any machine will be able to interpret it, since no
-higher level protocol is necessary for determining the byte-order.
-.NH 2
-\&Why does XDR use Big-Endian Byte-Order?
-.LP
-Yes, it is unfair, but having only one byte-order means you have to
-be unfair to somebody. Many architectures, such as the Motorola
-68000 and IBM 370, support the big-endian byte-order.
-.NH 2
-\&Why is the XDR Unit Four Bytes Wide?
-.LP
-There is a tradeoff in choosing the XDR unit size. Choosing a small
-size such as two makes the encoded data small, but causes alignment
-problems for machines that aren't aligned on these boundaries. A
-large size such as eight means the data will be aligned on virtually
-every machine, but causes the encoded data to grow too big. We chose
-four as a compromise. Four is big enough to support most
-architectures efficiently, except for rare machines such as the
-eight-byte aligned Cray. Four is also small enough to keep the
-encoded data restricted to a reasonable size.
-.NH 2
-\&Why must Variable-Length Data be Padded with Zeros?
-.IX XDR "variable-length data"
-.LP
-It is desirable that the same data encode into the same thing on all
-machines, so that encoded data can be meaningfully compared or
-checksummed. Forcing the padded bytes to be zero ensures this.
-.NH 2
-\&Why is there No Explicit Data-Typing?
-.LP
-Data-typing has a relatively high cost for what small advantages it
-may have. One cost is the expansion of data due to the inserted type
-fields. Another is the added cost of interpreting these type fields
-and acting accordingly. And most protocols already know what type
-they expect, so data-typing supplies only redundant information.
-However, one can still get the benefits of data-typing using XDR. One
-way is to encode two things: first a string which is the XDR data
-description of the encoded data, and then the encoded data itself.
-Another way is to assign a value to all the types in XDR, and then
-define a universal type which takes this value as its discriminant
-and for each value, describes the corresponding data type.
-.NH 1
-\&The XDR Language Specification
-.IX XDR language
-.sp 1
-.NH 2
-\&Notational Conventions
-.IX "XDR language" notation
-.LP
-This specification uses an extended Backus-Naur Form notation for
-describing the XDR language. Here is a brief description of the
-notation:
-.IP 1.
-The characters
-.I | ,
-.I ( ,
-.I ) ,
-.I [ ,
-.I ] ,
-.I " ,
-and
-.I *
-are special.
-.IP 2.
-Terminal symbols are strings of any characters surrounded by
-double quotes.
-.IP 3.
-Non-terminal symbols are strings of non-special characters.
-.IP 4.
-Alternative items are separated by a vertical bar ("\fI|\fP").
-.IP 5.
-Optional items are enclosed in brackets.
-.IP 6.
-Items are grouped together by enclosing them in parentheses.
-.IP 7.
-A
-.I *
-following an item means 0 or more occurrences of that item.
-.LP
-For example, consider the following pattern:
-.DS L
-"a " "very" (", " " very")* [" cold " "and"] " rainy " ("day" | "night")
-.DE
-.LP
-An infinite number of strings match this pattern. A few of them
-are:
-.DS
-"a very rainy day"
-"a very, very rainy day"
-"a very cold and rainy day"
-"a very, very, very cold and rainy night"
-.DE
-.NH 2
-\&Lexical Notes
-.IP 1.
-Comments begin with '/*' and terminate with '*/'.
-.IP 2.
-White space serves to separate items and is otherwise ignored.
-.IP 3.
-An identifier is a letter followed by an optional sequence of
-letters, digits or underbar ('_'). The case of identifiers is
-not ignored.
-.IP 4.
-A constant is a sequence of one or more decimal digits,
-optionally preceded by a minus-sign ('-').
-.NH 2
-\&Syntax Information
-.IX "XDR language" syntax
-.DS
-.ft CW
-declaration:
- type-specifier identifier
- | type-specifier identifier "[" value "]"
- | type-specifier identifier "<" [ value ] ">"
- | "opaque" identifier "[" value "]"
- | "opaque" identifier "<" [ value ] ">"
- | "string" identifier "<" [ value ] ">"
- | type-specifier "*" identifier
- | "void"
-.DE
-.DS
-.ft CW
-value:
- constant
- | identifier
-
-type-specifier:
- [ "unsigned" ] "int"
- | [ "unsigned" ] "hyper"
- | "float"
- | "double"
- | "bool"
- | enum-type-spec
- | struct-type-spec
- | union-type-spec
- | identifier
-.DE
-.DS
-.ft CW
-enum-type-spec:
- "enum" enum-body
-
-enum-body:
- "{"
- ( identifier "=" value )
- ( "," identifier "=" value )*
- "}"
-.DE
-.DS
-.ft CW
-struct-type-spec:
- "struct" struct-body
-
-struct-body:
- "{"
- ( declaration ";" )
- ( declaration ";" )*
- "}"
-.DE
-.DS
-.ft CW
-union-type-spec:
- "union" union-body
-
-union-body:
- "switch" "(" declaration ")" "{"
- ( "case" value ":" declaration ";" )
- ( "case" value ":" declaration ";" )*
- [ "default" ":" declaration ";" ]
- "}"
-
-constant-def:
- "const" identifier "=" constant ";"
-.DE
-.DS
-.ft CW
-type-def:
- "typedef" declaration ";"
- | "enum" identifier enum-body ";"
- | "struct" identifier struct-body ";"
- | "union" identifier union-body ";"
-
-definition:
- type-def
- | constant-def
-
-specification:
- definition *
-.DE
-.NH 3
-\&Syntax Notes
-.IX "XDR language" syntax
-.LP
-.IP 1.
-The following are keywords and cannot be used as identifiers:
-"bool", "case", "const", "default", "double", "enum", "float",
-"hyper", "opaque", "string", "struct", "switch", "typedef", "union",
-"unsigned" and "void".
-.IP 2.
-Only unsigned constants may be used as size specifications for
-arrays. If an identifier is used, it must have been declared
-previously as an unsigned constant in a "const" definition.
-.IP 3.
-Constant and type identifiers within the scope of a specification
-are in the same name space and must be declared uniquely within this
-scope.
-.IP 4.
-Similarly, variable names must be unique within the scope of
-struct and union declarations. Nested struct and union declarations
-create new scopes.
-.IP 5.
-The discriminant of a union must be of a type that evaluates to
-an integer. That is, "int", "unsigned int", "bool", an enumerated
-type or any typedefed type that evaluates to one of these is legal.
-Also, the case values must be one of the legal values of the
-discriminant. Finally, a case value may not be specified more than
-once within the scope of a union declaration.
-.NH 1
-\&An Example of an XDR Data Description
-.LP
-Here is a short XDR data description of a thing called a "file",
-which might be used to transfer files from one machine to another.
-.ie t .DS
-.el .DS L
-.ft CW
-
-const MAXUSERNAME = 32; /*\fI max length of a user name \fP*/
-const MAXFILELEN = 65535; /*\fI max length of a file \fP*/
-const MAXNAMELEN = 255; /*\fI max length of a file name \fP*/
-
-.ft I
-/*
- * Types of files:
- */
-.ft CW
-
-enum filekind {
- TEXT = 0, /*\fI ascii data \fP*/
- DATA = 1, /*\fI raw data \fP*/
- EXEC = 2 /*\fI executable \fP*/
-};
-
-.ft I
-/*
- * File information, per kind of file:
- */
-.ft CW
-
-union filetype switch (filekind kind) {
- case TEXT:
- void; /*\fI no extra information \fP*/
- case DATA:
- string creator<MAXNAMELEN>; /*\fI data creator \fP*/
- case EXEC:
- string interpretor<MAXNAMELEN>; /*\fI program interpretor \fP*/
-};
-
-.ft I
-/*
- * A complete file:
- */
-.ft CW
-
-struct file {
- string filename<MAXNAMELEN>; /*\fI name of file \fP*/
- filetype type; /*\fI info about file \fP*/
- string owner<MAXUSERNAME>; /*\fI owner of file \fP*/
- opaque data<MAXFILELEN>; /*\fI file data \fP*/
-};
-.DE
-.LP
-Suppose now that there is a user named "john" who wants to store
-his lisp program "sillyprog" that contains just the data "(quit)".
-His file would be encoded as follows:
-.TS
-box tab (&) ;
-lfI lfI lfI lfI
-rfL rfL rfL l .
-Offset&Hex Bytes&ASCII&Description
-_
-0&00 00 00 09&....&Length of filename = 9
-4&73 69 6c 6c&sill&Filename characters
-8&79 70 72 6f&ypro& ... and more characters ...
-12&67 00 00 00&g...& ... and 3 zero-bytes of fill
-16&00 00 00 02&....&Filekind is EXEC = 2
-20&00 00 00 04&....&Length of interpretor = 4
-24&6c 69 73 70&lisp&Interpretor characters
-28&00 00 00 04&....&Length of owner = 4
-32&6a 6f 68 6e&john&Owner characters
-36&00 00 00 06&....&Length of file data = 6
-40&28 71 75 69&(qui&File data bytes ...
-44&74 29 00 00&t)..& ... and 2 zero-bytes of fill
-.TE
-.NH 1
-\&References
-.LP
-[1] Brian W. Kernighan & Dennis M. Ritchie, "The C Programming
-Language", Bell Laboratories, Murray Hill, New Jersey, 1978.
-.LP
-[2] Danny Cohen, "On Holy Wars and a Plea for Peace", IEEE Computer,
-October 1981.
-.LP
-[3] "IEEE Standard for Binary Floating-Point Arithmetic", ANSI/IEEE
-Standard 754-1985, Institute of Electrical and Electronics
-Engineers, August 1985.
-.LP
-[4] "Courier: The Remote Procedure Call Protocol", XEROX
-Corporation, XSIS 038112, December 1981.
diff --git a/lib/librpc/etc/Makefile b/lib/librpc/etc/Makefile
deleted file mode 100644
index beb2ce9..0000000
--- a/lib/librpc/etc/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/01 4.0 RPCSRC
-#
-# Files and programs for /etc. rpclib must have already been installed.
-#
-DESTDIR=
-CFLAGS= -O
-LIB = -lrpclib
-LDFLAGS= $(LIB)
-
-BIN = portmap rpcinfo
-MISC= rpc
-
-all: ${BIN}
-
-portmap:
- ${CC} ${CFLAGS} -o $@ $@.c ${LDFLAGS}
-
-rpcinfo: getopt.o
- ${CC} ${CFLAGS} -o $@ $@.c getopt.o ${LDFLAGS}
-
-install: ${BIN}
- -mkdir ${DESTDIR}/etc && chown bin ${DESTDIR}/etc && \
- chmod 755 ${DESTDIR}/etc
- @echo "Installing RPC utility files in ${DESTDIR}/etc"
- @set -x;for i in ${BIN}; do \
- (install -s $$i ${DESTDIR}/etc/$$i); done
- @echo "Installing ${DESTDIR}/etc/rpc"
- @set -x;for i in ${MISC}; do \
- (install -c -m 644 $$i ${DESTDIR}/etc/$$i); done
-
-clean:
- rm -f core *.o
- rm -f ${BIN}
-
-depend: ${BIN}
- rm -f makedep
- for i in ${BIN}; do \
- ${CC} -M ${INCPATH} $$i.c | sed 's/\.o//' | \
- awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
- else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
- else rec = rec " " $$2 } } \
- END { print rec } ' >> makedep; done
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile
-
-
-depend.42BSD depend.42bsd:
- cp /dev/null x.c
- for i in $(BIN) ; do \
- (/bin/grep '^#[ ]*include' x.c $$i.c | sed \
- -e 's,<\(.*\)>,"/usr/include/\1",' \
- -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
- -e 's/\.c/\.o/' >>makedep); done
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep x.c
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile
-
-# DO NOT DELETE THIS LINE -- make depend uses it
-
-
diff --git a/lib/librpc/etc/getopt.c b/lib/librpc/etc/getopt.c
deleted file mode 100644
index 7296b05..0000000
--- a/lib/librpc/etc/getopt.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* @(#)getopt.c 2.1 88/08/01 4.0 RPCSRC */
-
-/* this is a public domain version of getopt */
-
-/*LINTLIBRARY*/
-#ifndef NULL
-#define NULL 0
-#endif NULL
-#ifndef EOF
-#define EOF (-1)
-#endif EOF
-
-#define ERR(s, c) if(opterr){\
- extern int strlen(), write();\
- char errbuf[2];\
- errbuf[0] = c; errbuf[1] = '\n';\
- (void) write(2, argv[0], strlen(argv[0]));\
- (void) write(2, s, strlen(s));\
- (void) write(2, errbuf, 2);}
-
-#define strchr index
-
-extern int strcmp();
-extern char *strchr();
-
-int opterr = 1;
-int optind = 1;
-int optopt;
-char *optarg;
-
-int
-getopt(argc, argv, opts)
-int argc;
-char **argv, *opts;
-{
- static int sp = 1;
- register int c;
- register char *cp;
-
- if(sp == 1)
- if(optind >= argc ||
- argv[optind][0] != '-' || argv[optind][1] == '\0')
- return(EOF);
- else if(strcmp(argv[optind], "--") == NULL) {
- optind++;
- return(EOF);
- }
- optopt = c = argv[optind][sp];
- if(c == ':' || (cp=strchr(opts, c)) == NULL) {
- ERR(": unknown option, -", c);
- if(argv[optind][++sp] == '\0') {
- optind++;
- sp = 1;
- }
- return('?');
- }
- if(*++cp == ':') {
- if(argv[optind][sp+1] != '\0')
- optarg = &argv[optind++][sp+1];
- else if(++optind >= argc) {
- ERR(": argument missing for -", c);
- sp = 1;
- return('?');
- } else
- optarg = argv[optind++];
- sp = 1;
- } else {
- if(argv[optind][++sp] == '\0') {
- sp = 1;
- optind++;
- }
- optarg = NULL;
- }
- return(c);
-}
diff --git a/lib/librpc/etc/portmap.c b/lib/librpc/etc/portmap.c
deleted file mode 100644
index adfdef9..0000000
--- a/lib/librpc/etc/portmap.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/* @(#)portmap.c 2.3 88/08/11 4.0 RPCSRC */
-#ifndef lint
-static char sccsid[] = "@(#)portmap.c 1.32 87/08/06 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * Copyright (c) 1984 by Sun Microsystems, Inc.
- */
-
-/*
- * portmap.c, Implements the program,version to port number mapping for
- * rpc.
- */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/wait.h>
-#include <sys/signal.h>
-
-char *malloc();
-int reg_service();
-void reap();
-struct pmaplist *pmaplist;
-static int debugging = 0;
-
-main()
-{
- SVCXPRT *xprt;
- int sock, pid, t;
- struct sockaddr_in addr;
- int len = sizeof(struct sockaddr_in);
- register struct pmaplist *pml;
-
-#ifndef DEBUG
- pid = fork();
- if (pid < 0) {
- perror("portmap: fork");
- exit(1);
- }
- if (pid != 0)
- exit(0);
- for (t = 0; t < 20; t++)
- close(t);
- open("/", 0);
- dup2(0, 1);
- dup2(0, 2);
- t = open("/dev/tty", 2);
- if (t >= 0) {
- ioctl(t, TIOCNOTTY, (char *)0);
- close(t);
- }
-#endif
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- perror("portmap cannot create socket");
- exit(1);
- }
-
- addr.sin_addr.s_addr = 0;
- addr.sin_family = AF_INET;
- addr.sin_port = htons(PMAPPORT);
- if (bind(sock, (struct sockaddr *)&addr, len) != 0) {
- perror("portmap cannot bind");
- exit(1);
- }
-
- if ((xprt = svcudp_create(sock)) == (SVCXPRT *)NULL) {
- fprintf(stderr, "couldn't do udp_create\n");
- exit(1);
- }
- /* make an entry for ourself */
- pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist));
- pml->pml_next = 0;
- pml->pml_map.pm_prog = PMAPPROG;
- pml->pml_map.pm_vers = PMAPVERS;
- pml->pml_map.pm_prot = IPPROTO_UDP;
- pml->pml_map.pm_port = PMAPPORT;
- pmaplist = pml;
-
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- perror("portmap cannot create socket");
- exit(1);
- }
- if (bind(sock, (struct sockaddr *)&addr, len) != 0) {
- perror("portmap cannot bind");
- exit(1);
- }
- if ((xprt = svctcp_create(sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE))
- == (SVCXPRT *)NULL) {
- fprintf(stderr, "couldn't do tcp_create\n");
- exit(1);
- }
- /* make an entry for ourself */
- pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist));
- pml->pml_map.pm_prog = PMAPPROG;
- pml->pml_map.pm_vers = PMAPVERS;
- pml->pml_map.pm_prot = IPPROTO_TCP;
- pml->pml_map.pm_port = PMAPPORT;
- pml->pml_next = pmaplist;
- pmaplist = pml;
-
- (void)svc_register(xprt, PMAPPROG, PMAPVERS, reg_service, FALSE);
-
- (void)signal(SIGCHLD, reap);
- svc_run();
- fprintf(stderr, "run_svc returned unexpectedly\n");
- abort();
-}
-
-static struct pmaplist *
-find_service(prog, vers, prot)
- u_long prog;
- u_long vers;
-{
- register struct pmaplist *hit = NULL;
- register struct pmaplist *pml;
-
- for (pml = pmaplist; pml != NULL; pml = pml->pml_next) {
- if ((pml->pml_map.pm_prog != prog) ||
- (pml->pml_map.pm_prot != prot))
- continue;
- hit = pml;
- if (pml->pml_map.pm_vers == vers)
- break;
- }
- return (hit);
-}
-
-/*
- * 1 OK, 0 not
- */
-reg_service(rqstp, xprt)
- struct svc_req *rqstp;
- SVCXPRT *xprt;
-{
- struct pmap reg;
- struct pmaplist *pml, *prevpml, *fnd;
- int ans, port;
- caddr_t t;
-
-#ifdef DEBUG
- fprintf(stderr, "server: about do a switch\n");
-#endif
- switch (rqstp->rq_proc) {
-
- case PMAPPROC_NULL:
- /*
- * Null proc call
- */
- if ((!svc_sendreply(xprt, xdr_void, NULL)) && debugging) {
- abort();
- }
- break;
-
- case PMAPPROC_SET:
- /*
- * Set a program,version to port mapping
- */
- if (!svc_getargs(xprt, xdr_pmap, &reg))
- svcerr_decode(xprt);
- else {
- /*
- * check to see if already used
- * find_service returns a hit even if
- * the versions don't match, so check for it
- */
- fnd = find_service(reg.pm_prog, reg.pm_vers, reg.pm_prot);
- if (fnd && fnd->pml_map.pm_vers == reg.pm_vers) {
- if (fnd->pml_map.pm_port == reg.pm_port) {
- ans = 1;
- goto done;
- }
- else {
- ans = 0;
- goto done;
- }
- } else {
- /*
- * add to END of list
- */
- pml = (struct pmaplist *)
- malloc((u_int)sizeof(struct pmaplist));
- pml->pml_map = reg;
- pml->pml_next = 0;
- if (pmaplist == 0) {
- pmaplist = pml;
- } else {
- for (fnd= pmaplist; fnd->pml_next != 0;
- fnd = fnd->pml_next);
- fnd->pml_next = pml;
- }
- ans = 1;
- }
- done:
- if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&ans)) &&
- debugging) {
- fprintf(stderr, "svc_sendreply\n");
- abort();
- }
- }
- break;
-
- case PMAPPROC_UNSET:
- /*
- * Remove a program,version to port mapping.
- */
- if (!svc_getargs(xprt, xdr_pmap, &reg))
- svcerr_decode(xprt);
- else {
- ans = 0;
- for (prevpml = NULL, pml = pmaplist; pml != NULL; ) {
- if ((pml->pml_map.pm_prog != reg.pm_prog) ||
- (pml->pml_map.pm_vers != reg.pm_vers)) {
- /* both pml & prevpml move forwards */
- prevpml = pml;
- pml = pml->pml_next;
- continue;
- }
- /* found it; pml moves forward, prevpml stays */
- ans = 1;
- t = (caddr_t)pml;
- pml = pml->pml_next;
- if (prevpml == NULL)
- pmaplist = pml;
- else
- prevpml->pml_next = pml;
- free(t);
- }
- if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&ans)) &&
- debugging) {
- fprintf(stderr, "svc_sendreply\n");
- abort();
- }
- }
- break;
-
- case PMAPPROC_GETPORT:
- /*
- * Lookup the mapping for a program,version and return its port
- */
- if (!svc_getargs(xprt, xdr_pmap, &reg))
- svcerr_decode(xprt);
- else {
- fnd = find_service(reg.pm_prog, reg.pm_vers, reg.pm_prot);
- if (fnd)
- port = fnd->pml_map.pm_port;
- else
- port = 0;
- if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&port)) &&
- debugging) {
- fprintf(stderr, "svc_sendreply\n");
- abort();
- }
- }
- break;
-
- case PMAPPROC_DUMP:
- /*
- * Return the current set of mapped program,version
- */
- if (!svc_getargs(xprt, xdr_void, NULL))
- svcerr_decode(xprt);
- else {
- if ((!svc_sendreply(xprt, xdr_pmaplist,
- (caddr_t)&pmaplist)) && debugging) {
- fprintf(stderr, "svc_sendreply\n");
- abort();
- }
- }
- break;
-
- case PMAPPROC_CALLIT:
- /*
- * Calls a procedure on the local machine. If the requested
- * procedure is not registered this procedure does not return
- * error information!!
- * This procedure is only supported on rpc/udp and calls via
- * rpc/udp. It passes null authentication parameters.
- */
- callit(rqstp, xprt);
- break;
-
- default:
- svcerr_noproc(xprt);
- break;
- }
-}
-
-
-/*
- * Stuff for the rmtcall service
- */
-#define ARGSIZE 9000
-
-typedef struct encap_parms {
- u_long arglen;
- char *args;
-};
-
-static bool_t
-xdr_encap_parms(xdrs, epp)
- XDR *xdrs;
- struct encap_parms *epp;
-{
-
- return (xdr_bytes(xdrs, &(epp->args), &(epp->arglen), ARGSIZE));
-}
-
-typedef struct rmtcallargs {
- u_long rmt_prog;
- u_long rmt_vers;
- u_long rmt_port;
- u_long rmt_proc;
- struct encap_parms rmt_args;
-};
-
-static bool_t
-xdr_rmtcall_args(xdrs, cap)
- register XDR *xdrs;
- register struct rmtcallargs *cap;
-{
-
- /* does not get a port number */
- if (xdr_u_long(xdrs, &(cap->rmt_prog)) &&
- xdr_u_long(xdrs, &(cap->rmt_vers)) &&
- xdr_u_long(xdrs, &(cap->rmt_proc))) {
- return (xdr_encap_parms(xdrs, &(cap->rmt_args)));
- }
- return (FALSE);
-}
-
-static bool_t
-xdr_rmtcall_result(xdrs, cap)
- register XDR *xdrs;
- register struct rmtcallargs *cap;
-{
- if (xdr_u_long(xdrs, &(cap->rmt_port)))
- return (xdr_encap_parms(xdrs, &(cap->rmt_args)));
- return (FALSE);
-}
-
-/*
- * only worries about the struct encap_parms part of struct rmtcallargs.
- * The arglen must already be set!!
- */
-static bool_t
-xdr_opaque_parms(xdrs, cap)
- XDR *xdrs;
- struct rmtcallargs *cap;
-{
-
- return (xdr_opaque(xdrs, cap->rmt_args.args, cap->rmt_args.arglen));
-}
-
-/*
- * This routine finds and sets the length of incoming opaque paraters
- * and then calls xdr_opaque_parms.
- */
-static bool_t
-xdr_len_opaque_parms(xdrs, cap)
- register XDR *xdrs;
- struct rmtcallargs *cap;
-{
- register u_int beginpos, lowpos, highpos, currpos, pos;
-
- beginpos = lowpos = pos = xdr_getpos(xdrs);
- highpos = lowpos + ARGSIZE;
- while ((int)(highpos - lowpos) >= 0) {
- currpos = (lowpos + highpos) / 2;
- if (xdr_setpos(xdrs, currpos)) {
- pos = currpos;
- lowpos = currpos + 1;
- } else {
- highpos = currpos - 1;
- }
- }
- xdr_setpos(xdrs, beginpos);
- cap->rmt_args.arglen = pos - beginpos;
- return (xdr_opaque_parms(xdrs, cap));
-}
-
-/*
- * Call a remote procedure service
- * This procedure is very quiet when things go wrong.
- * The proc is written to support broadcast rpc. In the broadcast case,
- * a machine should shut-up instead of complain, less the requestor be
- * overrun with complaints at the expense of not hearing a valid reply ...
- *
- * This now forks so that the program & process that it calls can call
- * back to the portmapper.
- */
-static
-callit(rqstp, xprt)
- struct svc_req *rqstp;
- SVCXPRT *xprt;
-{
- struct rmtcallargs a;
- struct pmaplist *pml;
- u_short port;
- struct sockaddr_in me;
- int pid, socket = -1;
- CLIENT *client;
- struct authunix_parms *au = (struct authunix_parms *)rqstp->rq_clntcred;
- struct timeval timeout;
- char buf[ARGSIZE];
-
- timeout.tv_sec = 5;
- timeout.tv_usec = 0;
- a.rmt_args.args = buf;
- if (!svc_getargs(xprt, xdr_rmtcall_args, &a))
- return;
- if ((pml = find_service(a.rmt_prog, a.rmt_vers, IPPROTO_UDP)) == NULL)
- return;
- /*
- * fork a child to do the work. Parent immediately returns.
- * Child exits upon completion.
- */
- if ((pid = fork()) != 0) {
- if (debugging && (pid < 0)) {
- fprintf(stderr, "portmap CALLIT: cannot fork.\n");
- }
- return;
- }
- port = pml->pml_map.pm_port;
- get_myaddress(&me);
- me.sin_port = htons(port);
- client = clntudp_create(&me, a.rmt_prog, a.rmt_vers, timeout, &socket);
- if (client != (CLIENT *)NULL) {
- if (rqstp->rq_cred.oa_flavor == AUTH_UNIX) {
- client->cl_auth = authunix_create(au->aup_machname,
- au->aup_uid, au->aup_gid, au->aup_len, au->aup_gids);
- }
- a.rmt_port = (u_long)port;
- if (clnt_call(client, a.rmt_proc, xdr_opaque_parms, &a,
- xdr_len_opaque_parms, &a, timeout) == RPC_SUCCESS) {
- svc_sendreply(xprt, xdr_rmtcall_result, &a);
- }
- AUTH_DESTROY(client->cl_auth);
- clnt_destroy(client);
- }
- (void)close(socket);
- exit(0);
-}
-
-void
-reap()
-{
- while (wait3(NULL, WNOHANG, NULL) > 0);
-}
diff --git a/lib/librpc/etc/rpc b/lib/librpc/etc/rpc
deleted file mode 100644
index bebfb51..0000000
--- a/lib/librpc/etc/rpc
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# rpc 88/08/01 4.0 RPCSRC; from 1.12 88/02/07 SMI
-#
-portmapper 100000 portmap sunrpc
-rstatd 100001 rstat rstat_svc rup perfmeter
-rusersd 100002 rusers
-nfs 100003 nfsprog
-ypserv 100004 ypprog
-mountd 100005 mount showmount
-ypbind 100007
-walld 100008 rwall shutdown
-yppasswdd 100009 yppasswd
-etherstatd 100010 etherstat
-rquotad 100011 rquotaprog quota rquota
-sprayd 100012 spray
-3270_mapper 100013
-rje_mapper 100014
-selection_svc 100015 selnsvc
-database_svc 100016
-rexd 100017 rex
-alis 100018
-sched 100019
-llockmgr 100020
-nlockmgr 100021
-x25.inr 100022
-statmon 100023
-status 100024
-bootparam 100026
-ypupdated 100028 ypupdate
-keyserv 100029 keyserver
-tfsd 100037
-nsed 100038
-nsemntd 100039
diff --git a/lib/librpc/etc/rpcinfo.c b/lib/librpc/etc/rpcinfo.c
deleted file mode 100644
index 961f9b0..0000000
--- a/lib/librpc/etc/rpcinfo.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/* @(#)rpcinfo.c 2.2 88/08/11 4.0 RPCSRC */
-#ifndef lint
-static char sccsid[] = "@(#)rpcinfo.c 1.22 87/08/12 SMI";
-#endif
-
-/*
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-/*
- * rpcinfo: ping a particular rpc program
- * or dump the portmapper
- */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-#include <rpc/rpc.h>
-#include <stdio.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <signal.h>
-#include <ctype.h>
-
-#define MAXHOSTLEN 256
-
-#define MIN_VERS ((u_long) 0)
-#define MAX_VERS ((u_long) 4294967295L)
-
-static void udpping(/*u_short portflag, int argc, char **argv*/);
-static void tcpping(/*u_short portflag, int argc, char **argv*/);
-static int pstatus(/*CLIENT *client, u_long prognum, u_long vers*/);
-static void pmapdump(/*int argc, char **argv*/);
-static bool_t reply_proc(/*void *res, struct sockaddr_in *who*/);
-static void brdcst(/*int argc, char **argv*/);
-static void deletereg(/* int argc, char **argv */) ;
-static void usage(/*void*/);
-static u_long getprognum(/*char *arg*/);
-static u_long getvers(/*char *arg*/);
-static void get_inet_address(/*struct sockaddr_in *addr, char *host*/);
-extern u_long inet_addr(); /* in 4.2BSD, arpa/inet.h called that a in_addr */
-extern char *inet_ntoa();
-
-/*
- * Functions to be performed.
- */
-#define NONE 0 /* no function */
-#define PMAPDUMP 1 /* dump portmapper registrations */
-#define TCPPING 2 /* ping TCP service */
-#define UDPPING 3 /* ping UDP service */
-#define BRDCST 4 /* ping broadcast UDP service */
-#define DELETES 5 /* delete registration for the service */
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- register int c;
- extern char *optarg;
- extern int optind;
- int errflg;
- int function;
- u_short portnum;
-
- function = NONE;
- portnum = 0;
- errflg = 0;
- while ((c = getopt(argc, argv, "ptubdn:")) != EOF) {
- switch (c) {
-
- case 'p':
- if (function != NONE)
- errflg = 1;
- else
- function = PMAPDUMP;
- break;
-
- case 't':
- if (function != NONE)
- errflg = 1;
- else
- function = TCPPING;
- break;
-
- case 'u':
- if (function != NONE)
- errflg = 1;
- else
- function = UDPPING;
- break;
-
- case 'b':
- if (function != NONE)
- errflg = 1;
- else
- function = BRDCST;
- break;
-
- case 'n':
- portnum = (u_short) atoi(optarg); /* hope we don't get bogus # */
- break;
-
- case 'd':
- if (function != NONE)
- errflg = 1;
- else
- function = DELETES;
- break;
-
- case '?':
- errflg = 1;
- }
- }
-
- if (errflg || function == NONE) {
- usage();
- return (1);
- }
-
- switch (function) {
-
- case PMAPDUMP:
- if (portnum != 0) {
- usage();
- return (1);
- }
- pmapdump(argc - optind, argv + optind);
- break;
-
- case UDPPING:
- udpping(portnum, argc - optind, argv + optind);
- break;
-
- case TCPPING:
- tcpping(portnum, argc - optind, argv + optind);
- break;
-
- case BRDCST:
- if (portnum != 0) {
- usage();
- return (1);
- }
- brdcst(argc - optind, argv + optind);
- break;
-
- case DELETES:
- deletereg(argc - optind, argv + optind);
- break;
- }
-
- return (0);
-}
-
-static void
-udpping(portnum, argc, argv)
- u_short portnum;
- int argc;
- char **argv;
-{
- struct timeval to;
- struct sockaddr_in addr;
- enum clnt_stat rpc_stat;
- CLIENT *client;
- u_long prognum, vers, minvers, maxvers;
- int sock = RPC_ANYSOCK;
- struct rpc_err rpcerr;
- int failure;
-
- if (argc < 2 || argc > 3) {
- usage();
- exit(1);
- }
- prognum = getprognum(argv[1]);
- get_inet_address(&addr, argv[0]);
- /* Open the socket here so it will survive calls to clnt_destroy */
- sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (sock < 0) {
- perror("rpcinfo: socket");
- exit(1);
- }
- failure = 0;
- if (argc == 2) {
- /*
- * A call to version 0 should fail with a program/version
- * mismatch, and give us the range of versions supported.
- */
- addr.sin_port = htons(portnum);
- to.tv_sec = 5;
- to.tv_usec = 0;
- if ((client = clntudp_create(&addr, prognum, (u_long)0,
- to, &sock)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu is not available\n",
- prognum);
- exit(1);
- }
- to.tv_sec = 10;
- to.tv_usec = 0;
- rpc_stat = clnt_call(client, NULLPROC, xdr_void, (char *)NULL,
- xdr_void, (char *)NULL, to);
- if (rpc_stat == RPC_PROGVERSMISMATCH) {
- clnt_geterr(client, &rpcerr);
- minvers = rpcerr.re_vers.low;
- maxvers = rpcerr.re_vers.high;
- } else if (rpc_stat == RPC_SUCCESS) {
- /*
- * Oh dear, it DOES support version 0.
- * Let's try version MAX_VERS.
- */
- addr.sin_port = htons(portnum);
- to.tv_sec = 5;
- to.tv_usec = 0;
- if ((client = clntudp_create(&addr, prognum, MAX_VERS,
- to, &sock)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, MAX_VERS);
- exit(1);
- }
- to.tv_sec = 10;
- to.tv_usec = 0;
- rpc_stat = clnt_call(client, NULLPROC, xdr_void,
- (char *)NULL, xdr_void, (char *)NULL, to);
- if (rpc_stat == RPC_PROGVERSMISMATCH) {
- clnt_geterr(client, &rpcerr);
- minvers = rpcerr.re_vers.low;
- maxvers = rpcerr.re_vers.high;
- } else if (rpc_stat == RPC_SUCCESS) {
- /*
- * It also supports version MAX_VERS.
- * Looks like we have a wise guy.
- * OK, we give them information on all
- * 4 billion versions they support...
- */
- minvers = 0;
- maxvers = MAX_VERS;
- } else {
- (void) pstatus(client, prognum, MAX_VERS);
- exit(1);
- }
- } else {
- (void) pstatus(client, prognum, (u_long)0);
- exit(1);
- }
- clnt_destroy(client);
- for (vers = minvers; vers <= maxvers; vers++) {
- addr.sin_port = htons(portnum);
- to.tv_sec = 5;
- to.tv_usec = 0;
- if ((client = clntudp_create(&addr, prognum, vers,
- to, &sock)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, vers);
- exit(1);
- }
- to.tv_sec = 10;
- to.tv_usec = 0;
- rpc_stat = clnt_call(client, NULLPROC, xdr_void,
- (char *)NULL, xdr_void, (char *)NULL, to);
- if (pstatus(client, prognum, vers) < 0)
- failure = 1;
- clnt_destroy(client);
- }
- }
- else {
- vers = getvers(argv[2]);
- addr.sin_port = htons(portnum);
- to.tv_sec = 5;
- to.tv_usec = 0;
- if ((client = clntudp_create(&addr, prognum, vers,
- to, &sock)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, vers);
- exit(1);
- }
- to.tv_sec = 10;
- to.tv_usec = 0;
- rpc_stat = clnt_call(client, 0, xdr_void, (char *)NULL,
- xdr_void, (char *)NULL, to);
- if (pstatus(client, prognum, vers) < 0)
- failure = 1;
- }
- (void) close(sock); /* Close it up again */
- if (failure)
- exit(1);
-}
-
-static void
-tcpping(portnum, argc, argv)
- u_short portnum;
- int argc;
- char **argv;
-{
- struct timeval to;
- struct sockaddr_in addr;
- enum clnt_stat rpc_stat;
- CLIENT *client;
- u_long prognum, vers, minvers, maxvers;
- int sock = RPC_ANYSOCK;
- struct rpc_err rpcerr;
- int failure;
-
- if (argc < 2 || argc > 3) {
- usage();
- exit(1);
- }
- prognum = getprognum(argv[1]);
- get_inet_address(&addr, argv[0]);
- failure = 0;
- if (argc == 2) {
- /*
- * A call to version 0 should fail with a program/version
- * mismatch, and give us the range of versions supported.
- */
- addr.sin_port = htons(portnum);
- if ((client = clnttcp_create(&addr, prognum, MIN_VERS,
- &sock, 0, 0)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu is not available\n",
- prognum);
- exit(1);
- }
- to.tv_sec = 10;
- to.tv_usec = 0;
- rpc_stat = clnt_call(client, NULLPROC, xdr_void, (char *)NULL,
- xdr_void, (char *)NULL, to);
- if (rpc_stat == RPC_PROGVERSMISMATCH) {
- clnt_geterr(client, &rpcerr);
- minvers = rpcerr.re_vers.low;
- maxvers = rpcerr.re_vers.high;
- } else if (rpc_stat == RPC_SUCCESS) {
- /*
- * Oh dear, it DOES support version 0.
- * Let's try version MAX_VERS.
- */
- addr.sin_port = htons(portnum);
- if ((client = clnttcp_create(&addr, prognum, MAX_VERS,
- &sock, 0, 0)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, MAX_VERS);
- exit(1);
- }
- to.tv_sec = 10;
- to.tv_usec = 0;
- rpc_stat = clnt_call(client, NULLPROC, xdr_void,
- (char *)NULL, xdr_void, (char *)NULL, to);
- if (rpc_stat == RPC_PROGVERSMISMATCH) {
- clnt_geterr(client, &rpcerr);
- minvers = rpcerr.re_vers.low;
- maxvers = rpcerr.re_vers.high;
- } else if (rpc_stat == RPC_SUCCESS) {
- /*
- * It also supports version MAX_VERS.
- * Looks like we have a wise guy.
- * OK, we give them information on all
- * 4 billion versions they support...
- */
- minvers = 0;
- maxvers = MAX_VERS;
- } else {
- (void) pstatus(client, prognum, MAX_VERS);
- exit(1);
- }
- } else {
- (void) pstatus(client, prognum, MIN_VERS);
- exit(1);
- }
- clnt_destroy(client);
- (void) close(sock);
- sock = RPC_ANYSOCK; /* Re-initialize it for later */
- for (vers = minvers; vers <= maxvers; vers++) {
- addr.sin_port = htons(portnum);
- if ((client = clnttcp_create(&addr, prognum, vers,
- &sock, 0, 0)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, vers);
- exit(1);
- }
- to.tv_usec = 0;
- to.tv_sec = 10;
- rpc_stat = clnt_call(client, 0, xdr_void, (char *)NULL,
- xdr_void, (char *)NULL, to);
- if (pstatus(client, prognum, vers) < 0)
- failure = 1;
- clnt_destroy(client);
- (void) close(sock);
- sock = RPC_ANYSOCK;
- }
- }
- else {
- vers = getvers(argv[2]);
- addr.sin_port = htons(portnum);
- if ((client = clnttcp_create(&addr, prognum, vers, &sock,
- 0, 0)) == NULL) {
- clnt_pcreateerror("rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, vers);
- exit(1);
- }
- to.tv_usec = 0;
- to.tv_sec = 10;
- rpc_stat = clnt_call(client, 0, xdr_void, (char *)NULL,
- xdr_void, (char *)NULL, to);
- if (pstatus(client, prognum, vers) < 0)
- failure = 1;
- }
- if (failure)
- exit(1);
-}
-
-/*
- * This routine should take a pointer to an "rpc_err" structure, rather than
- * a pointer to a CLIENT structure, but "clnt_perror" takes a pointer to
- * a CLIENT structure rather than a pointer to an "rpc_err" structure.
- * As such, we have to keep the CLIENT structure around in order to print
- * a good error message.
- */
-static int
-pstatus(client, prognum, vers)
- register CLIENT *client;
- u_long prognum;
- u_long vers;
-{
- struct rpc_err rpcerr;
-
- clnt_geterr(client, &rpcerr);
- if (rpcerr.re_status != RPC_SUCCESS) {
- clnt_perror(client, "rpcinfo");
- printf("program %lu version %lu is not available\n",
- prognum, vers);
- return (-1);
- } else {
- printf("program %lu version %lu ready and waiting\n",
- prognum, vers);
- return (0);
- }
-}
-
-static void
-pmapdump(argc, argv)
- int argc;
- char **argv;
-{
- struct sockaddr_in server_addr;
- register struct hostent *hp;
- struct pmaplist *head = NULL;
- int socket = RPC_ANYSOCK;
- struct timeval minutetimeout;
- register CLIENT *client;
- struct rpcent *rpc;
-
- if (argc > 1) {
- usage();
- exit(1);
- }
- if (argc == 1)
- get_inet_address(&server_addr, argv[0]);
- else {
- bzero((char *)&server_addr, sizeof server_addr);
- server_addr.sin_family = AF_INET;
- if ((hp = gethostbyname("localhost")) != NULL)
- bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr,
- hp->h_length);
- else
- server_addr.sin_addr.s_addr = inet_addr("0.0.0.0");
- }
- minutetimeout.tv_sec = 60;
- minutetimeout.tv_usec = 0;
- server_addr.sin_port = htons(PMAPPORT);
- if ((client = clnttcp_create(&server_addr, PMAPPROG,
- PMAPVERS, &socket, 50, 500)) == NULL) {
- clnt_pcreateerror("rpcinfo: can't contact portmapper");
- exit(1);
- }
- if (clnt_call(client, PMAPPROC_DUMP, xdr_void, NULL,
- xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) {
- fprintf(stderr, "rpcinfo: can't contact portmapper: ");
- clnt_perror(client, "rpcinfo");
- exit(1);
- }
- if (head == NULL) {
- printf("No remote programs registered.\n");
- } else {
- printf(" program vers proto port\n");
- for (; head != NULL; head = head->pml_next) {
- printf("%10ld%5ld",
- head->pml_map.pm_prog,
- head->pml_map.pm_vers);
- if (head->pml_map.pm_prot == IPPROTO_UDP)
- printf("%6s", "udp");
- else if (head->pml_map.pm_prot == IPPROTO_TCP)
- printf("%6s", "tcp");
- else
- printf("%6ld", head->pml_map.pm_prot);
- printf("%7ld", head->pml_map.pm_port);
- rpc = getrpcbynumber(head->pml_map.pm_prog);
- if (rpc)
- printf(" %s\n", rpc->r_name);
- else
- printf("\n");
- }
- }
-}
-
-/*
- * reply_proc collects replies from the broadcast.
- * to get a unique list of responses the output of rpcinfo should
- * be piped through sort(1) and then uniq(1).
- */
-
-/*ARGSUSED*/
-static bool_t
-reply_proc(res, who)
- void *res; /* Nothing comes back */
- struct sockaddr_in *who; /* Who sent us the reply */
-{
- register struct hostent *hp;
-
- hp = gethostbyaddr((char *) &who->sin_addr, sizeof who->sin_addr,
- AF_INET);
- printf("%s %s\n", inet_ntoa(who->sin_addr),
- (hp == NULL) ? "(unknown)" : hp->h_name);
- return(FALSE);
-}
-
-static void
-brdcst(argc, argv)
- int argc;
- char **argv;
-{
- enum clnt_stat rpc_stat;
- u_long prognum, vers;
-
- if (argc != 2) {
- usage();
- exit(1);
- }
- prognum = getprognum(argv[0]);
- vers = getvers(argv[1]);
- rpc_stat = clnt_broadcast(prognum, vers, NULLPROC, xdr_void,
- (char *)NULL, xdr_void, (char *)NULL, reply_proc);
- if ((rpc_stat != RPC_SUCCESS) && (rpc_stat != RPC_TIMEDOUT)) {
- fprintf(stderr, "rpcinfo: broadcast failed: %s\n",
- clnt_sperrno(rpc_stat));
- exit(1);
- }
- exit(0);
-}
-
-static void
-deletereg(argc, argv)
- int argc;
- char **argv;
-{ u_long prog_num, version_num ;
-
- if (argc != 2) {
- usage() ;
- exit(1) ;
- }
- if (getuid()) { /* This command allowed only to root */
- fprintf(stderr, "Sorry. You are not root\n") ;
- exit(1) ;
- }
- prog_num = getprognum(argv[0]);
- version_num = getvers(argv[1]);
- if ((pmap_unset(prog_num, version_num)) == 0) {
- fprintf(stderr, "rpcinfo: Could not delete registration for prog %s version %s\n",
- argv[0], argv[1]) ;
- exit(1) ;
- }
-}
-
-static void
-usage()
-{
- fprintf(stderr, "Usage: rpcinfo [ -n portnum ] -u host prognum [ versnum ]\n");
- fprintf(stderr, " rpcinfo [ -n portnum ] -t host prognum [ versnum ]\n");
- fprintf(stderr, " rpcinfo -p [ host ]\n");
- fprintf(stderr, " rpcinfo -b prognum versnum\n");
- fprintf(stderr, " rpcinfo -d prognum versnum\n") ;
-}
-
-static u_long
-getprognum(arg)
- char *arg;
-{
- register struct rpcent *rpc;
- register u_long prognum;
-
- if (isalpha(*arg)) {
- rpc = getrpcbyname(arg);
- if (rpc == NULL) {
- fprintf(stderr, "rpcinfo: %s is unknown service\n",
- arg);
- exit(1);
- }
- prognum = rpc->r_number;
- } else {
- prognum = (u_long) atoi(arg);
- }
-
- return (prognum);
-}
-
-static u_long
-getvers(arg)
- char *arg;
-{
- register u_long vers;
-
- vers = (int) atoi(arg);
- return (vers);
-}
-
-static void
-get_inet_address(addr, host)
- struct sockaddr_in *addr;
- char *host;
-{
- register struct hostent *hp;
-
- bzero((char *)addr, sizeof *addr);
- addr->sin_addr.s_addr = (u_long) inet_addr(host);
- if (addr->sin_addr.s_addr == -1 || addr->sin_addr.s_addr == 0) {
- if ((hp = gethostbyname(host)) == NULL) {
- fprintf(stderr, "rpcinfo: %s is unknown host\n", host);
- exit(1);
- }
- bcopy(hp->h_addr, (char *)&addr->sin_addr, hp->h_length);
- }
- addr->sin_family = AF_INET;
-}
diff --git a/lib/librpc/man/man1/rpcgen.1 b/lib/librpc/man/man1/rpcgen.1
deleted file mode 100644
index 6c50cec..0000000
--- a/lib/librpc/man/man1/rpcgen.1
+++ /dev/null
@@ -1,197 +0,0 @@
-.\" Copyright 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Derived from Sun Microsystems rpcgen.1 2.2 88/08/02 4.0 RPCSRC
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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.
-.\"
-.\" @(#)rpcgen.1 5.4 (Berkeley) 12/30/93
-.\"
-.Dd December 30, 1993
-.Dt RPCGEN 1
-.Sh NAME
-.Nm rpcgen
-.Nd an
-.Tn RPC
-protocol compiler
-.Sh SYNOPSIS
-.Nm rpcgen Ar infile
-.Nm rpcgen
-.Fl c | Fl h | Fl l |
-.Fl m
-.Op Fl o Ar outfile
-.Op Ar infile
-.Nm rpcgen Fl s Ar transport
-.Op Fl o Ar outfile
-.Op Ar infile
-.Sh DESCRIPTION
-.Nm rpcgen
-is a tool that generates
-.Tn \&C
-code to implement an
-.Tn RPC
-protocol. The input to
-.Nm rpcgen
-is a language similar to C
-known as
-.Tn RPC
-Language (Remote Procedure Call Language). Information
-about the syntax of
-.Tn RPC
-Language is available in the
-.Rs
-.%T "Rpcgen Programming Guide"
-.Re
-.Pp
-Available options:
-.Bl -tag -width indent
-.It Fl c
-Compile into
-.Dv XDR
-routines.
-.It Fl h
-Compile into
-.Tn \&C
-data-definitions (a header file)
-.It Fl l
-Compile into client-side stubs.
-.It Fl m
-Compile into server-side stubs, but do not generate a
-.Em main
-routine.
-This option is useful for doing callback-routines and for people who
-need to write their own
-.Em main
-routine to do initialization.
-.It Fl o Ar outfile
-Specify the name of the output file.
-If none is specified, standard output is used
-.Pf ( Fl c ,
-.Fl h ,
-.Fl l
-and
-.Fl s
-modes only).
-.It Fl s Ar transport
-Compile into server-side stubs, using the given transport. The
-supported transports
-are
-.Tn UDP
-and
-.Tn TCP .
-This option may be invoked more than once
-so as to compile a server that serves multiple transports.
-.El
-.Pp
-.Nm rpcgen
-is normally used as in the first synopsis where it takes an input file
-and generates four output files. If the
-.Ar infile
-is named
-.Pa proto.x ,
-then
-.Nm rpcgen
-will generate a header file in
-.Pa proto.h ,
-.Dv XDR
-routines in
-.Pa proto_xdr.c ,
-server-side stubs in
-.Pa proto_svc.c ,
-and client-side stubs in
-.Pa proto_clnt.c .
-.Pp
-The other synopses shown above are used when one does not want to
-generate all the output files, but only a particular one. Their
-usage is described in the
-.Sx USAGE
-section below.
-.Pp
-The C-preprocessor,
-.Xr cpp 1 ,
-is run on all input files before they are actually
-interpreted by
-.Nm rpcgen ,
-so all the
-.Xr cpp
-directives are legal within an
-.Nm rpcgen
-input file. For each type of output file,
-.Nm rpcgen
-defines a special
-.Xr cpp
-symbol for use by the
-.Nm rpcgen
-programmer:
-.Pp
-.Bl -tag -width "RPC_CLNT"
-.It Dv RPC_HDR
-defined when compiling into header files
-.It Dv RPC_XDR
-defined when compiling into
-.Dv XDR
-routines
-.It Dv RPC_SVC
-defined when compiling into server-side stubs
-.It Dv RPC_CLNT
-defined when compiling into client-side stubs
-.El
-.Pp
-In addition,
-.Nm rpcgen
-does a little preprocessing of its own.
-Any line beginning with
-.Ql \&%
-is passed directly into the output file, uninterpreted by
-.Nm rpcgen .
-.Pp
-You can customize some of your
-.Dv XDR
-routines by leaving those data
-types undefined. For every data type that is undefined,
-.Nm rpcgen
-will assume that there exists a routine with the name
-.Em xdr_
-prepended to the name of the undefined type.
-.Sh SEE ALSO
-.Xr cpp 1
-.Rs
-.%T "Rpcgen Programming Guide"
-.%I "Sun Microsystems"
-.Re
-.Sh BUGS
-.Pp
-Nesting is not supported.
-As a work-around, structures can be declared at
-top-level, and their name used inside other structures in order to achieve
-the same effect.
-.Pp
-Name clashes can occur when using program definitions, since the apparent
-scoping does not really apply. Most of these can be avoided by giving
-unique names for programs, versions, procedures and types.
diff --git a/lib/librpc/man/man1/rstat.1 b/lib/librpc/man/man1/rstat.1
deleted file mode 100644
index 52eaa31..0000000
--- a/lib/librpc/man/man1/rstat.1
+++ /dev/null
@@ -1,57 +0,0 @@
-.\" @(#)rstat.1 2.1 88/08/03 4.0 RPCSRC
-.TH RSTAT 1 "3 August 1988"
-.SH NAME
-rstat \- remote status display
-.SH SYNOPSIS
-.B rstat
-.B host
-.SH DESCRIPTION
-.LP
-.B rstat
-displays a summary of the current system status of a particular
-.BR host .
-The output shows the current time of day, how long the system has
-been up,
-and the load averages.
-The load average numbers give the number of jobs in the run queue
-averaged over 1, 5 and 15 minutes.
-.PP
-The
-.B rstat_svc(8c)
-daemon must be running on the remote host for this command to
-work.
-.B rstat
-uses an RPC protocol defined in /usr/include/rpcsvc/rstat.x.
-.SH EXAMPLE
-.RS
-.ft B
-.nf
-example% rstat otherhost
-7:36am up 6 days, 16:45, load average: 0.20, 0.23, 0.18
-example%
-.ft R
-.fi
-.RE
-.SH DIAGNOSTICS
-.LP
-rstat: RPC: Program not registered
-.IP
-The
-.B rstat_svc
-daemon has not been started on the remote host.
-.LP
-rstat: RPC: Timed out
-.IP
-A communication error occurred. Either the network is
-excessively congested, or the
-.B rstat_svc
-daemon has terminated on the remote host.
-.LP
-rstat: RPC: Port mapper failure - RPC: Timed out
-.IP
-The remote host is not running the portmapper (see
-.BR portmap(8c) ),
-and cannot accommodate any RPC-based services. The host may be down.
-.SH "SEE ALSO"
-.BR portmap (8c),
-.BR rstat_svc (8c)
diff --git a/lib/librpc/man/man3/bindresvport.3n b/lib/librpc/man/man3/bindresvport.3n
deleted file mode 100644
index 1fb1f9a..0000000
--- a/lib/librpc/man/man3/bindresvport.3n
+++ /dev/null
@@ -1,27 +0,0 @@
-.\" @(#)bindresvport.3n 2.2 88/08/02 4.0 RPCSRC; from 1.7 88/03/14 SMI
-.TH BINDRESVPORT 3N "22 november 1987"
-.SH NAME
-bindresvport \- bind a socket to a privileged IP port
-.SH SYNOPSIS
-.nf
-.B #include <sys/types.h>
-.B #include <netinet/in.h>
-.LP
-.B int bindresvport(sd, sin)
-.B int sd;
-.B struct sockaddr_in \(**sin;
-.fi
-.SH DESCRIPTION
-.LP
-.B bindresvport(\|)
-is used to bind a socket descriptor to a privileged
-.SM IP
-port, that is, a
-port number in the range 0-1023.
-The routine returns 0 if it is successful,
-otherwise \-1 is returned and
-.B errno
-set to reflect the cause of the error.
-.LP
-Only root can bind to a privileged port; this call will fail for any
-other users.
diff --git a/lib/librpc/man/man3/getrpcent.3n b/lib/librpc/man/man3/getrpcent.3n
deleted file mode 100644
index f500c01..0000000
--- a/lib/librpc/man/man3/getrpcent.3n
+++ /dev/null
@@ -1,109 +0,0 @@
-.\" @(#)getrpcent.3n 2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI
-.TH GETRPCENT 3N "14 December 1987"
-.SH NAME
-getrpcent, getrpcbyname, getrpcbynumber \- get RPC entry
-.SH SYNOPSIS
-.nf
-.ft B
-#include <netdb.h>
-.LP
-.ft B
-struct rpcent *getrpcent(\|)
-.LP
-.ft B
-struct rpcent *getrpcbyname(name)
-char *name;
-.LP
-.ft B
-struct rpcent *getrpcbynumber(number)
-int number;
-.LP
-.ft B
-setrpcent (stayopen)
-int stayopen
-.LP
-.ft B
-endrpcent (\|)
-.fi
-.SH DESCRIPTION
-.LP
-.BR getrpcent(\|) ,
-.BR getrpcbyname(\|) ,
-and
-.B getrpcbynumber(\|)
-each return a pointer to an object with the
-following structure
-containing the broken-out
-fields of a line in the rpc program number data base,
-.BR /etc/rpc .
-.RS
-.LP
-.nf
-.ft B
-struct rpcent {
- char *r_name; /* name of server for this rpc program */
- char **r_aliases; /* alias list */
- long r_number; /* rpc program number */
-};
-.ft R
-.fi
-.RE
-.LP
-The members of this structure are:
-.RS
-.PD 0
-.TP 20
-.B r_name
-The name of the server for this rpc program.
-.TP 20
-.B r_aliases
-A zero terminated list of alternate names for the rpc program.
-.TP 20
-.B r_number
-The rpc program number for this service.
-.PD
-.RE
-.LP
-.B getrpcent(\|)
-reads the next line of the file, opening the file if necessary.
-.LP
-.B getrpcent(\|)
-opens and rewinds the file. If the
-.I stayopen
-flag is non-zero,
-the net data base will not be closed after each call to
-.B getrpcent(\|)
-(either directly, or indirectly through one of
-the other \*(lqgetrpc\*(rq calls).
-.LP
-.B endrpcent
-closes the file.
-.LP
-.B getrpcbyname(\|)
-and
-.B getrpcbynumber(\|)
-sequentially search from the beginning
-of the file until a matching rpc program name or
-program number is found, or until end-of-file is encountered.
-.SH FILES
-.PD 0
-.TP 20
-.B /etc/rpc
-.PD
-.SH "SEE ALSO"
-.BR rpc (5),
-.BR rpcinfo (8C),
-.BR ypserv (8)
-.SH DIAGNOSTICS
-.LP
-A
-.SM NULL
-pointer is returned on
-.SM EOF
-or error.
-.SH BUGS
-.LP
-All information
-is contained in a static area
-so it must be copied if it is
-to be saved.
diff --git a/lib/librpc/man/man3/getrpcport.3r b/lib/librpc/man/man3/getrpcport.3r
deleted file mode 100644
index 0323d34..0000000
--- a/lib/librpc/man/man3/getrpcport.3r
+++ /dev/null
@@ -1,31 +0,0 @@
-.\" @(#)getrpcport.3r 2.2 88/08/02 4.0 RPCSRC; from 1.12 88/02/26 SMI
-.TH GETRPCPORT 3R "6 October 1987"
-.SH NAME
-getrpcport \- get RPC port number
-.SH SYNOPSIS
-.ft B
-.nf
-int getrpcport(host, prognum, versnum, proto)
- char *host;
- int prognum, versnum, proto;
-.fi
-.SH DESCRIPTION
-.IX getrpcport "" "\fLgetrpcport\fR \(em get RPC port number"
-.B getrpcport(\|)
-returns the port number for version
-.I versnum
-of the RPC program
-.I prognum
-running on
-.I host
-and using protocol
-.IR proto .
-It returns 0 if it cannot contact the portmapper, or if
-.I prognum
-is not registered. If
-.I prognum
-is registered but not with version
-.IR versnum ,
-it will still return a port number (for some version of the program)
-indicating that the program is indeed registered.
-The version mismatch will be detected upon the first call to the service.
diff --git a/lib/librpc/man/man3/rpc.3n b/lib/librpc/man/man3/rpc.3n
deleted file mode 100644
index b5a2b92..0000000
--- a/lib/librpc/man/man3/rpc.3n
+++ /dev/null
@@ -1,1729 +0,0 @@
-.\" @(#)rpc.3n 2.4 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
-.TH RPC 3N "16 February 1988"
-.SH NAME
-rpc \- library routines for remote procedure calls
-.SH SYNOPSIS AND DESCRIPTION
-These routines allow C programs to make procedure
-calls on other machines across the network.
-First, the client calls a procedure to send a
-data packet to the server.
-Upon receipt of the packet, the server calls a dispatch routine
-to perform the requested service, and then sends back a
-reply.
-Finally, the procedure call returns to the client.
-.LP
-Routines that are used for Secure RPC (DES authentication) are described in
-.BR rpc_secure (3N).
-Secure RPC can be used only if DES encryption is available.
-.LP
-.ft B
-.nf
-.sp .5
-#include <rpc/rpc.h>
-.fi
-.ft R
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-auth_destroy(auth)
-\s-1AUTH\s0 *auth;
-.fi
-.ft R
-.IP
-A macro that destroys the authentication information associated with
-.IR auth .
-Destruction usually involves deallocation of private data
-structures. The use of
-.I auth
-is undefined after calling
-.BR auth_destroy(\|) .
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-\s-1AUTH\s0 *
-authnone_create(\|)
-.fi
-.ft R
-.IP
-Create and returns an
-.SM RPC
-authentication handle that passes nonusable authentication
-information with each remote procedure call. This is the
-default authentication used by
-.SM RPC.
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-\s-1AUTH\s0 *
-authunix_create(host, uid, gid, len, aup_gids)
-char *host;
-int uid, gid, len, *aup.gids;
-.fi
-.ft R
-.IP
-Create and return an
-.SM RPC
-authentication handle that contains
-.UX
-authentication information.
-The parameter
-.I host
-is the name of the machine on which the information was
-created;
-.I uid
-is the user's user
-.SM ID ;
-.I gid
-is the user's current group
-.SM ID ;
-.I len
-and
-.I aup_gids
-refer to a counted array of groups to which the user belongs.
-It is easy to impersonate a user.
-.br
-.if t .ne 5
-.LP
-.ft B
-.nf
-.sp .5
-\s-1AUTH\s0 *
-authunix_create_default(\|)
-.fi
-.ft R
-.IP
-Calls
-.B authunix_create(\|)
-with the appropriate parameters.
-.br
-.if t .ne 13
-.LP
-.ft B
-.nf
-.sp .5
-callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
-char *host;
-u_long prognum, versnum, procnum;
-char *in, *out;
-xdrproc_t inproc, outproc;
-.fi
-.ft R
-.IP
-Call the remote procedure associated with
-.IR prognum ,
-.IR versnum ,
-and
-.I procnum
-on the machine,
-.IR host .
-The parameter
-.I in
-is the address of the procedure's argument(s), and
-.I out
-is the address of where to place the result(s);
-.I inproc
-is used to encode the procedure's parameters, and
-.I outproc
-is used to decode the procedure's results.
-This routine returns zero if it succeeds, or the value of
-.B "enum clnt_stat"
-cast to an integer if it fails.
-The routine
-.B clnt_perrno(\|)
-is handy for translating failure statuses into messages.
-.IP
-Warning: calling remote procedures with this routine
-uses
-.SM UDP/IP
-as a transport; see
-.B clntudp_create(\|)
-for restrictions.
-You do not have control of timeouts or authentication using
-this routine.
-.br
-.if t .ne 16
-.LP
-.ft B
-.nf
-.sp .5
-enum clnt_stat
-clnt_broadcast(prognum, versnum, procnum, inproc, in, outproc, out, eachresult)
-u_long prognum, versnum, procnum;
-char *in, *out;
-xdrproc_t inproc, outproc;
-resultproc_t eachresult;
-.fi
-.ft R
-.IP
-Like
-.BR callrpc(\|) ,
-except the call message is broadcast to all locally
-connected broadcast nets. Each time it receives a
-response, this routine calls
-.BR eachresult(\|) ,
-whose form is:
-.IP
-.RS 1i
-.ft B
-.nf
-eachresult(out, addr)
-char *out;
-struct sockaddr_in *addr;
-.ft R
-.fi
-.RE
-.IP
-where
-.I out
-is the same as
-.I out
-passed to
-.BR clnt_broadcast(\|) ,
-except that the remote procedure's output is decoded there;
-.I addr
-points to the address of the machine that sent the results.
-If
-.B eachresult(\|)
-returns zero,
-.B clnt_broadcast(\|)
-waits for more replies; otherwise it returns with appropriate
-status.
-.IP
-Warning: broadcast sockets are limited in size to the
-maximum transfer unit of the data link. For ethernet,
-this value is 1500 bytes.
-.br
-.if t .ne 13
-.LP
-.ft B
-.nf
-.sp .5
-enum clnt_stat
-clnt_call(clnt, procnum, inproc, in, outproc, out, tout)
-\s-1CLIENT\s0 *clnt;
-u_long
-procnum;
-xdrproc_t inproc, outproc;
-char *in, *out;
-struct timeval tout;
-.fi
-.ft R
-.IP
-A macro that calls the remote procedure
-.I procnum
-associated with the client handle,
-.IR clnt ,
-which is obtained with an
-.SM RPC
-client creation routine such as
-.BR clnt_create(\|) .
-The parameter
-.I in
-is the address of the procedure's argument(s), and
-.I out
-is the address of where to place the result(s);
-.I inproc
-is used to encode the procedure's parameters, and
-.I outproc
-is used to decode the procedure's results;
-.I tout
-is the time allowed for results to come back.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-clnt_destroy(clnt)
-\s-1CLIENT\s0 *clnt;
-.fi
-.ft R
-.IP
-A macro that destroys the client's
-.SM RPC
-handle. Destruction usually involves deallocation
-of private data structures, including
-.I clnt
-itself. Use of
-.I clnt
-is undefined after calling
-.BR clnt_destroy(\|) .
-If the
-.SM RPC
-library opened the associated socket, it will close it also.
-Otherwise, the socket remains open.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-\s-1CLIENT\s0 *
-clnt_create(host, prog, vers, proto)
-char *host;
-u_long prog, vers;
-char *proto;
-.fi
-.ft R
-.IP
-Generic client creation routine.
-.I host
-identifies the name of the remote host where the server
-is located.
-.I proto
-indicates which kind of transport protocol to use. The
-currently supported values for this field are \(lqudp\(rq
-and \(lqtcp\(rq.
-Default timeouts are set, but can be modified using
-.BR clnt_control(\|) .
-.IP
-Warning: Using
-.SM UDP
-has its shortcomings. Since
-.SM UDP\s0-based
-.SM RPC
-messages can only hold up to 8 Kbytes of encoded data,
-this transport cannot be used for procedures that take
-large arguments or return huge results.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-bool_t
-clnt_control(cl, req, info)
-\s-1CLIENT\s0 *cl;
-char *info;
-.fi
-.ft R
-.IP
-A macro used to change or retrieve various information
-about a client object.
-.I req
-indicates the type of operation, and
-.I info
-is a pointer to the information. For both
-.SM UDP
-and
-.SM TCP\s0,
-the supported values of
-.I req
-and their argument types and what they do are:
-.IP
-.nf
-.ta +2.0i +2.0i +2.0i
-.SM CLSET_TIMEOUT\s0 struct timeval set total timeout
-.SM CLGET_TIMEOUT\s0 struct timeval get total timeout
-.fi
-.IP
-Note: if you set the timeout using
-.BR clnt_control(\|) ,
-the timeout parameter passed to
-.B clnt_call(\|)
-will be ignored in all future calls.
-.IP
-.nf
-.SM CLGET_SERVER_ADDR\s0 struct sockaddr_in get server's address
-.fi
-.br
-.IP
-The following operations are valid for
-.SM UDP
-only:
-.IP
-.nf
-.ta +2.0i ; +2.0i ; +2.0i
-.SM CLSET_RETRY_TIMEOUT\s0 struct timeval set the retry timeout
-.SM CLGET_RETRY_TIMEOUT\s0 struct timeval get the retry timeout
-.fi
-.br
-.IP
-The retry timeout is the time that
-.SM "UDP RPC"
-waits for the server to reply before
-retransmitting the request.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-clnt_freeres(clnt, outproc, out)
-\s-1CLIENT\s0 *clnt;
-xdrproc_t outproc;
-char *out;
-.fi
-.ft R
-.IP
-A macro that frees any data allocated by the
-.SM RPC/XDR
-system when it decoded the results of an
-.SM RPC
-call. The
-parameter
-.I out
-is the address of the results, and
-.I outproc
-is the
-.SM XDR
-routine describing the results.
-This routine returns one if the results were successfully
-freed,
-and zero otherwise.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-void
-clnt_geterr(clnt, errp)
-\s-1CLIENT\s0 *clnt;
-struct rpc_err *errp;
-.fi
-.ft R
-.IP
-A macro that copies the error structure out of the client
-handle
-to the structure at address
-.IR errp .
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-clnt_pcreateerror(s)
-char *s;
-.fi
-.ft R
-.IP
-Print a message to standard error indicating
-why a client
-.SM RPC
-handle could not be created.
-The message is prepended with string
-.I s
-and a colon.
-Used when a
-.BR clnt_create(\|) ,
-.BR clntraw_create(\|) ,
-.BR clnttcp_create(\|) ,
-or
-.B clntudp_create(\|)
-call fails.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-clnt_perrno(stat)
-enum clnt_stat stat;
-.fi
-.ft R
-.IP
-Print a message to standard error corresponding
-to the condition indicated by
-.IR stat .
-Used after
-.BR callrpc(\|) .
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-clnt_perror(clnt, s)
-\s-1CLIENT\s0 *clnt;
-char *s;
-.fi
-.ft R
-.IP
-Print a message to standard error indicating why an
-.SM RPC
-call failed;
-.I clnt
-is the handle used to do the call.
-The message is prepended with string
-.I s
-and a colon.
-Used after
-.BR clnt_call(\|) .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-char *
-clnt_spcreateerror
-char *s;
-.fi
-.ft R
-.IP
-Like
-.BR clnt_pcreateerror(\|) ,
-except that it returns a string
-instead of printing to the standard error.
-.IP
-Bugs: returns pointer to static data that is overwritten
-on each call.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-char *
-clnt_sperrno(stat)
-enum clnt_stat stat;
-.fi
-.ft R
-.IP
-Take the same arguments as
-.BR clnt_perrno(\|) ,
-but instead of sending a message to the standard error
-indicating why an
-.SM RPC
-call failed, return a pointer to a string which contains
-the message. The string ends with a
-.SM NEWLINE\s0.
-.IP
-.B clnt_sperrno(\|)
-is used instead of
-.B clnt_perrno(\|)
-if the program does not have a standard error (as a program
-running as a server quite likely does not), or if the
-programmer
-does not want the message to be output with
-.BR printf ,
-or if a message format different than that supported by
-.B clnt_perrno(\|)
-is to be used.
-Note: unlike
-.B clnt_sperror(\|)
-and
-.BR clnt_spcreaterror(\|) ,
-.B clnt_sperrno(\|)
-returns pointer to static data, but the
-result will not get overwritten on each call.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-char *
-clnt_sperror(rpch, s)
-\s-1CLIENT\s0 *rpch;
-char *s;
-.fi
-.ft R
-.IP
-Like
-.BR clnt_perror(\|) ,
-except that (like
-.BR clnt_sperrno(\|) )
-it returns a string instead of printing to standard error.
-.IP
-Bugs: returns pointer to static data that is overwritten
-on each call.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-\s-1CLIENT\s0 *
-clntraw_create(prognum, versnum)
-u_long prognum, versnum;
-.fi
-.ft R
-.IP
-This routine creates a toy
-.SM RPC
-client for the remote program
-.IR prognum ,
-version
-.IR versnum .
-The transport used to pass messages to the service is
-actually a buffer within the process's address space, so the
-corresponding
-.SM RPC
-server should live in the same address space; see
-.BR svcraw_create(\|) .
-This allows simulation of
-.SM RPC
-and acquisition of
-.SM RPC
-overheads, such as round trip times, without any
-kernel interference. This routine returns
-.SM NULL
-if it fails.
-.br
-.if t .ne 15
-.LP
-.ft B
-.nf
-.sp .5
-\s-1CLIENT\s0 *
-clnttcp_create(addr, prognum, versnum, sockp, sendsz, recvsz)
-struct sockaddr_in *addr;
-u_long prognum, versnum;
-int *sockp;
-u_int sendsz, recvsz;
-.fi
-.ft R
-.IP
-This routine creates an
-.SM RPC
-client for the remote program
-.IR prognum ,
-version
-.IR versnum ;
-the client uses
-.SM TCP/IP
-as a transport. The remote program is located at Internet
-address
-.IR *addr .
-If
-.\"The following in-line font conversion is necessary for the hyphen indicator
-\fB\%addr\->sin_port\fR
-is zero, then it is set to the actual port that the remote
-program is listening on (the remote
-.B portmap
-service is consulted for this information). The parameter
-.I sockp
-is a socket; if it is
-.BR \s-1RPC_ANYSOCK\s0 ,
-then this routine opens a new one and sets
-.IR sockp .
-Since
-.SM TCP\s0-based
-.SM RPC
-uses buffered
-.SM I/O ,
-the user may specify the size of the send and receive buffers
-with the parameters
-.I sendsz
-and
-.IR recvsz ;
-values of zero choose suitable defaults.
-This routine returns
-.SM NULL
-if it fails.
-.br
-.if t .ne 15
-.LP
-.ft B
-.nf
-.sp .5
-\s-1CLIENT\s0 *
-clntudp_create(addr, prognum, versnum, wait, sockp)
-struct sockaddr_in *addr;
-u_long prognum, versnum;
-struct timeval wait;
-int *sockp;
-.fi
-.ft R
-.IP
-This routine creates an
-.SM RPC
-client for the remote program
-.IR prognum ,
-version
-.IR versnum ;
-the client uses use
-.SM UDP/IP
-as a transport. The remote program is located at Internet
-address
-.IR addr .
-If
-\fB\%addr\->sin_port\fR
-is zero, then it is set to actual port that the remote
-program is listening on (the remote
-.B portmap
-service is consulted for this information). The parameter
-.I sockp
-is a socket; if it is
-.BR \s-1RPC_ANYSOCK\s0 ,
-then this routine opens a new one and sets
-.IR sockp .
-The
-.SM UDP
-transport resends the call message in intervals of
-.B wait
-time until a response is received or until the call times
-out.
-The total time for the call to time out is specified by
-.BR clnt_call(\|) .
-.IP
-Warning: since
-.SM UDP\s0-based
-.SM RPC
-messages can only hold up to 8 Kbytes
-of encoded data, this transport cannot be used for procedures
-that take large arguments or return huge results.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-\s-1CLIENT\s0 *
-clntudp_bufcreate(addr, prognum, versnum, wait, sockp, sendsize, recosize)
-struct sockaddr_in *addr;
-u_long prognum, versnum;
-struct timeval wait;
-int *sockp;
-unsigned int sendsize;
-unsigned int recosize;
-.fi
-.ft R
-.IP
-This routine creates an
-.SM RPC
-client for the remote program
-.IR prognum ,
-on
-.IR versnum ;
-the client uses use
-.SM UDP/IP
-as a transport. The remote program is located at Internet
-address
-.IR addr .
-If
-\fB\%addr\->sin_port\fR
-is zero, then it is set to actual port that the remote
-program is listening on (the remote
-.B portmap
-service is consulted for this information). The parameter
-.I sockp
-is a socket; if it is
-.BR \s-1RPC_ANYSOCK\s0 ,
-then this routine opens a new one and sets
-.BR sockp .
-The
-.SM UDP
-transport resends the call message in intervals of
-.B wait
-time until a response is received or until the call times
-out.
-The total time for the call to time out is specified by
-.BR clnt_call(\|) .
-.IP
-This allows the user to specify the maximun packet size for sending and receiving
-.SM UDP\s0-based
-.SM RPC
-messages.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-get_myaddress(addr)
-struct sockaddr_in *addr;
-.fi
-.ft R
-.IP
-Stuff the machine's
-.SM IP
-address into
-.IR *addr ,
-without consulting the library routines that deal with
-.BR /etc/hosts .
-The port number is always set to
-.BR htons(\s-1PMAPPORT\s0) .
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-struct pmaplist *
-pmap_getmaps(addr)
-struct sockaddr_in *addr;
-.fi
-.ft R
-.IP
-A user interface to the
-.B portmap
-service, which returns a list of the current
-.SM RPC
-program-to-port mappings
-on the host located at
-.SM IP
-address
-.IR *addr .
-This routine can return
-.SM NULL .
-The command
-.RB ` "rpcinfo \-p" '
-uses this routine.
-.br
-.if t .ne 12
-.LP
-.ft B
-.nf
-.sp .5
-u_short
-pmap_getport(addr, prognum, versnum, protocol)
-struct sockaddr_in *addr;
-u_long prognum, versnum, protocol;
-.fi
-.ft R
-.IP
-A user interface to the
-.B portmap
-service, which returns the port number
-on which waits a service that supports program number
-.IR prognum ,
-version
-.IR versnum ,
-and speaks the transport protocol associated with
-.IR protocol .
-The value of
-.I protocol
-is most likely
-.B
-.SM IPPROTO_UDP
-or
-.BR \s-1IPPROTO_TCP\s0 .
-A return value of zero means that the mapping does not exist
-or that
-the
-.SM RPC
-system failured to contact the remote
-.B portmap
-service. In the latter case, the global variable
-.B rpc_createerr(\|)
-contains the
-.SM RPC
-status.
-.br
-.if t .ne 15
-.LP
-.ft B
-.nf
-.sp .5
-enum clnt_stat
-pmap_rmtcall(addr, prognum, versnum, procnum, inproc, in, outproc, out, tout, portp)
-struct sockaddr_in *addr;
-u_long prognum, versnum, procnum;
-char *in, *out;
-xdrproc_t inproc, outproc;
-struct timeval tout;
-u_long *portp;
-.fi
-.ft R
-.IP
-A user interface to the
-.B portmap
-service, which instructs
-.B portmap
-on the host at
-.SM IP
-address
-.I *addr
-to make an
-.SM RPC
-call on your behalf to a procedure on that host.
-The parameter
-.I *portp
-will be modified to the program's port number if the
-procedure
-succeeds. The definitions of other parameters are discussed
-in
-.B callrpc(\|)
-and
-.BR clnt_call(\|) .
-This procedure should be used for a \(lqping\(rq and nothing
-else.
-See also
-.BR clnt_broadcast(\|) .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-pmap_set(prognum, versnum, protocol, port)
-u_long prognum, versnum, protocol;
-u_short port;
-.fi
-.ft R
-.IP
-A user interface to the
-.B portmap
-service, which establishes a mapping between the triple
-.RI [ prognum , versnum , protocol\fR]
-and
-.I port
-on the machine's
-.B portmap
-service. The value of
-.I protocol
-is most likely
-.B
-.SM IPPROTO_UDP
-or
-.BR \s-1IPPROTO_TCP\s0 .
-This routine returns one if it succeeds, zero otherwise.
-Automatically done by
-.BR svc_register(\|) .
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-pmap_unset(prognum, versnum)
-u_long prognum, versnum;
-.fi
-.ft R
-.IP
-A user interface to the
-.B portmap
-service, which destroys all mapping between the triple
-.RI [ prognum , versnum , *\fR]
-and
-.B ports
-on the machine's
-.B portmap
-service. This routine returns one if it succeeds, zero
-otherwise.
-.br
-.if t .ne 15
-.LP
-.ft B
-.nf
-.sp .5
-registerrpc(prognum, versnum, procnum, procname, inproc, outproc)
-u_long prognum, versnum, procnum;
-char *(*procname) (\|) ;
-xdrproc_t inproc, outproc;
-.fi
-.ft R
-.IP
-Register procedure
-.I procname
-with the
-.SM RPC
-service package. If a request arrives for program
-.IR prognum ,
-version
-.IR versnum ,
-and procedure
-.IR procnum ,
-.I procname
-is called with a pointer to its parameter(s);
-.I progname
-should return a pointer to its static result(s);
-.I inproc
-is used to decode the parameters while
-.I outproc
-is used to encode the results.
-This routine returns zero if the registration succeeded, \-1
-otherwise.
-.IP
-Warning: remote procedures registered in this form
-are accessed using the
-.SM UDP/IP
-transport; see
-.B svcudp_create(\|)
-for restrictions.
-.br
-.if t .ne 5
-.LP
-.ft B
-.nf
-.sp .5
-struct rpc_createerr rpc_createerr;
-.fi
-.ft R
-.IP
-A global variable whose value is set by any
-.SM RPC
-client creation routine
-that does not succeed. Use the routine
-.B clnt_pcreateerror(\|)
-to print the reason why.
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-svc_destroy(xprt)
-\s-1SVCXPRT\s0 *
-xprt;
-.fi
-.ft R
-.IP
-A macro that destroys the
-.SM RPC
-service transport handle,
-.IR xprt .
-Destruction usually involves deallocation
-of private data structures, including
-.I xprt
-itself. Use of
-.I xprt
-is undefined after calling this routine.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-fd_set svc_fdset;
-.fi
-.ft R
-.IP
-A global variable reflecting the
-.SM RPC
-service side's
-read file descriptor bit mask; it is suitable as a parameter
-to the
-.B select
-system call. This is only of interest
-if a service implementor does not call
-.BR svc_run(\|) ,
-but rather does his own asynchronous event processing.
-This variable is read-only (do not pass its address to
-.BR select !),
-yet it may change after calls to
-.B svc_getreqset(\|)
-or any creation routines.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-int svc_fds;
-.fi
-.ft R
-.IP
-Similar to
-.BR svc_fedset(\|) ,
-but limited to 32 descriptors. This
-interface is obsoleted by
-.BR svc_fdset(\|) .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-svc_freeargs(xprt, inproc, in)
-\s-1SVCXPRT\s0 *xprt;
-xdrproc_t inproc;
-char *in;
-.fi
-.ft R
-.IP
-A macro that frees any data allocated by the
-.SM RPC/XDR
-system when it decoded the arguments to a service procedure
-using
-.BR svc_getargs(\|) .
-This routine returns 1 if the results were successfully
-freed,
-and zero otherwise.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-svc_getargs(xprt, inproc, in)
-\s-1SVCXPRT\s0 *xprt;
-xdrproc_t inproc;
-char *in;
-.fi
-.ft R
-.IP
-A macro that decodes the arguments of an
-.SM RPC
-request
-associated with the
-.SM RPC
-service transport handle,
-.IR xprt .
-The parameter
-.I in
-is the address where the arguments will be placed;
-.I inproc
-is the
-.SM XDR
-routine used to decode the arguments.
-This routine returns one if decoding succeeds, and zero
-otherwise.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-struct sockaddr_in *
-svc_getcaller(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-The approved way of getting the network address of the caller
-of a procedure associated with the
-.SM RPC
-service transport handle,
-.IR xprt .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-svc_getreqset(rdfds)
-fd_set *rdfds;
-.fi
-.ft R
-.IP
-This routine is only of interest if a service implementor
-does not call
-.BR svc_run(\|) ,
-but instead implements custom asynchronous event processing.
-It is called when the
-.B select
-system call has determined that an
-.SM RPC
-request has arrived on some
-.SM RPC
-.B socket(s) ;
-.I rdfds
-is the resultant read file descriptor bit mask.
-The routine returns when all sockets associated with the
-value of
-.I rdfds
-have been serviced.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-svc_getreq(rdfds)
-int rdfds;
-.fi
-.ft R
-.IP
-Similar to
-.BR svc_getreqset(\|) ,
-but limited to 32 descriptors. This interface is obsoleted by
-.BR svc_getreqset(\|) .
-.br
-.if t .ne 17
-.LP
-.ft B
-.nf
-.sp .5
-svc_register(xprt, prognum, versnum, dispatch, protocol)
-\s-1SVCXPRT\s0 *xprt;
-u_long prognum, versnum;
-void (*dispatch) (\|);
-u_long protocol;
-.fi
-.ft R
-.IP
-Associates
-.I prognum
-and
-.I versnum
-with the service dispatch procedure,
-.IR dispatch .
-If
-.I protocol
-is zero, the service is not registered with the
-.B portmap
-service. If
-.I protocol
-is non-zero, then a mapping of the triple
-.RI [ prognum , versnum , protocol\fR]
-to
-\fB\%xprt\->xp_port\fR
-is established with the local
-.B portmap
-service (generally
-.I protocol
-is zero,
-.B
-.SM IPPROTO_UDP
-or
-.B
-.SM IPPROTO_TCP
-).
-The procedure
-.I dispatch
-has the following form:
-.RS 1i
-.ft B
-.nf
-dispatch(request, xprt)
-struct svc_req *request;
-\s-1SVCXPRT\s0 *xprt;
-.ft R
-.fi
-.RE
-.IP
-The
-.B svc_register(\|)
-routine returns one if it succeeds, and zero otherwise.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-svc_run(\|)
-.fi
-.ft R
-.IP
-This routine never returns. It waits for
-.SM RPC
-requests to arrive, and calls the appropriate service
-procedure using
-.B svc_getreq(\|)
-when one arrives. This procedure is usually waiting for a
-.B select(\|)
-system call to return.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-svc_sendreply(xprt, outproc, out)
-\s-1SVCXPRT\s0 *xprt;
-xdrproc_t outproc;
-char *out;
-.fi
-.ft R
-.IP
-Called by an
-.SM RPC
-service's dispatch routine to send the results of a
-remote procedure call. The parameter
-.I xprt
-is the request's associated transport handle;
-.I outproc
-is the
-.SM XDR
-routine which is used to encode the results; and
-.I out
-is the address of the results.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-svc_unregister(prognum, versnum)
-u_long prognum, versnum;
-.fi
-.ft R
-.IP
-Remove all mapping of the double
-.RI [ prognum , versnum ]
-to dispatch routines, and of the triple
-.RI [ prognum , versnum , *\fR]
-to port number.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_auth(xprt, why)
-\s-1SVCXPRT\s0 *xprt;
-enum auth_stat why;
-.fi
-.ft R
-.IP
-Called by a service dispatch routine that refuses to perform
-a remote procedure call due to an authentication error.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_decode(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Called by a service dispatch routine that cannot successfully
-decode its parameters. See also
-.BR svc_getargs(\|) .
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_noproc(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Called by a service dispatch routine that does not implement
-the procedure number that the caller requests.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_noprog(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Called when the desired program is not registered with the
-.SM RPC
-package. Service implementors usually do not need this routine.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_progvers(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Called when the desired version of a program is not registered
-with the
-.SM RPC
-package. Service implementors usually do not need this routine.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_systemerr(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Called by a service dispatch routine when it detects a system
-error
-not covered by any particular protocol.
-For example, if a service can no longer allocate storage,
-it may call this routine.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-svcerr_weakauth(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Called by a service dispatch routine that refuses to perform
-a remote procedure call due to insufficient
-authentication parameters. The routine calls
-.BR "svcerr_auth(xprt, \s-1AUTH_TOOWEAK\s0)" .
-.br
-.if t .ne 11
-.LP
-.ft B
-.nf
-.sp .5
-\s-1SVCXPRT\s0 *
-svcraw_create(\|)
-.fi
-.ft R
-.IP
-This routine creates a toy
-.SM RPC
-service transport, to which it returns a pointer. The
-transport
-is really a buffer within the process's address space,
-so the corresponding
-.SM RPC
-client should live in the same
-address space;
-see
-.BR clntraw_create(\|) .
-This routine allows simulation of
-.SM RPC
-and acquisition of
-.SM RPC
-overheads (such as round trip times), without any kernel
-interference.
-This routine returns
-.SM NULL
-if it fails.
-.br
-.if t .ne 11
-.LP
-.ft B
-.nf
-.sp .5
-\s-1SVCXPRT\s0 *
-svctcp_create(sock, send_buf_size, recv_buf_size)
-int sock;
-u_int send_buf_size, recv_buf_size;
-.fi
-.ft R
-.IP
-This routine creates a
-.SM TCP/IP\s0-based
-.SM RPC
-service transport, to which it returns a pointer.
-The transport is associated with the socket
-.IR sock ,
-which may be
-.BR \s-1RPC_ANYSOCK\s0 ,
-in which case a new socket is created.
-If the socket is not bound to a local
-.SM TCP
-port, then this routine binds it to an arbitrary port. Upon
-completion,
-\fB\%xprt\->xp_sock\fR
-is the transport's socket descriptor, and
-\fB\%xprt\->xp_port\fR
-is the transport's port number.
-This routine returns
-.SM NULL
-if it fails. Since
-.SM TCP\s0-based
-.SM RPC
-uses buffered
-.SM I/O ,
-users may specify the size of buffers; values of zero
-choose suitable defaults.
-.br
-.if t .ne 11
-.LP
-.ft B
-.nf
-.sp .5
-\s-1SVCXPRT\s0 *
-svcfd_create(fd, sendsize, recvsize)
-int fd;
-u_int sendsize;
-u_int recvsize;
-.fi
-.ft R
-.IP
-Create a service on top of any open descriptor. Typically,
-this
-descriptor is a connected socket for a stream protocol such
-as
-.SM TCP\s0.
-.I sendsize
-and
-.I recvsize
-indicate sizes for the send and receive buffers. If they are
-zero, a reasonable default is chosen.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-\s-1SVCXPRT\s0 *
-svcudp_bufcreate(sock, sendsize, recosize)
-int sock;
-.fi
-.ft R
-.IP
-This routine creates a
-.SM UDP/IP\s0-based
-.SM RPC
-service transport, to which it returns a pointer.
-The transport is associated with the socket
-.IR sock ,
-which may be
-.B \s-1RPC_ANYSOCK\s0 ,
-in which case a new socket is created.
-If the socket is not bound to a local
-.SM UDP
-port, then this routine binds it to an arbitrary port. Upon
-completion,
-\fB\%xprt\->xp_sock\fR
-is the transport's socket descriptor, and
-\fB\%xprt\->xp_port\fR
-is the transport's port number.
-This routine returns
-.SM NULL
-if it fails.
-.IP
-This allows the user to specify the maximun packet size for sending and
-receiving
-.SM UDP\s0-based
-.SM RPC messages.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_accepted_reply(xdrs, ar)
-\s-1XDR\s0 *xdrs;
-struct accepted_reply *ar;
-.fi
-.ft R
-.IP
-Used for encoding
-.SM RPC
-reply messages. This routine is useful for users who
-wish to generate
-\s-1RPC\s0-style
-messages without using the
-.SM RPC
-package.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_authunix_parms(xdrs, aupp)
-\s-1XDR\s0 *xdrs;
-struct authunix_parms *aupp;
-.fi
-.ft R
-.IP
-Used for describing
-.SM UNIX
-credentials. This routine is useful for users
-who wish to generate these credentials without using the
-.SM RPC
-authentication package.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-void
-xdr_callhdr(xdrs, chdr)
-\s-1XDR\s0 *xdrs;
-struct rpc_msg *chdr;
-.fi
-.ft R
-.IP
-Used for describing
-.SM RPC
-call header messages.
-This routine is useful for users who wish to generate
-.SM RPC\s0-style
-messages without using the
-.SM RPC
-package.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_callmsg(xdrs, cmsg)
-\s-1XDR\s0 *xdrs;
-struct rpc_msg *cmsg;
-.fi
-.ft R
-.IP
-Used for describing
-.SM RPC
-call messages.
-This routine is useful for users who wish to generate
-.SM RPC\s0-style
-messages without using the
-.SM RPC
-package.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_opaque_auth(xdrs, ap)
-\s-1XDR\s0 *xdrs;
-struct opaque_auth *ap;
-.fi
-.ft R
-.IP
-Used for describing
-.SM RPC
-authentication information messages.
-This routine is useful for users who wish to generate
-.SM RPC\s0-style
-messages without using the
-.SM RPC
-package.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_pmap(xdrs, regs)
-\s-1XDR\s0 *xdrs;
-struct pmap *regs;
-.fi
-.ft R
-.IP
-Used for describing parameters to various
-.B portmap
-procedures, externally.
-This routine is useful for users who wish to generate
-these parameters without using the
-.B pmap
-interface.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_pmaplist(xdrs, rp)
-\s-1XDR\s0 *xdrs;
-struct pmaplist **rp;
-.fi
-.ft R
-.IP
-Used for describing a list of port mappings, externally.
-This routine is useful for users who wish to generate
-these parameters without using the
-.B pmap
-interface.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_rejected_reply(xdrs, rr)
-\s-1XDR\s0 *xdrs;
-struct rejected_reply *rr;
-.fi
-.ft R
-.IP
-Used for describing
-.SM RPC
-reply messages.
-This routine is useful for users who wish to generate
-.SM RPC\s0-style
-messages without using the
-.SM RPC
-package.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-xdr_replymsg(xdrs, rmsg)
-\s-1XDR\s0 *xdrs;
-struct rpc_msg *rmsg;
-.fi
-.ft R
-.IP
-Used for describing
-.SM RPC
-reply messages.
-This routine is useful for users who wish to generate
-.SM RPC
-style messages without using the
-.SM RPC
-package.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-xprt_register(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-After
-.SM RPC
-service transport handles are created,
-they should register themselves with the
-.SM RPC
-service package.
-This routine modifies the global variable
-.BR svc_fds(\|) .
-Service implementors usually do not need this routine.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-xprt_unregister(xprt)
-\s-1SVCXPRT\s0 *xprt;
-.fi
-.ft R
-.IP
-Before an
-.SM RPC
-service transport handle is destroyed,
-it should unregister itself with the
-.SM RPC
-service package.
-This routine modifies the global variable
-.BR svc_fds(\|) .
-Service implementors usually do not need this routine.
-.SH SEE ALSO
-.BR rpc_secure (3N),
-.BR xdr (3N)
-.br
-The following manuals:
-.RS
-.ft I
-Remote Procedure Calls: Protocol Specification
-.br
-Remote Procedure Call Programming Guide
-.br
-rpcgen Programming Guide
-.br
-.ft R
-.RE
-.IR "\s-1RPC\s0: Remote Procedure Call Protocol Specification" ,
-.SM RFC1050, Sun Microsystems, Inc.,
-.SM USC-ISI\s0.
-
diff --git a/lib/librpc/man/man3/xdr.3n b/lib/librpc/man/man3/xdr.3n
deleted file mode 100644
index b656ea8..0000000
--- a/lib/librpc/man/man3/xdr.3n
+++ /dev/null
@@ -1,823 +0,0 @@
-.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
-.TH XDR 3N "16 February 1988"
-.SH NAME
-xdr \- library routines for external data representation
-.SH SYNOPSIS AND DESCRIPTION
-.LP
-These routines allow C programmers to describe
-arbitrary data structures in a machine-independent fashion.
-Data for remote procedure calls are transmitted using these
-routines.
-.LP
-.ft B
-.nf
-.sp .5
-xdr_array(xdrs, arrp, sizep, maxsize, elsize, elproc)
-\s-1XDR\s0 *xdrs;
-char **arrp;
-u_int *sizep, maxsize, elsize;
-xdrproc_t elproc;
-.fi
-.ft R
-.IP
-A filter primitive that translates between variable-length
-arrays
-and their corresponding external representations. The
-parameter
-.I arrp
-is the address of the pointer to the array, while
-.I sizep
-is the address of the element count of the array;
-this element count cannot exceed
-.IR maxsize .
-The parameter
-.I elsize
-is the
-.I sizeof
-each of the array's elements, and
-.I elproc
-is an
-.SM XDR
-filter that translates between
-the array elements' C form, and their external
-representation.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-xdr_bool(xdrs, bp)
-\s-1XDR\s0 *xdrs;
-bool_t *bp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between booleans (C
-integers)
-and their external representations. When encoding data, this
-filter produces values of either one or zero.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-xdr_bytes(xdrs, sp, sizep, maxsize)
-\s-1XDR\s0 *xdrs;
-char **sp;
-u_int *sizep, maxsize;
-.fi
-.ft R
-.IP
-A filter primitive that translates between counted byte
-strings and their external representations.
-The parameter
-.I sp
-is the address of the string pointer. The length of the
-string is located at address
-.IR sizep ;
-strings cannot be longer than
-.IR maxsize .
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_char(xdrs, cp)
-\s-1XDR\s0 *xdrs;
-char *cp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C characters
-and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-Note: encoded characters are not packed, and occupy 4 bytes
-each. For arrays of characters, it is worthwhile to
-consider
-.BR xdr_bytes(\|) ,
-.B xdr_opaque(\|)
-or
-.BR xdr_string(\|) .
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-void
-xdr_destroy(xdrs)
-\s-1XDR\s0 *xdrs;
-.fi
-.ft R
-.IP
-A macro that invokes the destroy routine associated with the
-.SM XDR
-stream,
-.IR xdrs .
-Destruction usually involves freeing private data structures
-associated with the stream. Using
-.I xdrs
-after invoking
-.B xdr_destroy(\|)
-is undefined.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_double(xdrs, dp)
-\s-1XDR\s0 *xdrs;
-double *dp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.B double
-precision numbers and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_enum(xdrs, ep)
-\s-1XDR\s0 *xdrs;
-enum_t *ep;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.BR enum s
-(actually integers) and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-xdr_float(xdrs, fp)
-\s-1XDR\s0 *xdrs;
-float *fp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.BR float s
-and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-void
-xdr_free(proc, objp)
-xdrproc_t proc;
-char *objp;
-.fi
-.ft R
-.IP
-Generic freeing routine. The first argument is the
-.SM XDR
-routine for the object being freed. The second argument
-is a pointer to the object itself. Note: the pointer passed
-to this routine is
-.I not
-freed, but what it points to
-.I is
-freed (recursively).
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-u_int
-xdr_getpos(xdrs)
-\s-1XDR\s0 *xdrs;
-.fi
-.ft R
-.IP
-A macro that invokes the get-position routine
-associated with the
-.SM XDR
-stream,
-.IR xdrs .
-The routine returns an unsigned integer,
-which indicates the position of the
-.SM XDR
-byte stream.
-A desirable feature of
-.SM XDR
-streams is that simple arithmetic works with this number,
-although the
-.SM XDR
-stream instances need not guarantee this.
-.br
-.if t .ne 4
-.LP
-.ft B
-.nf
-.sp .5
-.br
-long *
-xdr_inline(xdrs, len)
-\s-1XDR\s0 *xdrs;
-int len;
-.fi
-.ft R
-.IP
-A macro that invokes the in-line routine associated with the
-.SM XDR
-stream,
-.IR xdrs .
-The routine returns a pointer
-to a contiguous piece of the stream's buffer;
-.I len
-is the byte length of the desired buffer.
-Note: pointer is cast to
-.BR "long *" .
-.IP
-Warning:
-.B xdr_inline(\|)
-may return
-.SM NULL
-(0)
-if it cannot allocate a contiguous piece of a buffer.
-Therefore the behavior may vary among stream instances;
-it exists for the sake of efficiency.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_int(xdrs, ip)
-\s-1XDR\s0 *xdrs;
-int *ip;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C integers
-and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_long(xdrs, lp)
-\s-1XDR\s0 *xdrs;
-long *lp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.B long
-integers and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 12
-.LP
-.ft B
-.nf
-.sp .5
-void
-xdrmem_create(xdrs, addr, size, op)
-\s-1XDR\s0 *xdrs;
-char *addr;
-u_int size;
-enum xdr_op op;
-.fi
-.ft R
-.IP
-This routine initializes the
-.SM XDR
-stream object pointed to by
-.IR xdrs .
-The stream's data is written to, or read from,
-a chunk of memory at location
-.I addr
-whose length is no more than
-.I size
-bytes long. The
-.I op
-determines the direction of the
-.SM XDR
-stream
-(either
-.BR \s-1XDR_ENCODE\s0 ,
-.BR \s-1XDR_DECODE\s0 ,
-or
-.BR \s-1XDR_FREE\s0 ).
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-xdr_opaque(xdrs, cp, cnt)
-\s-1XDR\s0 *xdrs;
-char *cp;
-u_int cnt;
-.fi
-.ft R
-.IP
-A filter primitive that translates between fixed size opaque
-data
-and its external representation.
-The parameter
-.I cp
-is the address of the opaque object, and
-.I cnt
-is its size in bytes.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-xdr_pointer(xdrs, objpp, objsize, xdrobj)
-\s-1XDR\s0 *xdrs;
-char **objpp;
-u_int objsize;
-xdrproc_t xdrobj;
-.fi
-.ft R
-.IP
-Like
-.B xdr_reference(\|)
-execpt that it serializes
-.SM NULL
-pointers, whereas
-.B xdr_reference(\|)
-does not. Thus,
-.B xdr_pointer(\|)
-can represent
-recursive data structures, such as binary trees or
-linked lists.
-.br
-.if t .ne 15
-.LP
-.ft B
-.nf
-.sp .5
-void
-xdrrec_create(xdrs, sendsize, recvsize, handle, readit, writeit)
-\s-1XDR\s0 *xdrs;
-u_int sendsize, recvsize;
-char *handle;
-int (*readit) (\|), (*writeit) (\|);
-.fi
-.ft R
-.IP
-This routine initializes the
-.SM XDR
-stream object pointed to by
-.IR xdrs .
-The stream's data is written to a buffer of size
-.IR sendsize ;
-a value of zero indicates the system should use a suitable
-default. The stream's data is read from a buffer of size
-.IR recvsize ;
-it too can be set to a suitable default by passing a zero
-value.
-When a stream's output buffer is full,
-.I writeit
-is called. Similarly, when a stream's input buffer is empty,
-.I readit
-is called. The behavior of these two routines is similar to
-the
-system calls
-.B read
-and
-.BR write ,
-except that
-.I handle
-is passed to the former routines as the first parameter.
-Note: the
-.SM XDR
-stream's
-.I op
-field must be set by the caller.
-.IP
-Warning: this
-.SM XDR
-stream implements an intermediate record stream.
-Therefore there are additional bytes in the stream
-to provide record boundary information.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-xdrrec_endofrecord(xdrs, sendnow)
-\s-1XDR\s0 *xdrs;
-int sendnow;
-.fi
-.ft R
-.IP
-This routine can be invoked only on
-streams created by
-.BR xdrrec_create(\|) .
-The data in the output buffer is marked as a completed
-record,
-and the output buffer is optionally written out if
-.I sendnow
-is non-zero. This routine returns one if it succeeds, zero
-otherwise.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-xdrrec_eof(xdrs)
-\s-1XDR\s0 *xdrs;
-int empty;
-.fi
-.ft R
-.IP
-This routine can be invoked only on
-streams created by
-.BR xdrrec_create(\|) .
-After consuming the rest of the current record in the stream,
-this routine returns one if the stream has no more input,
-zero otherwise.
-.br
-.if t .ne 3
-.LP
-.ft B
-.nf
-.sp .5
-xdrrec_skiprecord(xdrs)
-\s-1XDR\s0 *xdrs;
-.fi
-.ft R
-.IP
-This routine can be invoked only on
-streams created by
-.BR xdrrec_create(\|) .
-It tells the
-.SM XDR
-implementation that the rest of the current record
-in the stream's input buffer should be discarded.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 11
-.LP
-.ft B
-.nf
-.sp .5
-xdr_reference(xdrs, pp, size, proc)
-\s-1XDR\s0 *xdrs;
-char **pp;
-u_int size;
-xdrproc_t proc;
-.fi
-.ft R
-.IP
-A primitive that provides pointer chasing within structures.
-The parameter
-.I pp
-is the address of the pointer;
-.I size
-is the
-.I sizeof
-the structure that
-.I *pp
-points to; and
-.I proc
-is an
-.SM XDR
-procedure that filters the structure
-between its C form and its external representation.
-This routine returns one if it succeeds, zero otherwise.
-.IP
-Warning: this routine does not understand
-.SM NULL
-pointers. Use
-.B xdr_pointer(\|)
-instead.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-xdr_setpos(xdrs, pos)
-\s-1XDR\s0 *xdrs;
-u_int pos;
-.fi
-.ft R
-.IP
-A macro that invokes the set position routine associated with
-the
-.SM XDR
-stream
-.IR xdrs .
-The parameter
-.I pos
-is a position value obtained from
-.BR xdr_getpos(\|) .
-This routine returns one if the
-.SM XDR
-stream could be repositioned,
-and zero otherwise.
-.IP
-Warning: it is difficult to reposition some types of
-.SM XDR
-streams, so this routine may fail with one
-type of stream and succeed with another.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-xdr_short(xdrs, sp)
-\s-1XDR\s0 *xdrs;
-short *sp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.B short
-integers and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-void
-xdrstdio_create(xdrs, file, op)
-\s-1XDR\s0 *xdrs;
-\s-1FILE\s0 *file;
-enum xdr_op op;
-.fi
-.ft R
-.IP
-This routine initializes the
-.SM XDR
-stream object pointed to by
-.IR xdrs .
-The
-.SM XDR
-stream data is written to, or read from, the Standard
-.B I/O
-stream
-.IR file .
-The parameter
-.I op
-determines the direction of the
-.SM XDR
-stream (either
-.BR \s-1XDR_ENCODE\s0 ,
-.BR \s-1XDR_DECODE\s0 ,
-or
-.BR \s-1XDR_FREE\s0 ).
-.IP
-Warning: the destroy routine associated with such
-.SM XDR
-streams calls
-.B fflush(\|)
-on the
-.I file
-stream, but never
-.BR fclose(\|) .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-xdr_string(xdrs, sp, maxsize)
-\s-1XDR\s0
-*xdrs;
-char **sp;
-u_int maxsize;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C strings and
-their
-corresponding external representations.
-Strings cannot be longer than
-.IR maxsize .
-Note:
-.I sp
-is the address of the string's pointer.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-xdr_u_char(xdrs, ucp)
-\s-1XDR\s0 *xdrs;
-unsigned char *ucp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between
-.B unsigned
-C characters and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-xdr_u_int(xdrs, up)
-\s-1XDR\s0 *xdrs;
-unsigned *up;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.B unsigned
-integers and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_u_long(xdrs, ulp)
-\s-1XDR\s0 *xdrs;
-unsigned long *ulp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.B "unsigned long"
-integers and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-xdr_u_short(xdrs, usp)
-\s-1XDR\s0 *xdrs;
-unsigned short *usp;
-.fi
-.ft R
-.IP
-A filter primitive that translates between C
-.B "unsigned short"
-integers and their external representations.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 16
-.LP
-.ft B
-.nf
-.sp .5
-xdr_union(xdrs, dscmp, unp, choices, dfault)
-\s-1XDR\s0 *xdrs;
-int *dscmp;
-char *unp;
-struct xdr_discrim *choices;
-bool_t (*defaultarm) (\|); /* may equal \s-1NULL\s0 */
-.fi
-.ft R
-.IP
-A filter primitive that translates between a discriminated C
-.B union
-and its corresponding external representation. It first
-translates the discriminant of the union located at
-.IR dscmp .
-This discriminant is always an
-.BR enum_t .
-Next the union located at
-.I unp
-is translated. The parameter
-.I choices
-is a pointer to an array of
-.B xdr_discrim(\|)
-structures. Each structure contains an ordered pair of
-.RI [ value , proc ].
-If the union's discriminant is equal to the associated
-.IR value ,
-then the
-.I proc
-is called to translate the union. The end of the
-.B xdr_discrim(\|)
-structure array is denoted by a routine of value
-.SM NULL\s0.
-If the discriminant is not found in the
-.I choices
-array, then the
-.I defaultarm
-procedure is called (if it is not
-.SM NULL\s0).
-Returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-xdr_vector(xdrs, arrp, size, elsize, elproc)
-\s-1XDR\s0 *xdrs;
-char *arrp;
-u_int size, elsize;
-xdrproc_t elproc;
-.fi
-.ft R
-.IP
-A filter primitive that translates between fixed-length
-arrays
-and their corresponding external representations. The
-parameter
-.I arrp
-is the address of the pointer to the array, while
-.I size
-is is the element count of the array. The parameter
-.I elsize
-is the
-.I sizeof
-each of the array's elements, and
-.I elproc
-is an
-.SM XDR
-filter that translates between
-the array elements' C form, and their external
-representation.
-This routine returns one if it succeeds, zero otherwise.
-.br
-.if t .ne 5
-.LP
-.ft B
-.nf
-.sp .5
-xdr_void(\|)
-.fi
-.ft R
-.IP
-This routine always returns one.
-It may be passed to
-.SM RPC
-routines that require a function parameter,
-where nothing is to be done.
-.br
-.if t .ne 10
-.LP
-.ft B
-.nf
-.sp .5
-xdr_wrapstring(xdrs, sp)
-\s-1XDR\s0 *xdrs;
-char **sp;
-.fi
-.ft R
-.IP
-A primitive that calls
-.B "xdr_string(xdrs, sp,\s-1MAXUN.UNSIGNED\s0 );"
-where
-.B
-.SM MAXUN.UNSIGNED
-is the maximum value of an unsigned integer.
-.B xdr_wrapstring(\|)
-is handy because the
-.SM RPC
-package passes a maximum of two
-.SM XDR
-routines as parameters, and
-.BR xdr_string(\|) ,
-one of the most frequently used primitives, requires three.
-Returns one if it succeeds, zero otherwise.
-.SH SEE ALSO
-.BR rpc (3N)
-.LP
-The following manuals:
-.RS
-.ft I
-eXternal Data Representation Standard: Protocol Specification
-.br
-eXternal Data Representation: Sun Technical Notes
-.ft R
-.br
-.IR "\s-1XDR\s0: External Data Representation Standard" ,
-.SM RFC1014, Sun Microsystems, Inc.,
-.SM USC-ISI\s0.
diff --git a/lib/librpc/man/man5/rpc.5 b/lib/librpc/man/man5/rpc.5
deleted file mode 100644
index 324ecb1..0000000
--- a/lib/librpc/man/man5/rpc.5
+++ /dev/null
@@ -1,71 +0,0 @@
-.\" @(#)rpc.5 2.2 88/08/03 4.0 RPCSRC; from 1.4 87/11/27 SMI;
-.TH RPC 5 "26 September 1985"
-.SH NAME
-rpc \- rpc program number data base
-.SH SYNOPSIS
-.B /etc/rpc
-.SH DESCRIPTION
-The
-.I rpc
-file contains user readable names that
-can be used in place of rpc program numbers.
-Each line has the following information:
-.HP 10
-name of server for the rpc program
-.br
-.ns
-.HP 10
-rpc program number
-.br
-.ns
-.HP 10
-aliases
-.LP
-Items are separated by any number of blanks and/or
-tab characters.
-A ``#'' indicates the beginning of a comment; characters up to the end of
-the line are not interpreted by routines which search the file.
-.LP
-Here is an example of the \fI/etc/rpc\fP file from the Sun RPC Source
-distribution.
-.nf
-.ta 1.5i +0.5i +1.0i +1.0i
-#
-# rpc 88/08/01 4.0 RPCSRC; from 1.12 88/02/07 SMI
-#
-portmapper 100000 portmap sunrpc
-rstatd 100001 rstat rstat_svc rup perfmeter
-rusersd 100002 rusers
-nfs 100003 nfsprog
-ypserv 100004 ypprog
-mountd 100005 mount showmount
-ypbind 100007
-walld 100008 rwall shutdown
-yppasswdd 100009 yppasswd
-etherstatd 100010 etherstat
-rquotad 100011 rquotaprog quota rquota
-sprayd 100012 spray
-3270_mapper 100013
-rje_mapper 100014
-selection_svc 100015 selnsvc
-database_svc 100016
-rexd 100017 rex
-alis 100018
-sched 100019
-llockmgr 100020
-nlockmgr 100021
-x25.inr 100022
-statmon 100023
-status 100024
-bootparam 100026
-ypupdated 100028 ypupdate
-keyserv 100029 keyserver
-tfsd 100037
-nsed 100038
-nsemntd 100039
-.fi
-.DT
-.SH FILES
-/etc/rpc
-.SH "SEE ALSO"
-getrpcent(3N)
diff --git a/lib/librpc/man/man8/portmap.8c b/lib/librpc/man/man8/portmap.8c
deleted file mode 100644
index 862bd05..0000000
--- a/lib/librpc/man/man8/portmap.8c
+++ /dev/null
@@ -1,53 +0,0 @@
-.\" @(#)portmap.8c 2.2 88/08/03 4.0 RPCSRC; from 1.10 88/03/14 SMI
-.TH PORTMAP 8C "9 September 1987"
-.SH NAME
-portmap \- DARPA port to RPC program number mapper
-.SH SYNOPSIS
-.B /usr/etc/rpc.portmap
-.SH DESCRIPTION
-.IX "portmap command" "" "\fLportmap\fP \(em DARPA to RPC mapper"
-.IX DARPA "to RPC mapper \(em \fLportmap\fP"
-.B portmap
-is a server that converts
-.SM RPC
-program numbers into
-.SM DARPA
-protocol port numbers.
-It must be running in order to make
-.SM RPC
-calls.
-.LP
-When an
-.SM RPC
-server is started, it will tell
-.B portmap
-what port number it is listening to, and what
-.SM RPC
-program numbers it is prepared to serve.
-When a client wishes to make an
-.SM RPC
-call to a given program number,
-it will first contact
-.B portmap
-on the server machine to determine
-the port number where
-.SM RPC
-packets should be sent.
-.LP
-Normally, standard
-.SM RPC
-servers are started by
-.BR inetd (8C),
-so
-.B portmap
-must be started before
-.B inetd
-is invoked.
-.SH "SEE ALSO"
-.BR inetd.conf (5),
-.BR rpcinfo (8),
-.BR inetd (8)
-.SH BUGS
-If
-.B portmap
-crashes, all servers must be restarted.
diff --git a/lib/librpc/man/man8/rpcinfo.8c b/lib/librpc/man/man8/rpcinfo.8c
deleted file mode 100644
index 2d0de97f..0000000
--- a/lib/librpc/man/man8/rpcinfo.8c
+++ /dev/null
@@ -1,183 +0,0 @@
-.\" @(#)rpcinfo.8c 2.2 88/08/03 4.0 RPCSRC; from 1.24 88/02/25 SMI
-.TH RPCINFO 8C "17 December 1987"
-.SH NAME
-rpcinfo \- report RPC information
-.SH SYNOPSIS
-.B "rpcinfo \-p"
-[
-.I host
-]
-.LP
-.B "rpcinfo"
-[
-.B \-n
-.I portnum
-]
-.B \-u
-.I host
-.I program
-[
-.I version
-]
-.LP
-.B "rpcinfo"
-[
-.B \-n
-.I portnum
-]
-.B \-t
-.I host
-.I program
-[
-.I version
-]
-.LP
-.B "rpcinfo \-b"
-.I program
-.I version
-.LP
-.B "rpcinfo \-d"
-.I program
-.I version
-.SH DESCRIPTION
-.B rpcinfo
-makes an
-.SM RPC
-call to an
-.SM RPC
-server and reports what it finds.
-.SH OPTIONS
-.TP
-.B \-p
-Probe the portmapper on
-.IR host ,
-and print a list of all registered
-.SM RPC
-programs. If
-.I host
-is not specified, it defaults to the value returned by
-.BR hostname (1).
-.TP
-.B \-u
-Make an
-.SM RPC
-call to procedure 0 of
-.I program
-on the specified
-.I host
-using
-.SM UDP\s0,
-and report whether a response was received.
-.TP
-.B \-t
-Make an
-.SM RPC
-call to procedure 0 of
-.I program
-on the specified
-.I host
-using
-.SM TCP\s0,
-and report whether a response was received.
-.TP
-.B \-n
-Use
-.I portnum
-as the port number for the
-.I \-t
-and
-.I \-u
-options instead of the port number given by the portmapper.
-.TP
-.B \-b
-Make an
-.SM RPC
-broadcast to procedure 0 of the specified
-.I program
-and
-.I version
-using
-.SM UDP
-and report all hosts that respond.
-.TP
-.B \-d
-Delete registration for the
-.SM RPC
-service of the specified
-.I program
-and
-.IR version .
-This option can be exercised only by the super-user.
-.LP
-The
-.I program
-argument can be either a name or a number.
-.LP
-If a
-.I version
-is specified,
-.B rpcinfo
-attempts to call that version of the specified
-.IR program .
-Otherwise,
-.B rpcinfo
-attempts to find all the registered version
-numbers for the specified
-.I program
-by calling version 0 (which is presumed not
-to exist; if it does exist,
-.B rpcinfo
-attempts to obtain this information by calling
-an extremely high version
-number instead) and attempts to call each registered version.
-Note: the version number is required for
-.B \-b
-and
-.B \-d
-options.
-.SH EXAMPLES
-To show all of the
-.SM RPC
-services registered on the local machine use:
-.IP
-.B example% rpcinfo -p
-.LP
-To show all of the
-.SM RPC
-services registered on the machine named
-.B klaxon
-use:
-.IP
-.B example% rpcinfo -p klaxon
-.LP
-To show all machines on the local net that are running the Yellow Pages
-service use:
-.IP
-.B "example% rpcinfo -b ypserv 'version' | uniq"
-.LP
-where 'version' is the current Yellow Pages version obtained from the
-results of the
-.B \-p
-switch above.
-.LP
-To delete the registration for version 1 of the
-.B walld
-service use:
-.IP
-.B example% rpcinfo -d walld 1
-.SH "SEE ALSO"
-.BR rpc (5),
-.BR portmap (8C)
-.LP
-.I "\s-1RPC\s0 Programming Guide"
-.SH BUGS
-In releases prior to Sun\s-1OS\s0
-3.0, the Network File System (\s-1NFS\s0) did not
-register itself with the
-portmapper;
-.B rpcinfo
-cannot be used to make
-.SM RPC
-calls to the
-.SM NFS
-server on hosts running such releases.
diff --git a/lib/librpc/man/man8/rstat_svc.8c b/lib/librpc/man/man8/rstat_svc.8c
deleted file mode 100644
index a10b71d..0000000
--- a/lib/librpc/man/man8/rstat_svc.8c
+++ /dev/null
@@ -1,21 +0,0 @@
-.\" @(#)rstat_svc.8c 2.2 88/08/03 4.0 RPCSRC; from 1.10 87/09/09 SMI
-.TH RSTAT_SVC 8C "24 November 1987"
-.SH NAME
-rstat_svc \- kernel statistics server
-.SH SYNOPSIS
-.B /etc/rstat_svc
-.SH DESCRIPTION
-.LP
-.B rstat_svc
-is a server which returns performance statistics
-obtained from the kernel.
-These statistics are graphically displayed by the Sun Microsystems program,
-.BR perfmeter (1).
-The
-.B rstat_svc
-daemon is normally invoked at boot time through /etc/rc.local.
-.PP
-.B rstat_svc
-uses an RPC protocol defined in /usr/include/rpcsvc/rstat.x.
-.SH "SEE ALSO"
-.BR rstat (1),
diff --git a/lib/librpc/rpc/auth.h b/lib/librpc/rpc/auth.h
deleted file mode 100644
index a823ddd..0000000
--- a/lib/librpc/rpc/auth.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * auth.h, Authentication interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The data structures are completely opaque to the client. The client
- * is required to pass a AUTH * to routines that create rpc
- * "sessions".
- */
-
-
-#define MAX_AUTH_BYTES 400
-#define MAXNETNAMELEN 255 /* maximum length of network user's name */
-
-/*
- * Status returned from authentication check
- */
-enum auth_stat {
- AUTH_OK=0,
- /*
- * failed at remote end
- */
- AUTH_BADCRED=1, /* bogus credentials (seal broken) */
- AUTH_REJECTEDCRED=2, /* client should begin new session */
- AUTH_BADVERF=3, /* bogus verifier (seal broken) */
- AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
- AUTH_TOOWEAK=5, /* rejected due to security reasons */
- /*
- * failed locally
- */
- AUTH_INVALIDRESP=6, /* bogus response verifier */
- AUTH_FAILED=7 /* some unknown reason */
-};
-
-#if (mc68000 || sparc || vax || i386 || tahoe || luna68k || hp300 || mips)
-typedef u_long u_int32; /* 32-bit unsigned integers */
-#endif
-
-union des_block {
- struct {
- u_int32 high;
- u_int32 low;
- } key;
- char c[8];
-};
-typedef union des_block des_block;
-extern bool_t xdr_des_block();
-
-/*
- * Authentication info. Opaque to client.
- */
-struct opaque_auth {
- enum_t oa_flavor; /* flavor of auth */
- caddr_t oa_base; /* address of more auth stuff */
- u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
-};
-
-
-/*
- * Auth handle, interface to client side authenticators.
- */
-typedef struct {
- struct opaque_auth ah_cred;
- struct opaque_auth ah_verf;
- union des_block ah_key;
- struct auth_ops {
- void (*ah_nextverf)();
- int (*ah_marshal)(); /* nextverf & serialize */
- int (*ah_validate)(); /* validate varifier */
- int (*ah_refresh)(); /* refresh credentials */
- void (*ah_destroy)(); /* destroy this structure */
- } *ah_ops;
- caddr_t ah_private;
-} AUTH;
-
-
-/*
- * Authentication ops.
- * The ops and the auth handle provide the interface to the authenticators.
- *
- * AUTH *auth;
- * XDR *xdrs;
- * struct opaque_auth verf;
- */
-#define AUTH_NEXTVERF(auth) \
- ((*((auth)->ah_ops->ah_nextverf))(auth))
-#define auth_nextverf(auth) \
- ((*((auth)->ah_ops->ah_nextverf))(auth))
-
-#define AUTH_MARSHALL(auth, xdrs) \
- ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
-#define auth_marshall(auth, xdrs) \
- ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
-
-#define AUTH_VALIDATE(auth, verfp) \
- ((*((auth)->ah_ops->ah_validate))((auth), verfp))
-#define auth_validate(auth, verfp) \
- ((*((auth)->ah_ops->ah_validate))((auth), verfp))
-
-#define AUTH_REFRESH(auth) \
- ((*((auth)->ah_ops->ah_refresh))(auth))
-#define auth_refresh(auth) \
- ((*((auth)->ah_ops->ah_refresh))(auth))
-
-#define AUTH_DESTROY(auth) \
- ((*((auth)->ah_ops->ah_destroy))(auth))
-#define auth_destroy(auth) \
- ((*((auth)->ah_ops->ah_destroy))(auth))
-
-
-extern struct opaque_auth _null_auth;
-
-
-/*
- * These are the various implementations of client side authenticators.
- */
-
-/*
- * Unix style authentication
- * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
- * char *machname;
- * int uid;
- * int gid;
- * int len;
- * int *aup_gids;
- */
-extern AUTH *authunix_create();
-extern AUTH *authunix_create_default(); /* takes no parameters */
-extern AUTH *authnone_create(); /* takes no parameters */
-extern AUTH *authdes_create();
-
-#define AUTH_NONE 0 /* no authentication */
-#define AUTH_NULL 0 /* backward compatibility */
-#define AUTH_UNIX 1 /* unix style (uid, gids) */
-#define AUTH_SHORT 2 /* short hand unix style */
-#define AUTH_DES 3 /* des style (encrypted timestamps) */
diff --git a/lib/librpc/rpc/auth_none.c b/lib/librpc/rpc/auth_none.c
deleted file mode 100644
index 630037f..0000000
--- a/lib/librpc/rpc/auth_none.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * auth_none.c
- * Creates a client authentication handle for passing "null"
- * credentials and verifiers to remote systems.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#define MAX_MARSHEL_SIZE 20
-
-/*
- * Authenticator operations routines
- */
-static void authnone_verf();
-static void authnone_destroy();
-static bool_t authnone_marshal();
-static bool_t authnone_validate();
-static bool_t authnone_refresh();
-
-static struct auth_ops ops = {
- authnone_verf,
- authnone_marshal,
- authnone_validate,
- authnone_refresh,
- authnone_destroy
-};
-
-static struct authnone_private {
- AUTH no_client;
- char marshalled_client[MAX_MARSHEL_SIZE];
- u_int mcnt;
-} *authnone_private;
-
-AUTH *
-authnone_create()
-{
- register struct authnone_private *ap = authnone_private;
- XDR xdr_stream;
- register XDR *xdrs;
-
- if (ap == 0) {
- ap = (struct authnone_private *)calloc(1, sizeof (*ap));
- if (ap == 0)
- return (0);
- authnone_private = ap;
- }
- if (!ap->mcnt) {
- ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
- ap->no_client.ah_ops = &ops;
- xdrs = &xdr_stream;
- xdrmem_create(xdrs, ap->marshalled_client, (u_int)MAX_MARSHEL_SIZE,
- XDR_ENCODE);
- (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
- (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
- ap->mcnt = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
- }
- return (&ap->no_client);
-}
-
-/*ARGSUSED*/
-static bool_t
-authnone_marshal(client, xdrs)
- AUTH *client;
- XDR *xdrs;
-{
- register struct authnone_private *ap = authnone_private;
-
- if (ap == 0)
- return (0);
- return ((*xdrs->x_ops->x_putbytes)(xdrs,
- ap->marshalled_client, ap->mcnt));
-}
-
-static void
-authnone_verf()
-{
-}
-
-static bool_t
-authnone_validate()
-{
-
- return (TRUE);
-}
-
-static bool_t
-authnone_refresh()
-{
-
- return (FALSE);
-}
-
-static void
-authnone_destroy()
-{
-}
diff --git a/lib/librpc/rpc/auth_unix.c b/lib/librpc/rpc/auth_unix.c
deleted file mode 100644
index d085d02..0000000
--- a/lib/librpc/rpc/auth_unix.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* @(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * auth_unix.c, Implements UNIX style authentication parameters.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The system is very weak. The client uses no encryption for it's
- * credentials and only sends null verifiers. The server sends backs
- * null verifiers or optionally a verifier that suggests a new short hand
- * for the credentials.
- *
- */
-
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#include <rpc/auth_unix.h>
-
-/*
- * Unix authenticator operations vector
- */
-static void authunix_nextverf();
-static bool_t authunix_marshal();
-static bool_t authunix_validate();
-static bool_t authunix_refresh();
-static void authunix_destroy();
-
-static struct auth_ops auth_unix_ops = {
- authunix_nextverf,
- authunix_marshal,
- authunix_validate,
- authunix_refresh,
- authunix_destroy
-};
-
-/*
- * This struct is pointed to by the ah_private field of an auth_handle.
- */
-struct audata {
- struct opaque_auth au_origcred; /* original credentials */
- struct opaque_auth au_shcred; /* short hand cred */
- u_long au_shfaults; /* short hand cache faults */
- char au_marshed[MAX_AUTH_BYTES];
- u_int au_mpos; /* xdr pos at end of marshed */
-};
-#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private)
-
-static bool_t marshal_new_auth();
-
-
-/*
- * Create a unix style authenticator.
- * Returns an auth handle with the given stuff in it.
- */
-AUTH *
-authunix_create(machname, uid, gid, len, aup_gids)
- char *machname;
- int uid;
- int gid;
- register int len;
- int *aup_gids;
-{
- struct authunix_parms aup;
- char mymem[MAX_AUTH_BYTES];
- struct timeval now;
- XDR xdrs;
- register AUTH *auth;
- register struct audata *au;
-
- /*
- * Allocate and set up auth handle
- */
- auth = (AUTH *)mem_alloc(sizeof(*auth));
-#ifndef KERNEL
- if (auth == NULL) {
- (void)fprintf(stderr, "authunix_create: out of memory\n");
- return (NULL);
- }
-#endif
- au = (struct audata *)mem_alloc(sizeof(*au));
-#ifndef KERNEL
- if (au == NULL) {
- (void)fprintf(stderr, "authunix_create: out of memory\n");
- return (NULL);
- }
-#endif
- auth->ah_ops = &auth_unix_ops;
- auth->ah_private = (caddr_t)au;
- auth->ah_verf = au->au_shcred = _null_auth;
- au->au_shfaults = 0;
-
- /*
- * fill in param struct from the given params
- */
- (void)gettimeofday(&now, (struct timezone *)0);
- aup.aup_time = now.tv_sec;
- aup.aup_machname = machname;
- aup.aup_uid = uid;
- aup.aup_gid = gid;
- aup.aup_len = (u_int)len;
- aup.aup_gids = aup_gids;
-
- /*
- * Serialize the parameters into origcred
- */
- xdrmem_create(&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE);
- if (! xdr_authunix_parms(&xdrs, &aup))
- abort();
- au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs);
- au->au_origcred.oa_flavor = AUTH_UNIX;
-#ifdef KERNEL
- au->au_origcred.oa_base = mem_alloc((u_int) len);
-#else
- if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
- (void)fprintf(stderr, "authunix_create: out of memory\n");
- return (NULL);
- }
-#endif
- bcopy(mymem, au->au_origcred.oa_base, (u_int)len);
-
- /*
- * set auth handle to reflect new cred.
- */
- auth->ah_cred = au->au_origcred;
- marshal_new_auth(auth);
- return (auth);
-}
-
-/*
- * Some servers will refuse mounts if the group list is larger
- * than it expects (like 8). This allows the application to set
- * the maximum size of the group list that will be sent.
- */
-
-static maxgrplist = NGRPS;
-
-set_rpc_maxgrouplist(num)
- int num;
-{
-
- if (num < NGRPS)
- maxgrplist = num;
-}
-
-/*
- * Returns an auth handle with parameters determined by doing lots of
- * syscalls.
- */
-AUTH *
-authunix_create_default()
-{
- register int len;
- char machname[MAX_MACHINE_NAME + 1];
- register int uid;
- register int gid;
- int gids[NGRPS];
-
- if (gethostname(machname, MAX_MACHINE_NAME) == -1)
- abort();
- machname[MAX_MACHINE_NAME] = 0;
- uid = geteuid();
- gid = getegid();
- if ((len = getgroups(NGRPS, gids)) < 0)
- abort();
- if (len > maxgrplist)
- len = maxgrplist;
- return (authunix_create(machname, uid, gid, len, gids));
-}
-
-/*
- * authunix operations
- */
-
-static void
-authunix_nextverf(auth)
- AUTH *auth;
-{
- /* no action necessary */
-}
-
-static bool_t
-authunix_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
-{
- register struct audata *au = AUTH_PRIVATE(auth);
-
- return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos));
-}
-
-static bool_t
-authunix_validate(auth, verf)
- register AUTH *auth;
- struct opaque_auth verf;
-{
- register struct audata *au;
- XDR xdrs;
-
- if (verf.oa_flavor == AUTH_SHORT) {
- au = AUTH_PRIVATE(auth);
- xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE);
-
- if (au->au_shcred.oa_base != NULL) {
- mem_free(au->au_shcred.oa_base,
- au->au_shcred.oa_length);
- au->au_shcred.oa_base = NULL;
- }
- if (xdr_opaque_auth(&xdrs, &au->au_shcred)) {
- auth->ah_cred = au->au_shcred;
- } else {
- xdrs.x_op = XDR_FREE;
- (void)xdr_opaque_auth(&xdrs, &au->au_shcred);
- au->au_shcred.oa_base = NULL;
- auth->ah_cred = au->au_origcred;
- }
- marshal_new_auth(auth);
- }
- return (TRUE);
-}
-
-static bool_t
-authunix_refresh(auth)
- register AUTH *auth;
-{
- register struct audata *au = AUTH_PRIVATE(auth);
- struct authunix_parms aup;
- struct timeval now;
- XDR xdrs;
- register int stat;
-
- if (auth->ah_cred.oa_base == au->au_origcred.oa_base) {
- /* there is no hope. Punt */
- return (FALSE);
- }
- au->au_shfaults ++;
-
- /* first deserialize the creds back into a struct authunix_parms */
- aup.aup_machname = NULL;
- aup.aup_gids = (int *)NULL;
- xdrmem_create(&xdrs, au->au_origcred.oa_base,
- au->au_origcred.oa_length, XDR_DECODE);
- stat = xdr_authunix_parms(&xdrs, &aup);
- if (! stat)
- goto done;
-
- /* update the time and serialize in place */
- (void)gettimeofday(&now, (struct timezone *)0);
- aup.aup_time = now.tv_sec;
- xdrs.x_op = XDR_ENCODE;
- XDR_SETPOS(&xdrs, 0);
- stat = xdr_authunix_parms(&xdrs, &aup);
- if (! stat)
- goto done;
- auth->ah_cred = au->au_origcred;
- marshal_new_auth(auth);
-done:
- /* free the struct authunix_parms created by deserializing */
- xdrs.x_op = XDR_FREE;
- (void)xdr_authunix_parms(&xdrs, &aup);
- XDR_DESTROY(&xdrs);
- return (stat);
-}
-
-static void
-authunix_destroy(auth)
- register AUTH *auth;
-{
- register struct audata *au = AUTH_PRIVATE(auth);
-
- mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length);
-
- if (au->au_shcred.oa_base != NULL)
- mem_free(au->au_shcred.oa_base, au->au_shcred.oa_length);
-
- mem_free(auth->ah_private, sizeof(struct audata));
-
- if (auth->ah_verf.oa_base != NULL)
- mem_free(auth->ah_verf.oa_base, auth->ah_verf.oa_length);
-
- mem_free((caddr_t)auth, sizeof(*auth));
-}
-
-/*
- * Marshals (pre-serializes) an auth struct.
- * sets private data, au_marshed and au_mpos
- */
-static bool_t
-marshal_new_auth(auth)
- register AUTH *auth;
-{
- XDR xdr_stream;
- register XDR *xdrs = &xdr_stream;
- register struct audata *au = AUTH_PRIVATE(auth);
-
- xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
- if ((! xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
- (! xdr_opaque_auth(xdrs, &(auth->ah_verf)))) {
- perror("auth_none.c - Fatal marshalling problem");
- } else {
- au->au_mpos = XDR_GETPOS(xdrs);
- }
- XDR_DESTROY(xdrs);
-}
diff --git a/lib/librpc/rpc/auth_unix.h b/lib/librpc/rpc/auth_unix.h
deleted file mode 100644
index 705741e..0000000
--- a/lib/librpc/rpc/auth_unix.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)auth_unix.h 1.5 86/07/16 SMI */
-
-/*
- * auth_unix.h, Protocol for UNIX style authentication parameters for RPC
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-/*
- * The system is very weak. The client uses no encryption for it
- * credentials and only sends null verifiers. The server sends backs
- * null verifiers or optionally a verifier that suggests a new short hand
- * for the credentials.
- */
-
-/* The machine name is part of a credential; it may not exceed 255 bytes */
-#define MAX_MACHINE_NAME 255
-
-/* gids compose part of a credential; there may not be more than 16 of them */
-#define NGRPS 16
-
-/*
- * Unix style credentials.
- */
-struct authunix_parms {
- u_long aup_time;
- char *aup_machname;
- int aup_uid;
- int aup_gid;
- u_int aup_len;
- int *aup_gids;
-};
-
-extern bool_t xdr_authunix_parms();
-
-/*
- * If a response verifier has flavor AUTH_SHORT,
- * then the body of the response verifier encapsulates the following structure;
- * again it is serialized in the obvious fashion.
- */
-struct short_hand_verf {
- struct opaque_auth new_cred;
-};
diff --git a/lib/librpc/rpc/authunix_prot.c b/lib/librpc/rpc/authunix_prot.c
deleted file mode 100644
index a60d99a..0000000
--- a/lib/librpc/rpc/authunix_prot.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* @(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * authunix_prot.c
- * XDR for UNIX style authentication parameters for RPC
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#include <rpc/auth_unix.h>
-
-/*
- * XDR for unix authentication parameters.
- */
-bool_t
-xdr_authunix_parms(xdrs, p)
- register XDR *xdrs;
- register struct authunix_parms *p;
-{
-
- if (xdr_u_long(xdrs, &(p->aup_time))
- && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
- && xdr_int(xdrs, &(p->aup_uid))
- && xdr_int(xdrs, &(p->aup_gid))
- && xdr_array(xdrs, (caddr_t *)&(p->aup_gids),
- &(p->aup_len), NGRPS, sizeof(int), xdr_int) ) {
- return (TRUE);
- }
- return (FALSE);
-}
-
diff --git a/lib/librpc/rpc/bindresvport.c b/lib/librpc/rpc/bindresvport.c
deleted file mode 100644
index 63a68d3..0000000
--- a/lib/librpc/rpc/bindresvport.c
+++ /dev/null
@@ -1,79 +0,0 @@
-static char sccsid[] = "@(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC 1.8 88/02/08 SMI";
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1987 by Sun Microsystems, Inc.
- */
-
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-/*
- * Bind a socket to a privileged IP port
- */
-bindresvport(sd, sin)
- int sd;
- struct sockaddr_in *sin;
-{
- int res;
- static short port;
- struct sockaddr_in myaddr;
- extern int errno;
- int i;
-
-#define STARTPORT 600
-#define ENDPORT (IPPORT_RESERVED - 1)
-#define NPORTS (ENDPORT - STARTPORT + 1)
-
- if (sin == (struct sockaddr_in *)0) {
- sin = &myaddr;
- bzero(sin, sizeof (*sin));
- sin->sin_family = AF_INET;
- } else if (sin->sin_family != AF_INET) {
- errno = EPFNOSUPPORT;
- return (-1);
- }
- if (port == 0) {
- port = (getpid() % NPORTS) + STARTPORT;
- }
- res = -1;
- errno = EADDRINUSE;
- for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) {
- sin->sin_port = htons(port++);
- if (port > ENDPORT) {
- port = STARTPORT;
- }
- res = bind(sd,
- (struct sockaddr *)sin, sizeof(struct sockaddr_in));
- }
- return (res);
-}
diff --git a/lib/librpc/rpc/clnt.h b/lib/librpc/rpc/clnt.h
deleted file mode 100644
index 8c002a1..0000000
--- a/lib/librpc/rpc/clnt.h
+++ /dev/null
@@ -1,331 +0,0 @@
-/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * clnt.h - Client side remote procedure call interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _CLNT_
-#define _CLNT_
-
-/*
- * Rpc calls return an enum clnt_stat. This should be looked at more,
- * since each implementation is required to live with this (implementation
- * independent) list of errors.
- */
-enum clnt_stat {
- RPC_SUCCESS=0, /* call succeeded */
- /*
- * local errors
- */
- RPC_CANTENCODEARGS=1, /* can't encode arguments */
- RPC_CANTDECODERES=2, /* can't decode results */
- RPC_CANTSEND=3, /* failure in sending call */
- RPC_CANTRECV=4, /* failure in receiving result */
- RPC_TIMEDOUT=5, /* call timed out */
- /*
- * remote errors
- */
- RPC_VERSMISMATCH=6, /* rpc versions not compatible */
- RPC_AUTHERROR=7, /* authentication error */
- RPC_PROGUNAVAIL=8, /* program not available */
- RPC_PROGVERSMISMATCH=9, /* program version mismatched */
- RPC_PROCUNAVAIL=10, /* procedure unavailable */
- RPC_CANTDECODEARGS=11, /* decode arguments error */
- RPC_SYSTEMERROR=12, /* generic "other problem" */
-
- /*
- * callrpc & clnt_create errors
- */
- RPC_UNKNOWNHOST=13, /* unknown host name */
- RPC_UNKNOWNPROTO=17, /* unkown protocol */
-
- /*
- * _ create errors
- */
- RPC_PMAPFAILURE=14, /* the pmapper failed in its call */
- RPC_PROGNOTREGISTERED=15, /* remote program is not registered */
- /*
- * unspecified error
- */
- RPC_FAILED=16
-};
-
-
-/*
- * Error info.
- */
-struct rpc_err {
- enum clnt_stat re_status;
- union {
- int RE_errno; /* realated system error */
- enum auth_stat RE_why; /* why the auth error occurred */
- struct {
- u_long low; /* lowest verion supported */
- u_long high; /* highest verion supported */
- } RE_vers;
- struct { /* maybe meaningful if RPC_FAILED */
- long s1;
- long s2;
- } RE_lb; /* life boot & debugging only */
- } ru;
-#define re_errno ru.RE_errno
-#define re_why ru.RE_why
-#define re_vers ru.RE_vers
-#define re_lb ru.RE_lb
-};
-
-
-/*
- * Client rpc handle.
- * Created by individual implementations, see e.g. rpc_udp.c.
- * Client is responsible for initializing auth, see e.g. auth_none.c.
- */
-typedef struct {
- AUTH *cl_auth; /* authenticator */
- struct clnt_ops {
- enum clnt_stat (*cl_call)(); /* call remote procedure */
- void (*cl_abort)(); /* abort a call */
- void (*cl_geterr)(); /* get specific error code */
- bool_t (*cl_freeres)(); /* frees results */
- void (*cl_destroy)();/* destroy this structure */
- bool_t (*cl_control)();/* the ioctl() of rpc */
- } *cl_ops;
- caddr_t cl_private; /* private stuff */
-} CLIENT;
-
-
-/*
- * client side rpc interface ops
- *
- * Parameter types are:
- *
- */
-
-/*
- * enum clnt_stat
- * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
- * CLIENT *rh;
- * u_long proc;
- * xdrproc_t xargs;
- * caddr_t argsp;
- * xdrproc_t xres;
- * caddr_t resp;
- * struct timeval timeout;
- */
-#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
- ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
-#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
- ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
-
-/*
- * void
- * CLNT_ABORT(rh);
- * CLIENT *rh;
- */
-#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
-#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
-
-/*
- * struct rpc_err
- * CLNT_GETERR(rh);
- * CLIENT *rh;
- */
-#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
-#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
-
-
-/*
- * bool_t
- * CLNT_FREERES(rh, xres, resp);
- * CLIENT *rh;
- * xdrproc_t xres;
- * caddr_t resp;
- */
-#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
-#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
-
-/*
- * bool_t
- * CLNT_CONTROL(cl, request, info)
- * CLIENT *cl;
- * u_int request;
- * char *info;
- */
-#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
-#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
-
-/*
- * control operations that apply to both udp and tcp transports
- */
-#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
-#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
-#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
-/*
- * udp only control operations
- */
-#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
-#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
-
-/*
- * void
- * CLNT_DESTROY(rh);
- * CLIENT *rh;
- */
-#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
-#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
-
-
-/*
- * RPCTEST is a test program which is accessable on every rpc
- * transport/port. It is used for testing, performance evaluation,
- * and network administration.
- */
-
-#define RPCTEST_PROGRAM ((u_long)1)
-#define RPCTEST_VERSION ((u_long)1)
-#define RPCTEST_NULL_PROC ((u_long)2)
-#define RPCTEST_NULL_BATCH_PROC ((u_long)3)
-
-/*
- * By convention, procedure 0 takes null arguments and returns them
- */
-
-#define NULLPROC ((u_long)0)
-
-/*
- * Below are the client handle creation routines for the various
- * implementations of client side rpc. They can return NULL if a
- * creation failure occurs.
- */
-
-/*
- * Memory based rpc (for speed check and testing)
- * CLIENT *
- * clntraw_create(prog, vers)
- * u_long prog;
- * u_long vers;
- */
-extern CLIENT *clntraw_create();
-
-
-/*
- * Generic client creation routine. Supported protocols are "udp" and "tcp"
- */
-extern CLIENT *
-clnt_create(/*host, prog, vers, prot*/); /*
- char *host; -- hostname
- u_long prog; -- program number
- u_long vers; -- version number
- char *prot; -- protocol
-*/
-
-
-
-
-/*
- * TCP based rpc
- * CLIENT *
- * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
- * struct sockaddr_in *raddr;
- * u_long prog;
- * u_long version;
- * register int *sockp;
- * u_int sendsz;
- * u_int recvsz;
- */
-extern CLIENT *clnttcp_create();
-
-/*
- * UDP based rpc.
- * CLIENT *
- * clntudp_create(raddr, program, version, wait, sockp)
- * struct sockaddr_in *raddr;
- * u_long program;
- * u_long version;
- * struct timeval wait;
- * int *sockp;
- *
- * Same as above, but you specify max packet sizes.
- * CLIENT *
- * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
- * struct sockaddr_in *raddr;
- * u_long program;
- * u_long version;
- * struct timeval wait;
- * int *sockp;
- * u_int sendsz;
- * u_int recvsz;
- */
-extern CLIENT *clntudp_create();
-extern CLIENT *clntudp_bufcreate();
-
-/*
- * Print why creation failed
- */
-void clnt_pcreateerror(/* char *msg */); /* stderr */
-char *clnt_spcreateerror(/* char *msg */); /* string */
-
-/*
- * Like clnt_perror(), but is more verbose in its output
- */
-void clnt_perrno(/* enum clnt_stat num */); /* stderr */
-
-/*
- * Print an English error message, given the client error code
- */
-void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */
-char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */
-
-/*
- * If a creation fails, the following allows the user to figure out why.
- */
-struct rpc_createerr {
- enum clnt_stat cf_stat;
- struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
-};
-
-extern struct rpc_createerr rpc_createerr;
-
-
-
-/*
- * Copy error message to buffer.
- */
-char *clnt_sperrno(/* enum clnt_stat num */); /* string */
-
-
-
-#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
-#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
-
-#endif /*!_CLNT_*/
diff --git a/lib/librpc/rpc/clnt_generic.c b/lib/librpc/rpc/clnt_generic.c
deleted file mode 100644
index e54e7782..0000000
--- a/lib/librpc/rpc/clnt_generic.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* @(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
-#endif
-/*
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <netdb.h>
-
-/*
- * Generic client creation: takes (hostname, program-number, protocol) and
- * returns client handle. Default options are set, which the user can
- * change using the rpc equivalent of ioctl()'s.
- */
-CLIENT *
-clnt_create(hostname, prog, vers, proto)
- char *hostname;
- unsigned prog;
- unsigned vers;
- char *proto;
-{
- struct hostent *h;
- struct protoent *p;
- struct sockaddr_in sin;
- int sock;
- struct timeval tv;
- CLIENT *client;
-
- h = gethostbyname(hostname);
- if (h == NULL) {
- rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
- return (NULL);
- }
- if (h->h_addrtype != AF_INET) {
- /*
- * Only support INET for now
- */
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = EAFNOSUPPORT;
- return (NULL);
- }
- sin.sin_family = h->h_addrtype;
- sin.sin_port = 0;
- bzero(sin.sin_zero, sizeof(sin.sin_zero));
- bcopy(h->h_addr, (char*)&sin.sin_addr, h->h_length);
- p = getprotobyname(proto);
- if (p == NULL) {
- rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
- rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
- return (NULL);
- }
- sock = RPC_ANYSOCK;
- switch (p->p_proto) {
- case IPPROTO_UDP:
- tv.tv_sec = 5;
- tv.tv_usec = 0;
- client = clntudp_create(&sin, prog, vers, tv, &sock);
- if (client == NULL) {
- return (NULL);
- }
- tv.tv_sec = 25;
- clnt_control(client, CLSET_TIMEOUT, &tv);
- break;
- case IPPROTO_TCP:
- client = clnttcp_create(&sin, prog, vers, &sock, 0, 0);
- if (client == NULL) {
- return (NULL);
- }
- tv.tv_sec = 25;
- tv.tv_usec = 0;
- clnt_control(client, CLSET_TIMEOUT, &tv);
- break;
- default:
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
- return (NULL);
- }
- return (client);
-}
diff --git a/lib/librpc/rpc/clnt_perror.c b/lib/librpc/rpc/clnt_perror.c
deleted file mode 100644
index c618c5f..0000000
--- a/lib/librpc/rpc/clnt_perror.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_perror.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- */
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/auth.h>
-#include <rpc/clnt.h>
-
-static char *auth_errmsg();
-
-extern char *strcpy();
-
-static char *buf;
-
-static char *
-_buf()
-{
-
- if (buf == 0)
- buf = (char *)malloc(256);
- return (buf);
-}
-
-/*
- * Print reply error info
- */
-char *
-clnt_sperror(rpch, s)
- CLIENT *rpch;
- char *s;
-{
- struct rpc_err e;
- void clnt_perrno();
- char *err;
- char *str = _buf();
- char *strstart = str;
-
- if (str == 0)
- return (0);
- CLNT_GETERR(rpch, &e);
-
- (void) sprintf(str, "%s: ", s);
- str += strlen(str);
-
- (void) strcpy(str, clnt_sperrno(e.re_status));
- str += strlen(str);
-
- switch (e.re_status) {
- case RPC_SUCCESS:
- case RPC_CANTENCODEARGS:
- case RPC_CANTDECODERES:
- case RPC_TIMEDOUT:
- case RPC_PROGUNAVAIL:
- case RPC_PROCUNAVAIL:
- case RPC_CANTDECODEARGS:
- case RPC_SYSTEMERROR:
- case RPC_UNKNOWNHOST:
- case RPC_UNKNOWNPROTO:
- case RPC_PMAPFAILURE:
- case RPC_PROGNOTREGISTERED:
- case RPC_FAILED:
- break;
-
- case RPC_CANTSEND:
- case RPC_CANTRECV:
- (void) sprintf(str, "; errno = %s",
- strerror(e.re_errno));
- str += strlen(str);
- break;
-
- case RPC_VERSMISMATCH:
- (void) sprintf(str,
- "; low version = %lu, high version = %lu",
- e.re_vers.low, e.re_vers.high);
- str += strlen(str);
- break;
-
- case RPC_AUTHERROR:
- err = auth_errmsg(e.re_why);
- (void) sprintf(str,"; why = ");
- str += strlen(str);
- if (err != NULL) {
- (void) sprintf(str, "%s",err);
- } else {
- (void) sprintf(str,
- "(unknown authentication error - %d)",
- (int) e.re_why);
- }
- str += strlen(str);
- break;
-
- case RPC_PROGVERSMISMATCH:
- (void) sprintf(str,
- "; low version = %lu, high version = %lu",
- e.re_vers.low, e.re_vers.high);
- str += strlen(str);
- break;
-
- default: /* unknown */
- (void) sprintf(str,
- "; s1 = %lu, s2 = %lu",
- e.re_lb.s1, e.re_lb.s2);
- str += strlen(str);
- break;
- }
- (void) sprintf(str, "\n");
- return(strstart) ;
-}
-
-void
-clnt_perror(rpch, s)
- CLIENT *rpch;
- char *s;
-{
- (void) fprintf(stderr,"%s",clnt_sperror(rpch,s));
-}
-
-
-struct rpc_errtab {
- enum clnt_stat status;
- char *message;
-};
-
-static struct rpc_errtab rpc_errlist[] = {
- { RPC_SUCCESS,
- "RPC: Success" },
- { RPC_CANTENCODEARGS,
- "RPC: Can't encode arguments" },
- { RPC_CANTDECODERES,
- "RPC: Can't decode result" },
- { RPC_CANTSEND,
- "RPC: Unable to send" },
- { RPC_CANTRECV,
- "RPC: Unable to receive" },
- { RPC_TIMEDOUT,
- "RPC: Timed out" },
- { RPC_VERSMISMATCH,
- "RPC: Incompatible versions of RPC" },
- { RPC_AUTHERROR,
- "RPC: Authentication error" },
- { RPC_PROGUNAVAIL,
- "RPC: Program unavailable" },
- { RPC_PROGVERSMISMATCH,
- "RPC: Program/version mismatch" },
- { RPC_PROCUNAVAIL,
- "RPC: Procedure unavailable" },
- { RPC_CANTDECODEARGS,
- "RPC: Server can't decode arguments" },
- { RPC_SYSTEMERROR,
- "RPC: Remote system error" },
- { RPC_UNKNOWNHOST,
- "RPC: Unknown host" },
- { RPC_UNKNOWNPROTO,
- "RPC: Unknown protocol" },
- { RPC_PMAPFAILURE,
- "RPC: Port mapper failure" },
- { RPC_PROGNOTREGISTERED,
- "RPC: Program not registered"},
- { RPC_FAILED,
- "RPC: Failed (unspecified error)"}
-};
-
-
-/*
- * This interface for use by clntrpc
- */
-char *
-clnt_sperrno(stat)
- enum clnt_stat stat;
-{
- int i;
-
- for (i = 0; i < sizeof(rpc_errlist)/sizeof(struct rpc_errtab); i++) {
- if (rpc_errlist[i].status == stat) {
- return (rpc_errlist[i].message);
- }
- }
- return ("RPC: (unknown error code)");
-}
-
-void
-clnt_perrno(num)
- enum clnt_stat num;
-{
- (void) fprintf(stderr,"%s",clnt_sperrno(num));
-}
-
-
-char *
-clnt_spcreateerror(s)
- char *s;
-{
- extern int sys_nerr;
- char *str = _buf();
-
- if (str == 0)
- return(0);
- (void) sprintf(str, "%s: ", s);
- (void) strcat(str, clnt_sperrno(rpc_createerr.cf_stat));
- switch (rpc_createerr.cf_stat) {
- case RPC_PMAPFAILURE:
- (void) strcat(str, " - ");
- (void) strcat(str,
- clnt_sperrno(rpc_createerr.cf_error.re_status));
- break;
-
- case RPC_SYSTEMERROR:
- (void) strcat(str, " - ");
- if (rpc_createerr.cf_error.re_errno > 0
- && rpc_createerr.cf_error.re_errno < sys_nerr)
- (void) strcat(str,
- strerror(rpc_createerr.cf_error.re_errno));
- else
- (void) sprintf(&str[strlen(str)], "Error %d",
- rpc_createerr.cf_error.re_errno);
- break;
- }
- (void) strcat(str, "\n");
- return (str);
-}
-
-void
-clnt_pcreateerror(s)
- char *s;
-{
- (void) fprintf(stderr,"%s",clnt_spcreateerror(s));
-}
-
-struct auth_errtab {
- enum auth_stat status;
- char *message;
-};
-
-static struct auth_errtab auth_errlist[] = {
- { AUTH_OK,
- "Authentication OK" },
- { AUTH_BADCRED,
- "Invalid client credential" },
- { AUTH_REJECTEDCRED,
- "Server rejected credential" },
- { AUTH_BADVERF,
- "Invalid client verifier" },
- { AUTH_REJECTEDVERF,
- "Server rejected verifier" },
- { AUTH_TOOWEAK,
- "Client credential too weak" },
- { AUTH_INVALIDRESP,
- "Invalid server verifier" },
- { AUTH_FAILED,
- "Failed (unspecified error)" },
-};
-
-static char *
-auth_errmsg(stat)
- enum auth_stat stat;
-{
- int i;
-
- for (i = 0; i < sizeof(auth_errlist)/sizeof(struct auth_errtab); i++) {
- if (auth_errlist[i].status == stat) {
- return(auth_errlist[i].message);
- }
- }
- return(NULL);
-}
diff --git a/lib/librpc/rpc/clnt_raw.c b/lib/librpc/rpc/clnt_raw.c
deleted file mode 100644
index 89059ae..0000000
--- a/lib/librpc/rpc/clnt_raw.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* @(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_raw.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * Memory based rpc for simple testing and timing.
- * Interface to create an rpc client and server in the same process.
- * This lets us similate rpc and get round trip overhead, without
- * any interference from the kernal.
- */
-
-#include <rpc/rpc.h>
-
-#define MCALL_MSG_SIZE 24
-
-/*
- * This is the "network" we will be moving stuff over.
- */
-static struct clntraw_private {
- CLIENT client_object;
- XDR xdr_stream;
- char _raw_buf[UDPMSGSIZE];
- char mashl_callmsg[MCALL_MSG_SIZE];
- u_int mcnt;
-} *clntraw_private;
-
-static enum clnt_stat clntraw_call();
-static void clntraw_abort();
-static void clntraw_geterr();
-static bool_t clntraw_freeres();
-static bool_t clntraw_control();
-static void clntraw_destroy();
-
-static struct clnt_ops client_ops = {
- clntraw_call,
- clntraw_abort,
- clntraw_geterr,
- clntraw_freeres,
- clntraw_destroy,
- clntraw_control
-};
-
-void svc_getreq();
-
-/*
- * Create a client handle for memory based rpc.
- */
-CLIENT *
-clntraw_create(prog, vers)
- u_long prog;
- u_long vers;
-{
- register struct clntraw_private *clp = clntraw_private;
- struct rpc_msg call_msg;
- XDR *xdrs = &clp->xdr_stream;
- CLIENT *client = &clp->client_object;
-
- if (clp == 0) {
- clp = (struct clntraw_private *)calloc(1, sizeof (*clp));
- if (clp == 0)
- return (0);
- clntraw_private = clp;
- }
- /*
- * pre-serialize the staic part of the call msg and stash it away
- */
- call_msg.rm_direction = CALL;
- call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- call_msg.rm_call.cb_prog = prog;
- call_msg.rm_call.cb_vers = vers;
- xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
- if (! xdr_callhdr(xdrs, &call_msg)) {
- perror("clnt_raw.c - Fatal header serialization error.");
- }
- clp->mcnt = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
-
- /*
- * Set xdrmem for client/server shared buffer
- */
- xdrmem_create(xdrs, clp->_raw_buf, UDPMSGSIZE, XDR_FREE);
-
- /*
- * create client handle
- */
- client->cl_ops = &client_ops;
- client->cl_auth = authnone_create();
- return (client);
-}
-
-static enum clnt_stat
-clntraw_call(h, proc, xargs, argsp, xresults, resultsp, timeout)
- CLIENT *h;
- u_long proc;
- xdrproc_t xargs;
- caddr_t argsp;
- xdrproc_t xresults;
- caddr_t resultsp;
- struct timeval timeout;
-{
- register struct clntraw_private *clp = clntraw_private;
- register XDR *xdrs = &clp->xdr_stream;
- struct rpc_msg msg;
- enum clnt_stat status;
- struct rpc_err error;
-
- if (clp == 0)
- return (RPC_FAILED);
-call_again:
- /*
- * send request
- */
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, 0);
- ((struct rpc_msg *)clp->mashl_callmsg)->rm_xid ++ ;
- if ((! XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) ||
- (! XDR_PUTLONG(xdrs, (long *)&proc)) ||
- (! AUTH_MARSHALL(h->cl_auth, xdrs)) ||
- (! (*xargs)(xdrs, argsp))) {
- return (RPC_CANTENCODEARGS);
- }
- (void)XDR_GETPOS(xdrs); /* called just to cause overhead */
-
- /*
- * We have to call server input routine here because this is
- * all going on in one process. Yuk.
- */
- svc_getreq(1);
-
- /*
- * get results
- */
- xdrs->x_op = XDR_DECODE;
- XDR_SETPOS(xdrs, 0);
- msg.acpted_rply.ar_verf = _null_auth;
- msg.acpted_rply.ar_results.where = resultsp;
- msg.acpted_rply.ar_results.proc = xresults;
- if (! xdr_replymsg(xdrs, &msg))
- return (RPC_CANTDECODERES);
- _seterr_reply(&msg, &error);
- status = error.re_status;
-
- if (status == RPC_SUCCESS) {
- if (! AUTH_VALIDATE(h->cl_auth, &msg.acpted_rply.ar_verf)) {
- status = RPC_AUTHERROR;
- }
- } /* end successful completion */
- else {
- if (AUTH_REFRESH(h->cl_auth))
- goto call_again;
- } /* end of unsuccessful completion */
-
- if (status == RPC_SUCCESS) {
- if (! AUTH_VALIDATE(h->cl_auth, &msg.acpted_rply.ar_verf)) {
- status = RPC_AUTHERROR;
- }
- if (msg.acpted_rply.ar_verf.oa_base != NULL) {
- xdrs->x_op = XDR_FREE;
- (void)xdr_opaque_auth(xdrs, &(msg.acpted_rply.ar_verf));
- }
- }
-
- return (status);
-}
-
-static void
-clntraw_geterr()
-{
-}
-
-
-static bool_t
-clntraw_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- caddr_t res_ptr;
-{
- register struct clntraw_private *clp = clntraw_private;
- register XDR *xdrs = &clp->xdr_stream;
- bool_t rval;
-
- if (clp == 0)
- {
- rval = (bool_t) RPC_FAILED;
- return (rval);
- }
- xdrs->x_op = XDR_FREE;
- return ((*xdr_res)(xdrs, res_ptr));
-}
-
-static void
-clntraw_abort()
-{
-}
-
-static bool_t
-clntraw_control()
-{
- return (FALSE);
-}
-
-static void
-clntraw_destroy()
-{
-}
diff --git a/lib/librpc/rpc/clnt_simple.c b/lib/librpc/rpc/clnt_simple.c
deleted file mode 100644
index 043ce0a..0000000
--- a/lib/librpc/rpc/clnt_simple.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_simple.c
- * Simplified front end to rpc.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <strings.h>
-
-static struct callrpc_private {
- CLIENT *client;
- int socket;
- int oldprognum, oldversnum, valid;
- char *oldhost;
-} *callrpc_private;
-
-callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
- char *host;
- xdrproc_t inproc, outproc;
- char *in, *out;
-{
- register struct callrpc_private *crp = callrpc_private;
- struct sockaddr_in server_addr;
- enum clnt_stat clnt_stat;
- struct hostent *hp;
- struct timeval timeout, tottimeout;
-
- if (crp == 0) {
- crp = (struct callrpc_private *)calloc(1, sizeof (*crp));
- if (crp == 0)
- return (0);
- callrpc_private = crp;
- }
- if (crp->oldhost == NULL) {
- crp->oldhost = malloc(256);
- crp->oldhost[0] = 0;
- crp->socket = RPC_ANYSOCK;
- }
- if (crp->valid && crp->oldprognum == prognum && crp->oldversnum == versnum
- && strcmp(crp->oldhost, host) == 0) {
- /* reuse old client */
- } else {
- crp->valid = 0;
- (void)close(crp->socket);
- crp->socket = RPC_ANYSOCK;
- if (crp->client) {
- clnt_destroy(crp->client);
- crp->client = NULL;
- }
- if ((hp = gethostbyname(host)) == NULL)
- return ((int) RPC_UNKNOWNHOST);
- timeout.tv_usec = 0;
- timeout.tv_sec = 5;
- bcopy(hp->h_addr, (char *)&server_addr.sin_addr, hp->h_length);
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = 0;
- if ((crp->client = clntudp_create(&server_addr, (u_long)prognum,
- (u_long)versnum, timeout, &crp->socket)) == NULL)
- return ((int) rpc_createerr.cf_stat);
- crp->valid = 1;
- crp->oldprognum = prognum;
- crp->oldversnum = versnum;
- (void) strcpy(crp->oldhost, host);
- }
- tottimeout.tv_sec = 25;
- tottimeout.tv_usec = 0;
- clnt_stat = clnt_call(crp->client, procnum, inproc, in,
- outproc, out, tottimeout);
- /*
- * if call failed, empty cache
- */
- if (clnt_stat != RPC_SUCCESS)
- crp->valid = 0;
- return ((int) clnt_stat);
-}
diff --git a/lib/librpc/rpc/clnt_tcp.c b/lib/librpc/rpc/clnt_tcp.c
deleted file mode 100644
index 2222bc6..0000000
--- a/lib/librpc/rpc/clnt_tcp.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* @(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_tcp.c, Implements a TCP/IP based, client side RPC.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * TCP based RPC supports 'batched calls'.
- * A sequence of calls may be batched-up in a send buffer. The rpc call
- * return immediately to the client even though the call was not necessarily
- * sent. The batching occurs if the results' xdr routine is NULL (0) AND
- * the rpc timeout value is zero (see clnt.h, rpc).
- *
- * Clients should NOT casually batch calls that in fact return results; that is,
- * the server side should be aware that a call is batched and not produce any
- * return message. Batched calls that produce many result messages can
- * deadlock (netlock) the client and the server....
- *
- * Now go hang yourself.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <errno.h>
-#include <rpc/pmap_clnt.h>
-
-#define MCALL_MSG_SIZE 24
-
-extern int errno;
-
-static int readtcp();
-static int writetcp();
-
-static enum clnt_stat clnttcp_call();
-static void clnttcp_abort();
-static void clnttcp_geterr();
-static bool_t clnttcp_freeres();
-static bool_t clnttcp_control();
-static void clnttcp_destroy();
-
-static struct clnt_ops tcp_ops = {
- clnttcp_call,
- clnttcp_abort,
- clnttcp_geterr,
- clnttcp_freeres,
- clnttcp_destroy,
- clnttcp_control
-};
-
-struct ct_data {
- int ct_sock;
- bool_t ct_closeit;
- struct timeval ct_wait;
- bool_t ct_waitset; /* wait set by clnt_control? */
- struct sockaddr_in ct_addr;
- struct rpc_err ct_error;
- char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */
- u_int ct_mpos; /* pos after marshal */
- XDR ct_xdrs;
-};
-
-/*
- * Create a client handle for a tcp/ip connection.
- * If *sockp<0, *sockp is set to a newly created TCP socket and it is
- * connected to raddr. If *sockp non-negative then
- * raddr is ignored. The rpc/tcp package does buffering
- * similar to stdio, so the client must pick send and receive buffer sizes,];
- * 0 => use the default.
- * If raddr->sin_port is 0, then a binder on the remote machine is
- * consulted for the right port number.
- * NB: *sockp is copied into a private area.
- * NB: It is the clients responsibility to close *sockp.
- * NB: The rpch->cl_auth is set null authentication. Caller may wish to set this
- * something more useful.
- */
-CLIENT *
-clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long prog;
- u_long vers;
- register int *sockp;
- u_int sendsz;
- u_int recvsz;
-{
- CLIENT *h;
- register struct ct_data *ct;
- struct timeval now;
- struct rpc_msg call_msg;
-
- h = (CLIENT *)mem_alloc(sizeof(*h));
- if (h == NULL) {
- (void)fprintf(stderr, "clnttcp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- ct = (struct ct_data *)mem_alloc(sizeof(*ct));
- if (ct == NULL) {
- (void)fprintf(stderr, "clnttcp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
-
- /*
- * If no port number given ask the pmap for one
- */
- if (raddr->sin_port == 0) {
- u_short port;
- if ((port = pmap_getport(raddr, prog, vers, IPPROTO_TCP)) == 0) {
- mem_free((caddr_t)ct, sizeof(struct ct_data));
- mem_free((caddr_t)h, sizeof(CLIENT));
- return ((CLIENT *)NULL);
- }
- raddr->sin_port = htons(port);
- }
-
- /*
- * If no socket given, open one
- */
- if (*sockp < 0) {
- *sockp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- (void)bindresvport(*sockp, (struct sockaddr_in *)0);
- if ((*sockp < 0)
- || (connect(*sockp, (struct sockaddr *)raddr,
- sizeof(*raddr)) < 0)) {
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- (void)close(*sockp);
- goto fooy;
- }
- ct->ct_closeit = TRUE;
- } else {
- ct->ct_closeit = FALSE;
- }
-
- /*
- * Set up private data struct
- */
- ct->ct_sock = *sockp;
- ct->ct_wait.tv_usec = 0;
- ct->ct_waitset = FALSE;
- ct->ct_addr = *raddr;
-
- /*
- * Initialize call message
- */
- (void)gettimeofday(&now, (struct timezone *)0);
- call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
- call_msg.rm_direction = CALL;
- call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- call_msg.rm_call.cb_prog = prog;
- call_msg.rm_call.cb_vers = vers;
-
- /*
- * pre-serialize the staic part of the call msg and stash it away
- */
- xdrmem_create(&(ct->ct_xdrs), ct->ct_mcall, MCALL_MSG_SIZE,
- XDR_ENCODE);
- if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
- if (ct->ct_closeit) {
- (void)close(*sockp);
- }
- goto fooy;
- }
- ct->ct_mpos = XDR_GETPOS(&(ct->ct_xdrs));
- XDR_DESTROY(&(ct->ct_xdrs));
-
- /*
- * Create a client handle which uses xdrrec for serialization
- * and authnone for authentication.
- */
- xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
- (caddr_t)ct, readtcp, writetcp);
- h->cl_ops = &tcp_ops;
- h->cl_private = (caddr_t) ct;
- h->cl_auth = authnone_create();
- return (h);
-
-fooy:
- /*
- * Something goofed, free stuff and barf
- */
- mem_free((caddr_t)ct, sizeof(struct ct_data));
- mem_free((caddr_t)h, sizeof(CLIENT));
- return ((CLIENT *)NULL);
-}
-
-static enum clnt_stat
-clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
- register CLIENT *h;
- u_long proc;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
- xdrproc_t xdr_results;
- caddr_t results_ptr;
- struct timeval timeout;
-{
- register struct ct_data *ct = (struct ct_data *) h->cl_private;
- register XDR *xdrs = &(ct->ct_xdrs);
- struct rpc_msg reply_msg;
- u_long x_id;
- u_long *msg_x_id = (u_long *)(ct->ct_mcall); /* yuk */
- register bool_t shipnow;
- int refreshes = 2;
-
- if (!ct->ct_waitset) {
- ct->ct_wait = timeout;
- }
-
- shipnow =
- (xdr_results == (xdrproc_t)0 && timeout.tv_sec == 0
- && timeout.tv_usec == 0) ? FALSE : TRUE;
-
-call_again:
- xdrs->x_op = XDR_ENCODE;
- ct->ct_error.re_status = RPC_SUCCESS;
- x_id = ntohl(--(*msg_x_id));
- if ((! XDR_PUTBYTES(xdrs, ct->ct_mcall, ct->ct_mpos)) ||
- (! XDR_PUTLONG(xdrs, (long *)&proc)) ||
- (! AUTH_MARSHALL(h->cl_auth, xdrs)) ||
- (! (*xdr_args)(xdrs, args_ptr))) {
- if (ct->ct_error.re_status == RPC_SUCCESS)
- ct->ct_error.re_status = RPC_CANTENCODEARGS;
- (void)xdrrec_endofrecord(xdrs, TRUE);
- return (ct->ct_error.re_status);
- }
- if (! xdrrec_endofrecord(xdrs, shipnow))
- return (ct->ct_error.re_status = RPC_CANTSEND);
- if (! shipnow)
- return (RPC_SUCCESS);
- /*
- * Hack to provide rpc-based message passing
- */
- if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
- return(ct->ct_error.re_status = RPC_TIMEDOUT);
- }
-
-
- /*
- * Keep receiving until we get a valid transaction id
- */
- xdrs->x_op = XDR_DECODE;
- while (TRUE) {
- reply_msg.acpted_rply.ar_verf = _null_auth;
- reply_msg.acpted_rply.ar_results.where = NULL;
- reply_msg.acpted_rply.ar_results.proc = xdr_void;
- if (! xdrrec_skiprecord(xdrs))
- return (ct->ct_error.re_status);
- /* now decode and validate the response header */
- if (! xdr_replymsg(xdrs, &reply_msg)) {
- if (ct->ct_error.re_status == RPC_SUCCESS)
- continue;
- return (ct->ct_error.re_status);
- }
- if (reply_msg.rm_xid == x_id)
- break;
- }
-
- /*
- * process header
- */
- _seterr_reply(&reply_msg, &(ct->ct_error));
- if (ct->ct_error.re_status == RPC_SUCCESS) {
- if (! AUTH_VALIDATE(h->cl_auth, &reply_msg.acpted_rply.ar_verf)) {
- ct->ct_error.re_status = RPC_AUTHERROR;
- ct->ct_error.re_why = AUTH_INVALIDRESP;
- } else if (! (*xdr_results)(xdrs, results_ptr)) {
- if (ct->ct_error.re_status == RPC_SUCCESS)
- ct->ct_error.re_status = RPC_CANTDECODERES;
- }
- /* free verifier ... */
- if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
- xdrs->x_op = XDR_FREE;
- (void)xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf));
- }
- } /* end successful completion */
- else {
- /* maybe our credentials need to be refreshed ... */
- if (refreshes-- && AUTH_REFRESH(h->cl_auth))
- goto call_again;
- } /* end of unsuccessful completion */
- return (ct->ct_error.re_status);
-}
-
-static void
-clnttcp_geterr(h, errp)
- CLIENT *h;
- struct rpc_err *errp;
-{
- register struct ct_data *ct =
- (struct ct_data *) h->cl_private;
-
- *errp = ct->ct_error;
-}
-
-static bool_t
-clnttcp_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- caddr_t res_ptr;
-{
- register struct ct_data *ct = (struct ct_data *)cl->cl_private;
- register XDR *xdrs = &(ct->ct_xdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_res)(xdrs, res_ptr));
-}
-
-static void
-clnttcp_abort()
-{
-}
-
-static bool_t
-clnttcp_control(cl, request, info)
- CLIENT *cl;
- int request;
- char *info;
-{
- register struct ct_data *ct = (struct ct_data *)cl->cl_private;
-
- switch (request) {
- case CLSET_TIMEOUT:
- ct->ct_wait = *(struct timeval *)info;
- ct->ct_waitset = TRUE;
- break;
- case CLGET_TIMEOUT:
- *(struct timeval *)info = ct->ct_wait;
- break;
- case CLGET_SERVER_ADDR:
- *(struct sockaddr_in *)info = ct->ct_addr;
- break;
- default:
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-static void
-clnttcp_destroy(h)
- CLIENT *h;
-{
- register struct ct_data *ct =
- (struct ct_data *) h->cl_private;
-
- if (ct->ct_closeit) {
- (void)close(ct->ct_sock);
- }
- XDR_DESTROY(&(ct->ct_xdrs));
- mem_free((caddr_t)ct, sizeof(struct ct_data));
- mem_free((caddr_t)h, sizeof(CLIENT));
-}
-
-/*
- * Interface between xdr serializer and tcp connection.
- * Behaves like the system calls, read & write, but keeps some error state
- * around for the rpc level.
- */
-static int
-readtcp(ct, buf, len)
- register struct ct_data *ct;
- caddr_t buf;
- register int len;
-{
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
-
- if (len == 0)
- return (0);
- FD_ZERO(&mask);
- FD_SET(ct->ct_sock, &mask);
-#else
- register int mask = 1 << (ct->ct_sock);
- int readfds;
-
- if (len == 0)
- return (0);
-
-#endif /* def FD_SETSIZE */
- while (TRUE) {
- readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, (int*)NULL, (int*)NULL,
- &(ct->ct_wait))) {
- case 0:
- ct->ct_error.re_status = RPC_TIMEDOUT;
- return (-1);
-
- case -1:
- if (errno == EINTR)
- continue;
- ct->ct_error.re_status = RPC_CANTRECV;
- ct->ct_error.re_errno = errno;
- return (-1);
- }
- break;
- }
- switch (len = read(ct->ct_sock, buf, len)) {
-
- case 0:
- /* premature eof */
- ct->ct_error.re_errno = ECONNRESET;
- ct->ct_error.re_status = RPC_CANTRECV;
- len = -1; /* it's really an error */
- break;
-
- case -1:
- ct->ct_error.re_errno = errno;
- ct->ct_error.re_status = RPC_CANTRECV;
- break;
- }
- return (len);
-}
-
-static int
-writetcp(ct, buf, len)
- struct ct_data *ct;
- caddr_t buf;
- int len;
-{
- register int i, cnt;
-
- for (cnt = len; cnt > 0; cnt -= i, buf += i) {
- if ((i = write(ct->ct_sock, buf, cnt)) == -1) {
- ct->ct_error.re_errno = errno;
- ct->ct_error.re_status = RPC_CANTSEND;
- return (-1);
- }
- }
- return (len);
-}
diff --git a/lib/librpc/rpc/clnt_udp.c b/lib/librpc/rpc/clnt_udp.c
deleted file mode 100644
index 815cbb4..0000000
--- a/lib/librpc/rpc/clnt_udp.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_udp.c, Implements a UDP/IP based, client side RPC.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <netdb.h>
-#include <errno.h>
-#include <rpc/pmap_clnt.h>
-
-extern int errno;
-
-/*
- * UDP bases client side rpc operations
- */
-static enum clnt_stat clntudp_call();
-static void clntudp_abort();
-static void clntudp_geterr();
-static bool_t clntudp_freeres();
-static bool_t clntudp_control();
-static void clntudp_destroy();
-
-static struct clnt_ops udp_ops = {
- clntudp_call,
- clntudp_abort,
- clntudp_geterr,
- clntudp_freeres,
- clntudp_destroy,
- clntudp_control
-};
-
-/*
- * Private data kept per client handle
- */
-struct cu_data {
- int cu_sock;
- bool_t cu_closeit;
- struct sockaddr_in cu_raddr;
- int cu_rlen;
- struct timeval cu_wait;
- struct timeval cu_total;
- struct rpc_err cu_error;
- XDR cu_outxdrs;
- u_int cu_xdrpos;
- u_int cu_sendsz;
- char *cu_outbuf;
- u_int cu_recvsz;
- char cu_inbuf[1];
-};
-
-/*
- * Create a UDP based client handle.
- * If *sockp<0, *sockp is set to a newly created UPD socket.
- * If raddr->sin_port is 0 a binder on the remote machine
- * is consulted for the correct port number.
- * NB: It is the clients responsibility to close *sockp.
- * NB: The rpch->cl_auth is initialized to null authentication.
- * Caller may wish to set this something more useful.
- *
- * wait is the amount of time used between retransmitting a call if
- * no response has been heard; retransmition occurs until the actual
- * rpc call times out.
- *
- * sendsz and recvsz are the maximum allowable packet sizes that can be
- * sent and received.
- */
-CLIENT *
-clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long program;
- u_long version;
- struct timeval wait;
- register int *sockp;
- u_int sendsz;
- u_int recvsz;
-{
- CLIENT *cl;
- register struct cu_data *cu;
- struct timeval now;
- struct rpc_msg call_msg;
-
- cl = (CLIENT *)mem_alloc(sizeof(CLIENT));
- if (cl == NULL) {
- (void) fprintf(stderr, "clntudp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- sendsz = ((sendsz + 3) / 4) * 4;
- recvsz = ((recvsz + 3) / 4) * 4;
- cu = (struct cu_data *)mem_alloc(sizeof(*cu) + sendsz + recvsz);
- if (cu == NULL) {
- (void) fprintf(stderr, "clntudp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- cu->cu_outbuf = &cu->cu_inbuf[recvsz];
-
- (void)gettimeofday(&now, (struct timezone *)0);
- if (raddr->sin_port == 0) {
- u_short port;
- if ((port =
- pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) {
- goto fooy;
- }
- raddr->sin_port = htons(port);
- }
- cl->cl_ops = &udp_ops;
- cl->cl_private = (caddr_t)cu;
- cu->cu_raddr = *raddr;
- cu->cu_rlen = sizeof (cu->cu_raddr);
- cu->cu_wait = wait;
- cu->cu_total.tv_sec = -1;
- cu->cu_total.tv_usec = -1;
- cu->cu_sendsz = sendsz;
- cu->cu_recvsz = recvsz;
- call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
- call_msg.rm_direction = CALL;
- call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- call_msg.rm_call.cb_prog = program;
- call_msg.rm_call.cb_vers = version;
- xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf,
- sendsz, XDR_ENCODE);
- if (! xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) {
- goto fooy;
- }
- cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
- if (*sockp < 0) {
- int dontblock = 1;
-
- *sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (*sockp < 0) {
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- /* attempt to bind to prov port */
- (void)bindresvport(*sockp, (struct sockaddr_in *)0);
- /* the sockets rpc controls are non-blocking */
- (void)ioctl(*sockp, FIONBIO, (char *) &dontblock);
- cu->cu_closeit = TRUE;
- } else {
- cu->cu_closeit = FALSE;
- }
- cu->cu_sock = *sockp;
- cl->cl_auth = authnone_create();
- return (cl);
-fooy:
- if (cu)
- mem_free((caddr_t)cu, sizeof(*cu) + sendsz + recvsz);
- if (cl)
- mem_free((caddr_t)cl, sizeof(CLIENT));
- return ((CLIENT *)NULL);
-}
-
-CLIENT *
-clntudp_create(raddr, program, version, wait, sockp)
- struct sockaddr_in *raddr;
- u_long program;
- u_long version;
- struct timeval wait;
- register int *sockp;
-{
-
- return(clntudp_bufcreate(raddr, program, version, wait, sockp,
- UDPMSGSIZE, UDPMSGSIZE));
-}
-
-static enum clnt_stat
-clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
- register CLIENT *cl; /* client handle */
- u_long proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- caddr_t argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- caddr_t resultsp; /* pointer to results */
- struct timeval utimeout; /* seconds to wait before giving up */
-{
- register struct cu_data *cu = (struct cu_data *)cl->cl_private;
- register XDR *xdrs;
- register int outlen;
- register int inlen;
- int fromlen;
-#ifdef FD_SETSIZE
- fd_set readfds;
- fd_set mask;
-#else
- int readfds;
- register int mask;
-#endif /* def FD_SETSIZE */
- struct sockaddr_in from;
- struct rpc_msg reply_msg;
- XDR reply_xdrs;
- struct timeval time_waited;
- bool_t ok;
- int nrefreshes = 2; /* number of times to refresh cred */
- struct timeval timeout;
-
- if (cu->cu_total.tv_usec == -1) {
- timeout = utimeout; /* use supplied timeout */
- } else {
- timeout = cu->cu_total; /* use default timeout */
- }
-
- time_waited.tv_sec = 0;
- time_waited.tv_usec = 0;
-call_again:
- xdrs = &(cu->cu_outxdrs);
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, cu->cu_xdrpos);
- /*
- * the transaction is the first thing in the out buffer
- */
- (*(u_short *)(cu->cu_outbuf))++;
- if ((! XDR_PUTLONG(xdrs, (long *)&proc)) ||
- (! AUTH_MARSHALL(cl->cl_auth, xdrs)) ||
- (! (*xargs)(xdrs, argsp)))
- return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
- outlen = (int)XDR_GETPOS(xdrs);
-
-send_again:
- if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0,
- (struct sockaddr *)&(cu->cu_raddr), cu->cu_rlen)
- != outlen) {
- cu->cu_error.re_errno = errno;
- return (cu->cu_error.re_status = RPC_CANTSEND);
- }
-
- /*
- * Hack to provide rpc-based message passing
- */
- if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
- return (cu->cu_error.re_status = RPC_TIMEDOUT);
- }
- /*
- * sub-optimal code appears here because we have
- * some clock time to spare while the packets are in flight.
- * (We assume that this is actually only executed once.)
- */
- reply_msg.acpted_rply.ar_verf = _null_auth;
- reply_msg.acpted_rply.ar_results.where = resultsp;
- reply_msg.acpted_rply.ar_results.proc = xresults;
-#ifdef FD_SETSIZE
- FD_ZERO(&mask);
- FD_SET(cu->cu_sock, &mask);
-#else
- mask = 1 << cu->cu_sock;
-#endif /* def FD_SETSIZE */
- for (;;) {
- readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, (int *)NULL,
- (int *)NULL, &(cu->cu_wait))) {
-
- case 0:
- time_waited.tv_sec += cu->cu_wait.tv_sec;
- time_waited.tv_usec += cu->cu_wait.tv_usec;
- while (time_waited.tv_usec >= 1000000) {
- time_waited.tv_sec++;
- time_waited.tv_usec -= 1000000;
- }
- if ((time_waited.tv_sec < timeout.tv_sec) ||
- ((time_waited.tv_sec == timeout.tv_sec) &&
- (time_waited.tv_usec < timeout.tv_usec)))
- goto send_again;
- return (cu->cu_error.re_status = RPC_TIMEDOUT);
-
- /*
- * buggy in other cases because time_waited is not being
- * updated.
- */
- case -1:
- if (errno == EINTR)
- continue;
- cu->cu_error.re_errno = errno;
- return (cu->cu_error.re_status = RPC_CANTRECV);
- }
- do {
- fromlen = sizeof(struct sockaddr);
- inlen = recvfrom(cu->cu_sock, cu->cu_inbuf,
- (int) cu->cu_recvsz, 0,
- (struct sockaddr *)&from, &fromlen);
- } while (inlen < 0 && errno == EINTR);
- if (inlen < 0) {
- if (errno == EWOULDBLOCK)
- continue;
- cu->cu_error.re_errno = errno;
- return (cu->cu_error.re_status = RPC_CANTRECV);
- }
- if (inlen < sizeof(u_long))
- continue;
- /* see if reply transaction id matches sent id */
- if (*((u_long *)(cu->cu_inbuf)) != *((u_long *)(cu->cu_outbuf)))
- continue;
- /* we now assume we have the proper reply */
- break;
- }
-
- /*
- * now decode and validate the response
- */
- xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int)inlen, XDR_DECODE);
- ok = xdr_replymsg(&reply_xdrs, &reply_msg);
- /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */
- if (ok) {
- _seterr_reply(&reply_msg, &(cu->cu_error));
- if (cu->cu_error.re_status == RPC_SUCCESS) {
- if (! AUTH_VALIDATE(cl->cl_auth,
- &reply_msg.acpted_rply.ar_verf)) {
- cu->cu_error.re_status = RPC_AUTHERROR;
- cu->cu_error.re_why = AUTH_INVALIDRESP;
- }
- if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
- xdrs->x_op = XDR_FREE;
- (void)xdr_opaque_auth(xdrs,
- &(reply_msg.acpted_rply.ar_verf));
- }
- } /* end successful completion */
- else {
- /* maybe our credentials need to be refreshed ... */
- if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth)) {
- nrefreshes--;
- goto call_again;
- }
- } /* end of unsuccessful completion */
- } /* end of valid reply message */
- else {
- cu->cu_error.re_status = RPC_CANTDECODERES;
- }
- return (cu->cu_error.re_status);
-}
-
-static void
-clntudp_geterr(cl, errp)
- CLIENT *cl;
- struct rpc_err *errp;
-{
- register struct cu_data *cu = (struct cu_data *)cl->cl_private;
-
- *errp = cu->cu_error;
-}
-
-
-static bool_t
-clntudp_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- caddr_t res_ptr;
-{
- register struct cu_data *cu = (struct cu_data *)cl->cl_private;
- register XDR *xdrs = &(cu->cu_outxdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_res)(xdrs, res_ptr));
-}
-
-static void
-clntudp_abort(/*h*/)
- /*CLIENT *h;*/
-{
-}
-
-static bool_t
-clntudp_control(cl, request, info)
- CLIENT *cl;
- int request;
- char *info;
-{
- register struct cu_data *cu = (struct cu_data *)cl->cl_private;
-
- switch (request) {
- case CLSET_TIMEOUT:
- cu->cu_total = *(struct timeval *)info;
- break;
- case CLGET_TIMEOUT:
- *(struct timeval *)info = cu->cu_total;
- break;
- case CLSET_RETRY_TIMEOUT:
- cu->cu_wait = *(struct timeval *)info;
- break;
- case CLGET_RETRY_TIMEOUT:
- *(struct timeval *)info = cu->cu_wait;
- break;
- case CLGET_SERVER_ADDR:
- *(struct sockaddr_in *)info = cu->cu_raddr;
- break;
- default:
- return (FALSE);
- }
- return (TRUE);
-}
-
-static void
-clntudp_destroy(cl)
- CLIENT *cl;
-{
- register struct cu_data *cu = (struct cu_data *)cl->cl_private;
-
- if (cu->cu_closeit) {
- (void)close(cu->cu_sock);
- }
- XDR_DESTROY(&(cu->cu_outxdrs));
- mem_free((caddr_t)cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz));
- mem_free((caddr_t)cl, sizeof(CLIENT));
-}
diff --git a/lib/librpc/rpc/get_myaddress.c b/lib/librpc/rpc/get_myaddress.c
deleted file mode 100644
index 60b1227..0000000
--- a/lib/librpc/rpc/get_myaddress.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* @(#)get_myaddress.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * get_myaddress.c
- *
- * Get client's IP address via ioctl. This avoids using the yellowpages.
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/pmap_prot.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <net/if.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-/*
- * don't use gethostbyname, which would invoke yellow pages
- */
-get_myaddress(addr)
- struct sockaddr_in *addr;
-{
- int s;
- char buf[BUFSIZ];
- struct ifconf ifc;
- struct ifreq ifreq, *ifr;
- int len, slop;
-
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- perror("get_myaddress: socket");
- exit(1);
- }
- ifc.ifc_len = sizeof (buf);
- ifc.ifc_buf = buf;
- if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
- perror("get_myaddress: ioctl (get interface configuration)");
- exit(1);
- }
- ifr = ifc.ifc_req;
- for (len = ifc.ifc_len; len; len -= sizeof ifreq) {
- ifreq = *ifr;
- if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) {
- perror("get_myaddress: ioctl");
- exit(1);
- }
- if ((ifreq.ifr_flags & IFF_UP) &&
- ifr->ifr_addr.sa_family == AF_INET) {
- *addr = *((struct sockaddr_in *)&ifr->ifr_addr);
- addr->sin_port = htons(PMAPPORT);
- break;
- }
- /*
- * Deal with variable length addresses
- */
- slop = ifr->ifr_addr.sa_len - sizeof (struct sockaddr);
- if (slop) {
- ifr = (struct ifreq *) ((caddr_t)ifr + slop);
- len -= slop;
- }
- ifr++;
- }
- (void) close(s);
-}
diff --git a/lib/librpc/rpc/getrpcent.c b/lib/librpc/rpc/getrpcent.c
deleted file mode 100644
index e103546..0000000
--- a/lib/librpc/rpc/getrpcent.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* @(#)getrpcent.c 2.2 88/07/29 4.0 RPCSRC */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)getrpcent.c 1.9 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1985 by Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <rpc/rpc.h>
-#include <netdb.h>
-#include <sys/socket.h>
-
-/*
- * Internet version.
- */
-struct rpcdata {
- FILE *rpcf;
- char *current;
- int currentlen;
- int stayopen;
-#define MAXALIASES 35
- char *rpc_aliases[MAXALIASES];
- struct rpcent rpc;
- char line[BUFSIZ+1];
- char *domain;
-} *rpcdata;
-
-static struct rpcent *interpret();
-struct hostent *gethostent();
-char *inet_ntoa();
-char *index();
-
-static char RPCDB[] = "/etc/rpc";
-
-static struct rpcdata *
-_rpcdata()
-{
- register struct rpcdata *d = rpcdata;
-
- if (d == 0) {
- d = (struct rpcdata *)calloc(1, sizeof (struct rpcdata));
- rpcdata = d;
- }
- return (d);
-}
-
-struct rpcent *
-getrpcbynumber(number)
- register int number;
-{
- register struct rpcdata *d = _rpcdata();
- register struct rpcent *p;
- int reason;
- char adrstr[16], *val = NULL;
- int vallen;
-
- if (d == 0)
- return (0);
- setrpcent(0);
- while (p = getrpcent()) {
- if (p->r_number == number)
- break;
- }
- endrpcent();
- return (p);
-}
-
-struct rpcent *
-getrpcbyname(name)
- char *name;
-{
- struct rpcent *rpc;
- char **rp;
-
- setrpcent(0);
- while(rpc = getrpcent()) {
- if (strcmp(rpc->r_name, name) == 0)
- return (rpc);
- for (rp = rpc->r_aliases; *rp != NULL; rp++) {
- if (strcmp(*rp, name) == 0)
- return (rpc);
- }
- }
- endrpcent();
- return (NULL);
-}
-
-setrpcent(f)
- int f;
-{
- register struct rpcdata *d = _rpcdata();
-
- if (d == 0)
- return;
- if (d->rpcf == NULL)
- d->rpcf = fopen(RPCDB, "r");
- else
- rewind(d->rpcf);
- if (d->current)
- free(d->current);
- d->current = NULL;
- d->stayopen |= f;
-}
-
-endrpcent()
-{
- register struct rpcdata *d = _rpcdata();
-
- if (d == 0)
- return;
- if (d->current && !d->stayopen) {
- free(d->current);
- d->current = NULL;
- }
- if (d->rpcf && !d->stayopen) {
- fclose(d->rpcf);
- d->rpcf = NULL;
- }
-}
-
-struct rpcent *
-getrpcent()
-{
- struct rpcent *hp;
- int reason;
- char *key = NULL, *val = NULL;
- int keylen, vallen;
- register struct rpcdata *d = _rpcdata();
-
- if (d == 0)
- return(NULL);
- if (d->rpcf == NULL && (d->rpcf = fopen(RPCDB, "r")) == NULL)
- return (NULL);
- if (fgets(d->line, BUFSIZ, d->rpcf) == NULL)
- return (NULL);
- return interpret(d->line, strlen(d->line));
-}
-
-static struct rpcent *
-interpret(val, len)
-{
- register struct rpcdata *d = _rpcdata();
- char *p;
- register char *cp, **q;
-
- if (d == 0)
- return;
- strncpy(d->line, val, len);
- p = d->line;
- d->line[len] = '\n';
- if (*p == '#')
- return (getrpcent());
- cp = index(p, '#');
- if (cp == NULL)
- {
- cp = index(p, '\n');
- if (cp == NULL)
- return (getrpcent());
- }
- *cp = '\0';
- cp = index(p, ' ');
- if (cp == NULL)
- {
- cp = index(p, '\t');
- if (cp == NULL)
- return (getrpcent());
- }
- *cp++ = '\0';
- /* THIS STUFF IS INTERNET SPECIFIC */
- d->rpc.r_name = d->line;
- while (*cp == ' ' || *cp == '\t')
- cp++;
- d->rpc.r_number = atoi(cp);
- q = d->rpc.r_aliases = d->rpc_aliases;
- cp = index(p, ' ');
- if (cp != NULL)
- *cp++ = '\0';
- else
- {
- cp = index(p, '\t');
- if (cp != NULL)
- *cp++ = '\0';
- }
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &(d->rpc_aliases[MAXALIASES - 1]))
- *q++ = cp;
- cp = index(p, ' ');
- if (cp != NULL)
- *cp++ = '\0';
- else
- {
- cp = index(p, '\t');
- if (cp != NULL)
- *cp++ = '\0';
- }
- }
- *q = NULL;
- return (&d->rpc);
-}
diff --git a/lib/librpc/rpc/getrpcport.c b/lib/librpc/rpc/getrpcport.c
deleted file mode 100644
index 9b13bac..0000000
--- a/lib/librpc/rpc/getrpcport.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* @(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1985 by Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <netdb.h>
-#include <sys/socket.h>
-
-getrpcport(host, prognum, versnum, proto)
- char *host;
-{
- struct sockaddr_in addr;
- struct hostent *hp;
-
- if ((hp = gethostbyname(host)) == NULL)
- return (0);
- bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
- addr.sin_family = AF_INET;
- addr.sin_port = 0;
- return (pmap_getport(&addr, prognum, versnum, proto));
-}
diff --git a/lib/librpc/rpc/pmap_clnt.c b/lib/librpc/rpc/pmap_clnt.c
deleted file mode 100644
index 09220e7..0000000
--- a/lib/librpc/rpc/pmap_clnt.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* @(#)pmap_clnt.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_clnt.c
- * Client interface to pmap rpc service.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-
-static struct timeval timeout = { 5, 0 };
-static struct timeval tottimeout = { 60, 0 };
-
-void clnt_perror();
-
-
-/*
- * Set a mapping between program,version and port.
- * Calls the pmap service remotely to do the mapping.
- */
-bool_t
-pmap_set(program, version, protocol, port)
- u_long program;
- u_long version;
- int protocol;
- u_short port;
-{
- struct sockaddr_in myaddress;
- int socket = -1;
- register CLIENT *client;
- struct pmap parms;
- bool_t rslt;
-
- get_myaddress(&myaddress);
- client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS,
- timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
- if (client == (CLIENT *)NULL)
- return (FALSE);
- parms.pm_prog = program;
- parms.pm_vers = version;
- parms.pm_prot = protocol;
- parms.pm_port = port;
- if (CLNT_CALL(client, PMAPPROC_SET, xdr_pmap, &parms, xdr_bool, &rslt,
- tottimeout) != RPC_SUCCESS) {
- clnt_perror(client, "Cannot register service");
- return (FALSE);
- }
- CLNT_DESTROY(client);
- (void)close(socket);
- return (rslt);
-}
-
-/*
- * Remove the mapping between program,version and port.
- * Calls the pmap service remotely to do the un-mapping.
- */
-bool_t
-pmap_unset(program, version)
- u_long program;
- u_long version;
-{
- struct sockaddr_in myaddress;
- int socket = -1;
- register CLIENT *client;
- struct pmap parms;
- bool_t rslt;
-
- get_myaddress(&myaddress);
- client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS,
- timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
- if (client == (CLIENT *)NULL)
- return (FALSE);
- parms.pm_prog = program;
- parms.pm_vers = version;
- parms.pm_port = parms.pm_prot = 0;
- CLNT_CALL(client, PMAPPROC_UNSET, xdr_pmap, &parms, xdr_bool, &rslt,
- tottimeout);
- CLNT_DESTROY(client);
- (void)close(socket);
- return (rslt);
-}
diff --git a/lib/librpc/rpc/pmap_clnt.h b/lib/librpc/rpc/pmap_clnt.h
deleted file mode 100644
index d2ea2a8..0000000
--- a/lib/librpc/rpc/pmap_clnt.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * pmap_clnt.h
- * Supplies C routines to get to portmap services.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-/*
- * Usage:
- * success = pmap_set(program, version, protocol, port);
- * success = pmap_unset(program, version);
- * port = pmap_getport(address, program, version, protocol);
- * head = pmap_getmaps(address);
- * clnt_stat = pmap_rmtcall(address, program, version, procedure,
- * xdrargs, argsp, xdrres, resp, tout, port_ptr)
- * (works for udp only.)
- * clnt_stat = clnt_broadcast(program, version, procedure,
- * xdrargs, argsp, xdrres, resp, eachresult)
- * (like pmap_rmtcall, except the call is broadcasted to all
- * locally connected nets. For each valid response received,
- * the procedure eachresult is called. Its form is:
- * done = eachresult(resp, raddr)
- * bool_t done;
- * caddr_t resp;
- * struct sockaddr_in raddr;
- * where resp points to the results of the call and raddr is the
- * address if the responder to the broadcast.
- */
-
-extern bool_t pmap_set();
-extern bool_t pmap_unset();
-extern struct pmaplist *pmap_getmaps();
-enum clnt_stat pmap_rmtcall();
-enum clnt_stat clnt_broadcast();
-extern u_short pmap_getport();
diff --git a/lib/librpc/rpc/pmap_getmaps.c b/lib/librpc/rpc/pmap_getmaps.c
deleted file mode 100644
index e4a9c49..0000000
--- a/lib/librpc/rpc/pmap_getmaps.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* @(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_getmap.c
- * Client interface to pmap rpc service.
- * contains pmap_getmaps, which is only tcp service involved
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <errno.h>
-#include <net/if.h>
-#include <sys/ioctl.h>
-#define NAMELEN 255
-#define MAX_BROADCAST_SIZE 1400
-
-extern int errno;
-
-/*
- * Get a copy of the current port maps.
- * Calls the pmap service remotely to do get the maps.
- */
-struct pmaplist *
-pmap_getmaps(address)
- struct sockaddr_in *address;
-{
- struct pmaplist *head = (struct pmaplist *)NULL;
- int socket = -1;
- struct timeval minutetimeout;
- register CLIENT *client;
-
- minutetimeout.tv_sec = 60;
- minutetimeout.tv_usec = 0;
- address->sin_port = htons(PMAPPORT);
- client = clnttcp_create(address, PMAPPROG,
- PMAPVERS, &socket, 50, 500);
- if (client != (CLIENT *)NULL) {
- if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist,
- &head, minutetimeout) != RPC_SUCCESS) {
- clnt_perror(client, "pmap_getmaps rpc problem");
- }
- CLNT_DESTROY(client);
- }
- (void)close(socket);
- address->sin_port = 0;
- return (head);
-}
diff --git a/lib/librpc/rpc/pmap_getport.c b/lib/librpc/rpc/pmap_getport.c
deleted file mode 100644
index 77b9cf7..0000000
--- a/lib/librpc/rpc/pmap_getport.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* @(#)pmap_getport.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_getport.c
- * Client interface to pmap rpc service.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <sys/socket.h>
-#include <net/if.h>
-
-static struct timeval timeout = { 5, 0 };
-static struct timeval tottimeout = { 60, 0 };
-
-/*
- * Find the mapped port for program,version.
- * Calls the pmap service remotely to do the lookup.
- * Returns 0 if no map exists.
- */
-u_short
-pmap_getport(address, program, version, protocol)
- struct sockaddr_in *address;
- u_long program;
- u_long version;
- u_int protocol;
-{
- u_short port = 0;
- int socket = -1;
- register CLIENT *client;
- struct pmap parms;
-
- address->sin_port = htons(PMAPPORT);
- client = clntudp_bufcreate(address, PMAPPROG,
- PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
- if (client != (CLIENT *)NULL) {
- parms.pm_prog = program;
- parms.pm_vers = version;
- parms.pm_prot = protocol;
- parms.pm_port = 0; /* not needed or used */
- if (CLNT_CALL(client, PMAPPROC_GETPORT, xdr_pmap, &parms,
- xdr_u_short, &port, tottimeout) != RPC_SUCCESS){
- rpc_createerr.cf_stat = RPC_PMAPFAILURE;
- clnt_geterr(client, &rpc_createerr.cf_error);
- } else if (port == 0) {
- rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
- }
- CLNT_DESTROY(client);
- }
- (void)close(socket);
- address->sin_port = 0;
- return (port);
-}
diff --git a/lib/librpc/rpc/pmap_prot.c b/lib/librpc/rpc/pmap_prot.c
deleted file mode 100644
index 643c2ff..0000000
--- a/lib/librpc/rpc/pmap_prot.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_prot.c
- * Protocol for the local binder service, or pmap.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/pmap_prot.h>
-
-
-bool_t
-xdr_pmap(xdrs, regs)
- XDR *xdrs;
- struct pmap *regs;
-{
-
- if (xdr_u_long(xdrs, &regs->pm_prog) &&
- xdr_u_long(xdrs, &regs->pm_vers) &&
- xdr_u_long(xdrs, &regs->pm_prot))
- return (xdr_u_long(xdrs, &regs->pm_port));
- return (FALSE);
-}
diff --git a/lib/librpc/rpc/pmap_prot.h b/lib/librpc/rpc/pmap_prot.h
deleted file mode 100644
index ccf7a77..0000000
--- a/lib/librpc/rpc/pmap_prot.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * pmap_prot.h
- * Protocol for the local binder service, or pmap.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The following procedures are supported by the protocol:
- *
- * PMAPPROC_NULL() returns ()
- * takes nothing, returns nothing
- *
- * PMAPPROC_SET(struct pmap) returns (bool_t)
- * TRUE is success, FALSE is failure. Registers the tuple
- * [prog, vers, prot, port].
- *
- * PMAPPROC_UNSET(struct pmap) returns (bool_t)
- * TRUE is success, FALSE is failure. Un-registers pair
- * [prog, vers]. prot and port are ignored.
- *
- * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
- * 0 is failure. Otherwise returns the port number where the pair
- * [prog, vers] is registered. It may lie!
- *
- * PMAPPROC_DUMP() RETURNS (struct pmaplist *)
- *
- * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
- * RETURNS (port, string<>);
- * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
- * Calls the procedure on the local machine. If it is not registered,
- * this procedure is quite; ie it does not return error information!!!
- * This procedure only is supported on rpc/udp and calls via
- * rpc/udp. This routine only passes null authentication parameters.
- * This file has no interface to xdr routines for PMAPPROC_CALLIT.
- *
- * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
- */
-
-#define PMAPPORT ((u_short)111)
-#define PMAPPROG ((u_long)100000)
-#define PMAPVERS ((u_long)2)
-#define PMAPVERS_PROTO ((u_long)2)
-#define PMAPVERS_ORIG ((u_long)1)
-#define PMAPPROC_NULL ((u_long)0)
-#define PMAPPROC_SET ((u_long)1)
-#define PMAPPROC_UNSET ((u_long)2)
-#define PMAPPROC_GETPORT ((u_long)3)
-#define PMAPPROC_DUMP ((u_long)4)
-#define PMAPPROC_CALLIT ((u_long)5)
-
-struct pmap {
- long unsigned pm_prog;
- long unsigned pm_vers;
- long unsigned pm_prot;
- long unsigned pm_port;
-};
-
-extern bool_t xdr_pmap();
-
-struct pmaplist {
- struct pmap pml_map;
- struct pmaplist *pml_next;
-};
-
-extern bool_t xdr_pmaplist();
diff --git a/lib/librpc/rpc/pmap_prot2.c b/lib/librpc/rpc/pmap_prot2.c
deleted file mode 100644
index e2a8214..0000000
--- a/lib/librpc/rpc/pmap_prot2.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* @(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_prot2.c
- * Protocol for the local binder service, or pmap.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/pmap_prot.h>
-
-
-/*
- * What is going on with linked lists? (!)
- * First recall the link list declaration from pmap_prot.h:
- *
- * struct pmaplist {
- * struct pmap pml_map;
- * struct pmaplist *pml_map;
- * };
- *
- * Compare that declaration with a corresponding xdr declaration that
- * is (a) pointer-less, and (b) recursive:
- *
- * typedef union switch (bool_t) {
- *
- * case TRUE: struct {
- * struct pmap;
- * pmaplist_t foo;
- * };
- *
- * case FALSE: struct {};
- * } pmaplist_t;
- *
- * Notice that the xdr declaration has no nxt pointer while
- * the C declaration has no bool_t variable. The bool_t can be
- * interpreted as ``more data follows me''; if FALSE then nothing
- * follows this bool_t; if TRUE then the bool_t is followed by
- * an actual struct pmap, and then (recursively) by the
- * xdr union, pamplist_t.
- *
- * This could be implemented via the xdr_union primitive, though this
- * would cause a one recursive call per element in the list. Rather than do
- * that we can ``unwind'' the recursion
- * into a while loop and do the union arms in-place.
- *
- * The head of the list is what the C programmer wishes to past around
- * the net, yet is the data that the pointer points to which is interesting;
- * this sounds like a job for xdr_reference!
- */
-bool_t
-xdr_pmaplist(xdrs, rp)
- register XDR *xdrs;
- register struct pmaplist **rp;
-{
- /*
- * more_elements is pre-computed in case the direction is
- * XDR_ENCODE or XDR_FREE. more_elements is overwritten by
- * xdr_bool when the direction is XDR_DECODE.
- */
- bool_t more_elements;
- register int freeing = (xdrs->x_op == XDR_FREE);
- register struct pmaplist **next;
-
- while (TRUE) {
- more_elements = (bool_t)(*rp != NULL);
- if (! xdr_bool(xdrs, &more_elements))
- return (FALSE);
- if (! more_elements)
- return (TRUE); /* we are done */
- /*
- * the unfortunate side effect of non-recursion is that in
- * the case of freeing we must remember the next object
- * before we free the current object ...
- */
- if (freeing)
- next = &((*rp)->pml_next);
- if (! xdr_reference(xdrs, (caddr_t *)rp,
- (u_int)sizeof(struct pmaplist), xdr_pmap))
- return (FALSE);
- rp = (freeing) ? next : &((*rp)->pml_next);
- }
-}
diff --git a/lib/librpc/rpc/pmap_rmt.c b/lib/librpc/rpc/pmap_rmt.c
deleted file mode 100644
index 8945b2f..0000000
--- a/lib/librpc/rpc/pmap_rmt.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_rmt.c
- * Client interface to pmap rpc service.
- * remote call and broadcast service
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <rpc/pmap_rmt.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <errno.h>
-#include <net/if.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#define MAX_BROADCAST_SIZE 1400
-
-extern int errno;
-static struct timeval timeout = { 3, 0 };
-
-
-/*
- * pmapper remote-call-service interface.
- * This routine is used to call the pmapper remote call service
- * which will look up a service program in the port maps, and then
- * remotely call that routine with the given parameters. This allows
- * programs to do a lookup and call in one step.
-*/
-enum clnt_stat
-pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_ptr)
- struct sockaddr_in *addr;
- u_long prog, vers, proc;
- xdrproc_t xdrargs, xdrres;
- caddr_t argsp, resp;
- struct timeval tout;
- u_long *port_ptr;
-{
- int socket = -1;
- register CLIENT *client;
- struct rmtcallargs a;
- struct rmtcallres r;
- enum clnt_stat stat;
-
- addr->sin_port = htons(PMAPPORT);
- client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket);
- if (client != (CLIENT *)NULL) {
- a.prog = prog;
- a.vers = vers;
- a.proc = proc;
- a.args_ptr = argsp;
- a.xdr_args = xdrargs;
- r.port_ptr = port_ptr;
- r.results_ptr = resp;
- r.xdr_results = xdrres;
- stat = CLNT_CALL(client, PMAPPROC_CALLIT, xdr_rmtcall_args, &a,
- xdr_rmtcallres, &r, tout);
- CLNT_DESTROY(client);
- } else {
- stat = RPC_FAILED;
- }
- (void)close(socket);
- addr->sin_port = 0;
- return (stat);
-}
-
-
-/*
- * XDR remote call arguments
- * written for XDR_ENCODE direction only
- */
-bool_t
-xdr_rmtcall_args(xdrs, cap)
- register XDR *xdrs;
- register struct rmtcallargs *cap;
-{
- u_int lenposition, argposition, position;
-
- if (xdr_u_long(xdrs, &(cap->prog)) &&
- xdr_u_long(xdrs, &(cap->vers)) &&
- xdr_u_long(xdrs, &(cap->proc))) {
- lenposition = XDR_GETPOS(xdrs);
- if (! xdr_u_long(xdrs, &(cap->arglen)))
- return (FALSE);
- argposition = XDR_GETPOS(xdrs);
- if (! (*(cap->xdr_args))(xdrs, cap->args_ptr))
- return (FALSE);
- position = XDR_GETPOS(xdrs);
- cap->arglen = (u_long)position - (u_long)argposition;
- XDR_SETPOS(xdrs, lenposition);
- if (! xdr_u_long(xdrs, &(cap->arglen)))
- return (FALSE);
- XDR_SETPOS(xdrs, position);
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR remote call results
- * written for XDR_DECODE direction only
- */
-bool_t
-xdr_rmtcallres(xdrs, crp)
- register XDR *xdrs;
- register struct rmtcallres *crp;
-{
- caddr_t port_ptr;
-
- port_ptr = (caddr_t)crp->port_ptr;
- if (xdr_reference(xdrs, &port_ptr, sizeof (u_long),
- xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
- crp->port_ptr = (u_long *)port_ptr;
- return ((*(crp->xdr_results))(xdrs, crp->results_ptr));
- }
- return (FALSE);
-}
-
-
-/*
- * The following is kludged-up support for simple rpc broadcasts.
- * Someday a large, complicated system will replace these trivial
- * routines which only support udp/ip .
- */
-
-static int
-getbroadcastnets(addrs, sock, buf)
- struct in_addr *addrs;
- int sock; /* any valid socket will do */
- char *buf; /* why allocxate more when we can use existing... */
-{
- struct ifconf ifc;
- struct ifreq ifreq, *ifr;
- struct sockaddr_in *sin;
- char *cp, *cplim;
- int n, i = 0;
-
- ifc.ifc_len = UDPMSGSIZE;
- ifc.ifc_buf = buf;
- if (ioctl(sock, SIOCGIFCONF, (char *)&ifc) < 0) {
- perror("broadcast: ioctl (get interface configuration)");
- return (0);
- }
-#define max(a, b) (a > b ? a : b)
-#define size(p) max((p).sa_len, sizeof(p))
- cplim = buf + ifc.ifc_len; /*skip over if's with big ifr_addr's */
- for (cp = buf; cp < cplim;
- cp += sizeof (ifr->ifr_name) + size(ifr->ifr_addr)) {
- ifr = (struct ifreq *)cp;
- if (ifr->ifr_addr.sa_family != AF_INET)
- continue;
- ifreq = *ifr;
- if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifreq) < 0) {
- perror("broadcast: ioctl (get interface flags)");
- continue;
- }
- if ((ifreq.ifr_flags & IFF_BROADCAST) &&
- (ifreq.ifr_flags & IFF_UP)) {
- sin = (struct sockaddr_in *)&ifr->ifr_addr;
-#ifdef SIOCGIFBRDADDR /* 4.3BSD */
- if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
- addrs[i++] =
- inet_makeaddr(inet_netof(sin->sin_addr),
- INADDR_ANY);
- } else {
- addrs[i++] = ((struct sockaddr_in*)
- &ifreq.ifr_addr)->sin_addr;
- }
-#else /* 4.2 BSD */
- addrs[i++] = inet_makeaddr(inet_netof(sin->sin_addr),
- INADDR_ANY);
-#endif
- }
- }
- return (i);
-}
-
-typedef bool_t (*resultproc_t)();
-
-enum clnt_stat
-clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
- u_long prog; /* program number */
- u_long vers; /* version number */
- u_long proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- caddr_t argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- caddr_t resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
-{
- enum clnt_stat stat;
- AUTH *unix_auth = authunix_create_default();
- XDR xdr_stream;
- register XDR *xdrs = &xdr_stream;
- int outlen, inlen, fromlen, nets;
- register int sock;
- int on = 1;
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
-#else
- int readfds;
- register int mask;
-#endif /* def FD_SETSIZE */
- register int i;
- bool_t done = FALSE;
- register u_long xid;
- u_long port;
- struct in_addr addrs[20];
- struct sockaddr_in baddr, raddr; /* broadcast and response addresses */
- struct rmtcallargs a;
- struct rmtcallres r;
- struct rpc_msg msg;
- struct timeval t;
- char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE];
-
- /*
- * initialization: create a socket, a broadcast address, and
- * preserialize the arguments into a send buffer.
- */
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- perror("Cannot create socket for broadcast rpc");
- stat = RPC_CANTSEND;
- goto done_broad;
- }
-#ifdef SO_BROADCAST
- if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
- perror("Cannot set socket option SO_BROADCAST");
- stat = RPC_CANTSEND;
- goto done_broad;
- }
-#endif /* def SO_BROADCAST */
-#ifdef FD_SETSIZE
- FD_ZERO(&mask);
- FD_SET(sock, &mask);
-#else
- mask = (1 << sock);
-#endif /* def FD_SETSIZE */
- nets = getbroadcastnets(addrs, sock, inbuf);
- bzero((char *)&baddr, sizeof (baddr));
- baddr.sin_family = AF_INET;
- baddr.sin_port = htons(PMAPPORT);
- baddr.sin_addr.s_addr = htonl(INADDR_ANY);
-/* baddr.sin_addr.S_un.S_addr = htonl(INADDR_ANY); */
- (void)gettimeofday(&t, (struct timezone *)0);
- msg.rm_xid = xid = getpid() ^ t.tv_sec ^ t.tv_usec;
- t.tv_usec = 0;
- msg.rm_direction = CALL;
- msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- msg.rm_call.cb_prog = PMAPPROG;
- msg.rm_call.cb_vers = PMAPVERS;
- msg.rm_call.cb_proc = PMAPPROC_CALLIT;
- msg.rm_call.cb_cred = unix_auth->ah_cred;
- msg.rm_call.cb_verf = unix_auth->ah_verf;
- a.prog = prog;
- a.vers = vers;
- a.proc = proc;
- a.xdr_args = xargs;
- a.args_ptr = argsp;
- r.port_ptr = &port;
- r.xdr_results = xresults;
- r.results_ptr = resultsp;
- xdrmem_create(xdrs, outbuf, MAX_BROADCAST_SIZE, XDR_ENCODE);
- if ((! xdr_callmsg(xdrs, &msg)) || (! xdr_rmtcall_args(xdrs, &a))) {
- stat = RPC_CANTENCODEARGS;
- goto done_broad;
- }
- outlen = (int)xdr_getpos(xdrs);
- xdr_destroy(xdrs);
- /*
- * Basic loop: broadcast a packet and wait a while for response(s).
- * The response timeout grows larger per iteration.
- */
- for (t.tv_sec = 4; t.tv_sec <= 14; t.tv_sec += 2) {
- for (i = 0; i < nets; i++) {
- baddr.sin_addr = addrs[i];
- if (sendto(sock, outbuf, outlen, 0,
- (struct sockaddr *)&baddr,
- sizeof (struct sockaddr)) != outlen) {
- perror("Cannot send broadcast packet");
- stat = RPC_CANTSEND;
- goto done_broad;
- }
- }
- if (eachresult == NULL) {
- stat = RPC_SUCCESS;
- goto done_broad;
- }
- recv_again:
- msg.acpted_rply.ar_verf = _null_auth;
- msg.acpted_rply.ar_results.where = (caddr_t)&r;
- msg.acpted_rply.ar_results.proc = xdr_rmtcallres;
- readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, (int *)NULL,
- (int *)NULL, &t)) {
-
- case 0: /* timed out */
- stat = RPC_TIMEDOUT;
- continue;
-
- case -1: /* some kind of error */
- if (errno == EINTR)
- goto recv_again;
- perror("Broadcast select problem");
- stat = RPC_CANTRECV;
- goto done_broad;
-
- } /* end of select results switch */
- try_again:
- fromlen = sizeof(struct sockaddr);
- inlen = recvfrom(sock, inbuf, UDPMSGSIZE, 0,
- (struct sockaddr *)&raddr, &fromlen);
- if (inlen < 0) {
- if (errno == EINTR)
- goto try_again;
- perror("Cannot receive reply to broadcast");
- stat = RPC_CANTRECV;
- goto done_broad;
- }
- if (inlen < sizeof(u_long))
- goto recv_again;
- /*
- * see if reply transaction id matches sent id.
- * If so, decode the results.
- */
- xdrmem_create(xdrs, inbuf, (u_int)inlen, XDR_DECODE);
- if (xdr_replymsg(xdrs, &msg)) {
- if ((msg.rm_xid == xid) &&
- (msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
- (msg.acpted_rply.ar_stat == SUCCESS)) {
- raddr.sin_port = htons((u_short)port);
- done = (*eachresult)(resultsp, &raddr);
- }
- /* otherwise, we just ignore the errors ... */
- } else {
-#ifdef notdef
- /* some kind of deserialization problem ... */
- if (msg.rm_xid == xid)
- fprintf(stderr, "Broadcast deserialization problem");
- /* otherwise, just random garbage */
-#endif
- }
- xdrs->x_op = XDR_FREE;
- msg.acpted_rply.ar_results.proc = xdr_void;
- (void)xdr_replymsg(xdrs, &msg);
- (void)(*xresults)(xdrs, resultsp);
- xdr_destroy(xdrs);
- if (done) {
- stat = RPC_SUCCESS;
- goto done_broad;
- } else {
- goto recv_again;
- }
- }
-done_broad:
- (void)close(sock);
- AUTH_DESTROY(unix_auth);
- return (stat);
-}
-
diff --git a/lib/librpc/rpc/pmap_rmt.h b/lib/librpc/rpc/pmap_rmt.h
deleted file mode 100644
index ee68ceb..0000000
--- a/lib/librpc/rpc/pmap_rmt.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Structures and XDR routines for parameters to and replies from
- * the portmapper remote-call-service.
- *
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-struct rmtcallargs {
- u_long prog, vers, proc, arglen;
- caddr_t args_ptr;
- xdrproc_t xdr_args;
-};
-
-bool_t xdr_rmtcall_args();
-
-struct rmtcallres {
- u_long *port_ptr;
- u_long resultslen;
- caddr_t results_ptr;
- xdrproc_t xdr_results;
-};
-
-bool_t xdr_rmtcallres();
diff --git a/lib/librpc/rpc/rpc.h b/lib/librpc/rpc/rpc.h
deleted file mode 100644
index e46e1ff..0000000
--- a/lib/librpc/rpc/rpc.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC; from 1.9 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * rpc.h, Just includes the billions of rpc header files necessary to
- * do remote procedure calling.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-#ifndef __RPC_HEADER__
-#define __RPC_HEADER__
-
-#include <rpc/types.h> /* some typedefs */
-#include <netinet/in.h>
-
-/* external data representation interfaces */
-#include <rpc/xdr.h> /* generic (de)serializer */
-
-/* Client side only authentication */
-#include <rpc/auth.h> /* generic authenticator (client side) */
-
-/* Client side (mostly) remote procedure call */
-#include <rpc/clnt.h> /* generic rpc stuff */
-
-/* semi-private protocol headers */
-#include <rpc/rpc_msg.h> /* protocol for rpc messages */
-#include <rpc/auth_unix.h> /* protocol for unix style cred */
-/*
- * Uncomment-out the next line if you are building the rpc library with
- * DES Authentication (see the README file in the secure_rpc/ directory).
- */
-/*#include <rpc/auth_des.h> * protocol for des style cred */
-
-/* Server side only remote procedure callee */
-#include <rpc/svc.h> /* service manager and multiplexer */
-#include <rpc/svc_auth.h> /* service side authenticator */
-
-/*
- * COMMENT OUT THE NEXT INCLUDE (or add to the #ifndef) IF RUNNING ON
- * A VERSION OF UNIX THAT USES SUN'S NFS SOURCE. These systems will
- * already have the structures defined by <rpc/netdb.h> included in <netdb.h>.
- */
-/* routines for parsing /etc/rpc */
-
-struct rpcent {
- char *r_name; /* name of server for this rpc program */
- char **r_aliases; /* alias list */
- int r_number; /* rpc program number */
-};
-
-struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent();
-
-#endif /* ndef __RPC_HEADER__ */
diff --git a/lib/librpc/rpc/rpc_callmsg.c b/lib/librpc/rpc/rpc_callmsg.c
deleted file mode 100644
index d9d815a..0000000
--- a/lib/librpc/rpc/rpc_callmsg.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * rpc_callmsg.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- */
-
-#include <sys/param.h>
-
-#include <rpc/rpc.h>
-
-/*
- * XDR a call message
- */
-bool_t
-xdr_callmsg(xdrs, cmsg)
- register XDR *xdrs;
- register struct rpc_msg *cmsg;
-{
- register long *buf;
- register struct opaque_auth *oa;
-
- if (xdrs->x_op == XDR_ENCODE) {
- if (cmsg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT
- + RNDUP(cmsg->rm_call.cb_cred.oa_length)
- + 2 * BYTES_PER_XDR_UNIT
- + RNDUP(cmsg->rm_call.cb_verf.oa_length));
- if (buf != NULL) {
- IXDR_PUT_LONG(buf, cmsg->rm_xid);
- IXDR_PUT_ENUM(buf, cmsg->rm_direction);
- if (cmsg->rm_direction != CALL) {
- return (FALSE);
- }
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_rpcvers);
- if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
- return (FALSE);
- }
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_prog);
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_vers);
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_proc);
- oa = &cmsg->rm_call.cb_cred;
- IXDR_PUT_ENUM(buf, oa->oa_flavor);
- IXDR_PUT_LONG(buf, oa->oa_length);
- if (oa->oa_length) {
- bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
- buf += RNDUP(oa->oa_length) / sizeof (long);
- }
- oa = &cmsg->rm_call.cb_verf;
- IXDR_PUT_ENUM(buf, oa->oa_flavor);
- IXDR_PUT_LONG(buf, oa->oa_length);
- if (oa->oa_length) {
- bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
- /* no real need....
- buf += RNDUP(oa->oa_length) / sizeof (long);
- */
- }
- return (TRUE);
- }
- }
- if (xdrs->x_op == XDR_DECODE) {
- buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT);
- if (buf != NULL) {
- cmsg->rm_xid = IXDR_GET_LONG(buf);
- cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type);
- if (cmsg->rm_direction != CALL) {
- return (FALSE);
- }
- cmsg->rm_call.cb_rpcvers = IXDR_GET_LONG(buf);
- if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
- return (FALSE);
- }
- cmsg->rm_call.cb_prog = IXDR_GET_LONG(buf);
- cmsg->rm_call.cb_vers = IXDR_GET_LONG(buf);
- cmsg->rm_call.cb_proc = IXDR_GET_LONG(buf);
- oa = &cmsg->rm_call.cb_cred;
- oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
- oa->oa_length = IXDR_GET_LONG(buf);
- if (oa->oa_length) {
- if (oa->oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- if (oa->oa_base == NULL) {
- oa->oa_base = (caddr_t)
- mem_alloc(oa->oa_length);
- }
- buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
- if (buf == NULL) {
- if (xdr_opaque(xdrs, oa->oa_base,
- oa->oa_length) == FALSE) {
- return (FALSE);
- }
- } else {
- bcopy((caddr_t)buf, oa->oa_base,
- oa->oa_length);
- /* no real need....
- buf += RNDUP(oa->oa_length) /
- sizeof (long);
- */
- }
- }
- oa = &cmsg->rm_call.cb_verf;
- buf = XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT);
- if (buf == NULL) {
- if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE ||
- xdr_u_int(xdrs, &oa->oa_length) == FALSE) {
- return (FALSE);
- }
- } else {
- oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
- oa->oa_length = IXDR_GET_LONG(buf);
- }
- if (oa->oa_length) {
- if (oa->oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- if (oa->oa_base == NULL) {
- oa->oa_base = (caddr_t)
- mem_alloc(oa->oa_length);
- }
- buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
- if (buf == NULL) {
- if (xdr_opaque(xdrs, oa->oa_base,
- oa->oa_length) == FALSE) {
- return (FALSE);
- }
- } else {
- bcopy((caddr_t)buf, oa->oa_base,
- oa->oa_length);
- /* no real need...
- buf += RNDUP(oa->oa_length) /
- sizeof (long);
- */
- }
- }
- return (TRUE);
- }
- }
- if (
- xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
- xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
- (cmsg->rm_direction == CALL) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
- (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) &&
- xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
- return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
- return (FALSE);
-}
-
diff --git a/lib/librpc/rpc/rpc_commondata.c b/lib/librpc/rpc/rpc_commondata.c
deleted file mode 100644
index 75cead0..0000000
--- a/lib/librpc/rpc/rpc_commondata.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* @(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#include <rpc/rpc.h>
-/*
- * This file should only contain common data (global data) that is exported
- * by public interfaces
- */
-struct opaque_auth _null_auth;
-#ifdef FD_SETSIZE
-fd_set svc_fdset;
-#else
-int svc_fds;
-#endif /* def FD_SETSIZE */
-struct rpc_createerr rpc_createerr;
diff --git a/lib/librpc/rpc/rpc_dtablesize.c b/lib/librpc/rpc/rpc_dtablesize.c
deleted file mode 100644
index a848817..0000000
--- a/lib/librpc/rpc/rpc_dtablesize.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* @(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro";
-#endif
-
-/*
- * Cache the result of getdtablesize(), so we don't have to do an
- * expensive system call every time.
- */
-_rpc_dtablesize()
-{
- static int size;
-
- if (size == 0) {
- size = getdtablesize();
- }
- return (size);
-}
diff --git a/lib/librpc/rpc/rpc_msg.h b/lib/librpc/rpc/rpc_msg.h
deleted file mode 100644
index b78872b..0000000
--- a/lib/librpc/rpc/rpc_msg.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)rpc_msg.h 1.7 86/07/16 SMI */
-
-/*
- * rpc_msg.h
- * rpc message definition
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#define RPC_MSG_VERSION ((u_long) 2)
-#define RPC_SERVICE_PORT ((u_short) 2048)
-
-/*
- * Bottom up definition of an rpc message.
- * NOTE: call and reply use the same overall stuct but
- * different parts of unions within it.
- */
-
-enum msg_type {
- CALL=0,
- REPLY=1
-};
-
-enum reply_stat {
- MSG_ACCEPTED=0,
- MSG_DENIED=1
-};
-
-enum accept_stat {
- SUCCESS=0,
- PROG_UNAVAIL=1,
- PROG_MISMATCH=2,
- PROC_UNAVAIL=3,
- GARBAGE_ARGS=4,
- SYSTEM_ERR=5
-};
-
-enum reject_stat {
- RPC_MISMATCH=0,
- AUTH_ERROR=1
-};
-
-/*
- * Reply part of an rpc exchange
- */
-
-/*
- * Reply to an rpc request that was accepted by the server.
- * Note: there could be an error even though the request was
- * accepted.
- */
-struct accepted_reply {
- struct opaque_auth ar_verf;
- enum accept_stat ar_stat;
- union {
- struct {
- u_long low;
- u_long high;
- } AR_versions;
- struct {
- caddr_t where;
- xdrproc_t proc;
- } AR_results;
- /* and many other null cases */
- } ru;
-#define ar_results ru.AR_results
-#define ar_vers ru.AR_versions
-};
-
-/*
- * Reply to an rpc request that was rejected by the server.
- */
-struct rejected_reply {
- enum reject_stat rj_stat;
- union {
- struct {
- u_long low;
- u_long high;
- } RJ_versions;
- enum auth_stat RJ_why; /* why authentication did not work */
- } ru;
-#define rj_vers ru.RJ_versions
-#define rj_why ru.RJ_why
-};
-
-/*
- * Body of a reply to an rpc request.
- */
-struct reply_body {
- enum reply_stat rp_stat;
- union {
- struct accepted_reply RP_ar;
- struct rejected_reply RP_dr;
- } ru;
-#define rp_acpt ru.RP_ar
-#define rp_rjct ru.RP_dr
-};
-
-/*
- * Body of an rpc request call.
- */
-struct call_body {
- u_long cb_rpcvers; /* must be equal to two */
- u_long cb_prog;
- u_long cb_vers;
- u_long cb_proc;
- struct opaque_auth cb_cred;
- struct opaque_auth cb_verf; /* protocol specific - provided by client */
-};
-
-/*
- * The rpc message
- */
-struct rpc_msg {
- u_long rm_xid;
- enum msg_type rm_direction;
- union {
- struct call_body RM_cmb;
- struct reply_body RM_rmb;
- } ru;
-#define rm_call ru.RM_cmb
-#define rm_reply ru.RM_rmb
-};
-#define acpted_rply ru.RM_rmb.ru.RP_ar
-#define rjcted_rply ru.RM_rmb.ru.RP_dr
-
-
-/*
- * XDR routine to handle a rpc message.
- * xdr_callmsg(xdrs, cmsg)
- * XDR *xdrs;
- * struct rpc_msg *cmsg;
- */
-extern bool_t xdr_callmsg();
-
-/*
- * XDR routine to pre-serialize the static part of a rpc message.
- * xdr_callhdr(xdrs, cmsg)
- * XDR *xdrs;
- * struct rpc_msg *cmsg;
- */
-extern bool_t xdr_callhdr();
-
-/*
- * XDR routine to handle a rpc reply.
- * xdr_replymsg(xdrs, rmsg)
- * XDR *xdrs;
- * struct rpc_msg *rmsg;
- */
-extern bool_t xdr_replymsg();
-
-/*
- * Fills in the error part of a reply message.
- * _seterr_reply(msg, error)
- * struct rpc_msg *msg;
- * struct rpc_err *error;
- */
-extern void _seterr_reply();
diff --git a/lib/librpc/rpc/rpc_prot.c b/lib/librpc/rpc/rpc_prot.c
deleted file mode 100644
index 4b1319a..0000000
--- a/lib/librpc/rpc/rpc_prot.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/* @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * rpc_prot.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * This set of routines implements the rpc message definition,
- * its serializer and some common rpc utility routines.
- * The routines are meant for various implementations of rpc -
- * they are NOT for the rpc client or rpc service implementations!
- * Because authentication stuff is easy and is part of rpc, the opaque
- * routines are also in this program.
- */
-
-#include <sys/param.h>
-
-#include <rpc/rpc.h>
-
-/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
-
-struct opaque_auth _null_auth;
-
-/*
- * XDR an opaque authentication struct
- * (see auth.h)
- */
-bool_t
-xdr_opaque_auth(xdrs, ap)
- register XDR *xdrs;
- register struct opaque_auth *ap;
-{
-
- if (xdr_enum(xdrs, &(ap->oa_flavor)))
- return (xdr_bytes(xdrs, &ap->oa_base,
- &ap->oa_length, MAX_AUTH_BYTES));
- return (FALSE);
-}
-
-/*
- * XDR a DES block
- */
-bool_t
-xdr_des_block(xdrs, blkp)
- register XDR *xdrs;
- register des_block *blkp;
-{
- return (xdr_opaque(xdrs, (caddr_t)blkp, sizeof(des_block)));
-}
-
-/* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */
-
-/*
- * XDR the MSG_ACCEPTED part of a reply message union
- */
-bool_t
-xdr_accepted_reply(xdrs, ar)
- register XDR *xdrs;
- register struct accepted_reply *ar;
-{
-
- /* personalized union, rather than calling xdr_union */
- if (! xdr_opaque_auth(xdrs, &(ar->ar_verf)))
- return (FALSE);
- if (! xdr_enum(xdrs, (enum_t *)&(ar->ar_stat)))
- return (FALSE);
- switch (ar->ar_stat) {
-
- case SUCCESS:
- return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
-
- case PROG_MISMATCH:
- if (! xdr_u_long(xdrs, &(ar->ar_vers.low)))
- return (FALSE);
- return (xdr_u_long(xdrs, &(ar->ar_vers.high)));
- }
- return (TRUE); /* TRUE => open ended set of problems */
-}
-
-/*
- * XDR the MSG_DENIED part of a reply message union
- */
-bool_t
-xdr_rejected_reply(xdrs, rr)
- register XDR *xdrs;
- register struct rejected_reply *rr;
-{
-
- /* personalized union, rather than calling xdr_union */
- if (! xdr_enum(xdrs, (enum_t *)&(rr->rj_stat)))
- return (FALSE);
- switch (rr->rj_stat) {
-
- case RPC_MISMATCH:
- if (! xdr_u_long(xdrs, &(rr->rj_vers.low)))
- return (FALSE);
- return (xdr_u_long(xdrs, &(rr->rj_vers.high)));
-
- case AUTH_ERROR:
- return (xdr_enum(xdrs, (enum_t *)&(rr->rj_why)));
- }
- return (FALSE);
-}
-
-static struct xdr_discrim reply_dscrm[3] = {
- { (int)MSG_ACCEPTED, xdr_accepted_reply },
- { (int)MSG_DENIED, xdr_rejected_reply },
- { __dontcare__, NULL_xdrproc_t } };
-
-/*
- * XDR a reply message
- */
-bool_t
-xdr_replymsg(xdrs, rmsg)
- register XDR *xdrs;
- register struct rpc_msg *rmsg;
-{
- if (
- xdr_u_long(xdrs, &(rmsg->rm_xid)) &&
- xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) &&
- (rmsg->rm_direction == REPLY) )
- return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat),
- (caddr_t)&(rmsg->rm_reply.ru), reply_dscrm, NULL_xdrproc_t));
- return (FALSE);
-}
-
-
-/*
- * Serializes the "static part" of a call message header.
- * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers.
- * The rm_xid is not really static, but the user can easily munge on the fly.
- */
-bool_t
-xdr_callhdr(xdrs, cmsg)
- register XDR *xdrs;
- register struct rpc_msg *cmsg;
-{
-
- cmsg->rm_direction = CALL;
- cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION;
- if (
- (xdrs->x_op == XDR_ENCODE) &&
- xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
- xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) )
- return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)));
- return (FALSE);
-}
-
-/* ************************** Client utility routine ************* */
-
-static void
-accepted(acpt_stat, error)
- register enum accept_stat acpt_stat;
- register struct rpc_err *error;
-{
-
- switch (acpt_stat) {
-
- case PROG_UNAVAIL:
- error->re_status = RPC_PROGUNAVAIL;
- return;
-
- case PROG_MISMATCH:
- error->re_status = RPC_PROGVERSMISMATCH;
- return;
-
- case PROC_UNAVAIL:
- error->re_status = RPC_PROCUNAVAIL;
- return;
-
- case GARBAGE_ARGS:
- error->re_status = RPC_CANTDECODEARGS;
- return;
-
- case SYSTEM_ERR:
- error->re_status = RPC_SYSTEMERROR;
- return;
-
- case SUCCESS:
- error->re_status = RPC_SUCCESS;
- return;
- }
- /* something's wrong, but we don't know what ... */
- error->re_status = RPC_FAILED;
- error->re_lb.s1 = (long)MSG_ACCEPTED;
- error->re_lb.s2 = (long)acpt_stat;
-}
-
-static void
-rejected(rjct_stat, error)
- register enum reject_stat rjct_stat;
- register struct rpc_err *error;
-{
-
- switch (rjct_stat) {
-
- case RPC_VERSMISMATCH:
- error->re_status = RPC_VERSMISMATCH;
- return;
-
- case AUTH_ERROR:
- error->re_status = RPC_AUTHERROR;
- return;
- }
- /* something's wrong, but we don't know what ... */
- error->re_status = RPC_FAILED;
- error->re_lb.s1 = (long)MSG_DENIED;
- error->re_lb.s2 = (long)rjct_stat;
-}
-
-/*
- * given a reply message, fills in the error
- */
-void
-_seterr_reply(msg, error)
- register struct rpc_msg *msg;
- register struct rpc_err *error;
-{
-
- /* optimized for normal, SUCCESSful case */
- switch (msg->rm_reply.rp_stat) {
-
- case MSG_ACCEPTED:
- if (msg->acpted_rply.ar_stat == SUCCESS) {
- error->re_status = RPC_SUCCESS;
- return;
- };
- accepted(msg->acpted_rply.ar_stat, error);
- break;
-
- case MSG_DENIED:
- rejected(msg->rjcted_rply.rj_stat, error);
- break;
-
- default:
- error->re_status = RPC_FAILED;
- error->re_lb.s1 = (long)(msg->rm_reply.rp_stat);
- break;
- }
- switch (error->re_status) {
-
- case RPC_VERSMISMATCH:
- error->re_vers.low = msg->rjcted_rply.rj_vers.low;
- error->re_vers.high = msg->rjcted_rply.rj_vers.high;
- break;
-
- case RPC_AUTHERROR:
- error->re_why = msg->rjcted_rply.rj_why;
- break;
-
- case RPC_PROGVERSMISMATCH:
- error->re_vers.low = msg->acpted_rply.ar_vers.low;
- error->re_vers.high = msg->acpted_rply.ar_vers.high;
- break;
- }
-}
diff --git a/lib/librpc/rpc/svc.c b/lib/librpc/rpc/svc.c
deleted file mode 100644
index 3327ee5..0000000
--- a/lib/librpc/rpc/svc.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/* @(#)svc.c 2.4 88/08/11 4.0 RPCSRC; from 1.44 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc.c, Server-side remote procedure call interface.
- *
- * There are two sets of procedures here. The xprt routines are
- * for handling transport handles. The svc routines handle the
- * list of service routines.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <sys/errno.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_clnt.h>
-
-extern int errno;
-
-#ifdef FD_SETSIZE
-static SVCXPRT **xports;
-#else
-#define NOFILE 32
-
-static SVCXPRT *xports[NOFILE];
-#endif /* def FD_SETSIZE */
-
-#define NULL_SVC ((struct svc_callout *)0)
-#define RQCRED_SIZE 400 /* this size is excessive */
-
-/*
- * The services list
- * Each entry represents a set of procedures (an rpc program).
- * The dispatch routine takes request structs and runs the
- * apropriate procedure.
- */
-static struct svc_callout {
- struct svc_callout *sc_next;
- u_long sc_prog;
- u_long sc_vers;
- void (*sc_dispatch)();
-} *svc_head;
-
-static struct svc_callout *svc_find();
-
-/* *************** SVCXPRT related stuff **************** */
-
-/*
- * Activate a transport handle.
- */
-void
-xprt_register(xprt)
- SVCXPRT *xprt;
-{
- register int sock = xprt->xp_sock;
-
-#ifdef FD_SETSIZE
- if (xports == NULL) {
- xports = (SVCXPRT **)
- mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
- }
- if (sock < _rpc_dtablesize()) {
- xports[sock] = xprt;
- FD_SET(sock, &svc_fdset);
- }
-#else
- if (sock < NOFILE) {
- xports[sock] = xprt;
- svc_fds |= (1 << sock);
- }
-#endif /* def FD_SETSIZE */
-
-}
-
-/*
- * De-activate a transport handle.
- */
-void
-xprt_unregister(xprt)
- SVCXPRT *xprt;
-{
- register int sock = xprt->xp_sock;
-
-#ifdef FD_SETSIZE
- if ((sock < _rpc_dtablesize()) && (xports[sock] == xprt)) {
- xports[sock] = (SVCXPRT *)0;
- FD_CLR(sock, &svc_fdset);
- }
-#else
- if ((sock < NOFILE) && (xports[sock] == xprt)) {
- xports[sock] = (SVCXPRT *)0;
- svc_fds &= ~(1 << sock);
- }
-#endif /* def FD_SETSIZE */
-}
-
-
-/* ********************** CALLOUT list related stuff ************* */
-
-/*
- * Add a service program to the callout list.
- * The dispatch routine will be called when a rpc request for this
- * program number comes in.
- */
-bool_t
-svc_register(xprt, prog, vers, dispatch, protocol)
- SVCXPRT *xprt;
- u_long prog;
- u_long vers;
- void (*dispatch)();
- int protocol;
-{
- struct svc_callout *prev;
- register struct svc_callout *s;
-
- if ((s = svc_find(prog, vers, &prev)) != NULL_SVC) {
- if (s->sc_dispatch == dispatch)
- goto pmap_it; /* he is registering another xptr */
- return (FALSE);
- }
- s = (struct svc_callout *)mem_alloc(sizeof(struct svc_callout));
- if (s == (struct svc_callout *)0) {
- return (FALSE);
- }
- s->sc_prog = prog;
- s->sc_vers = vers;
- s->sc_dispatch = dispatch;
- s->sc_next = svc_head;
- svc_head = s;
-pmap_it:
- /* now register the information with the local binder service */
- if (protocol) {
- return (pmap_set(prog, vers, protocol, xprt->xp_port));
- }
- return (TRUE);
-}
-
-/*
- * Remove a service program from the callout list.
- */
-void
-svc_unregister(prog, vers)
- u_long prog;
- u_long vers;
-{
- struct svc_callout *prev;
- register struct svc_callout *s;
-
- if ((s = svc_find(prog, vers, &prev)) == NULL_SVC)
- return;
- if (prev == NULL_SVC) {
- svc_head = s->sc_next;
- } else {
- prev->sc_next = s->sc_next;
- }
- s->sc_next = NULL_SVC;
- mem_free((char *) s, (u_int) sizeof(struct svc_callout));
- /* now unregister the information with the local binder service */
- (void)pmap_unset(prog, vers);
-}
-
-/*
- * Search the callout list for a program number, return the callout
- * struct.
- */
-static struct svc_callout *
-svc_find(prog, vers, prev)
- u_long prog;
- u_long vers;
- struct svc_callout **prev;
-{
- register struct svc_callout *s, *p;
-
- p = NULL_SVC;
- for (s = svc_head; s != NULL_SVC; s = s->sc_next) {
- if ((s->sc_prog == prog) && (s->sc_vers == vers))
- goto done;
- p = s;
- }
-done:
- *prev = p;
- return (s);
-}
-
-/* ******************* REPLY GENERATION ROUTINES ************ */
-
-/*
- * Send a reply to an rpc request
- */
-bool_t
-svc_sendreply(xprt, xdr_results, xdr_location)
- register SVCXPRT *xprt;
- xdrproc_t xdr_results;
- caddr_t xdr_location;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = SUCCESS;
- rply.acpted_rply.ar_results.where = xdr_location;
- rply.acpted_rply.ar_results.proc = xdr_results;
- return (SVC_REPLY(xprt, &rply));
-}
-
-/*
- * No procedure error reply
- */
-void
-svcerr_noproc(xprt)
- register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = PROC_UNAVAIL;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Can't decode args error reply
- */
-void
-svcerr_decode(xprt)
- register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = GARBAGE_ARGS;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Some system error
- */
-void
-svcerr_systemerr(xprt)
- register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = SYSTEM_ERR;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Authentication error reply
- */
-void
-svcerr_auth(xprt, why)
- SVCXPRT *xprt;
- enum auth_stat why;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_DENIED;
- rply.rjcted_rply.rj_stat = AUTH_ERROR;
- rply.rjcted_rply.rj_why = why;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Auth too weak error reply
- */
-void
-svcerr_weakauth(xprt)
- SVCXPRT *xprt;
-{
-
- svcerr_auth(xprt, AUTH_TOOWEAK);
-}
-
-/*
- * Program unavailable error reply
- */
-void
-svcerr_noprog(xprt)
- register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = PROG_UNAVAIL;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Program version mismatch error reply
- */
-void
-svcerr_progvers(xprt, low_vers, high_vers)
- register SVCXPRT *xprt;
- u_long low_vers;
- u_long high_vers;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = PROG_MISMATCH;
- rply.acpted_rply.ar_vers.low = low_vers;
- rply.acpted_rply.ar_vers.high = high_vers;
- SVC_REPLY(xprt, &rply);
-}
-
-/* ******************* SERVER INPUT STUFF ******************* */
-
-/*
- * Get server side input from some transport.
- *
- * Statement of authentication parameters management:
- * This function owns and manages all authentication parameters, specifically
- * the "raw" parameters (msg.rm_call.cb_cred and msg.rm_call.cb_verf) and
- * the "cooked" credentials (rqst->rq_clntcred).
- * However, this function does not know the structure of the cooked
- * credentials, so it make the following assumptions:
- * a) the structure is contiguous (no pointers), and
- * b) the cred structure size does not exceed RQCRED_SIZE bytes.
- * In all events, all three parameters are freed upon exit from this routine.
- * The storage is trivially management on the call stack in user land, but
- * is mallocated in kernel land.
- */
-
-void
-svc_getreq(rdfds)
- int rdfds;
-{
-#ifdef FD_SETSIZE
- fd_set readfds;
-
- FD_ZERO(&readfds);
- readfds.fds_bits[0] = rdfds;
- svc_getreqset(&readfds);
-#else
- int readfds = rdfds & svc_fds;
-
- svc_getreqset(&readfds);
-#endif /* def FD_SETSIZE */
-}
-
-void
-svc_getreqset(readfds)
-#ifdef FD_SETSIZE
- fd_set *readfds;
-{
-#else
- int *readfds;
-{
- int readfds_local = *readfds;
-#endif /* def FD_SETSIZE */
- enum xprt_stat stat;
- struct rpc_msg msg;
- int prog_found;
- u_long low_vers;
- u_long high_vers;
- struct svc_req r;
- register SVCXPRT *xprt;
- register u_long mask;
- register int bit;
- register u_long *maskp;
- register int setsize;
- register int sock;
- char cred_area[2*MAX_AUTH_BYTES + RQCRED_SIZE];
- msg.rm_call.cb_cred.oa_base = cred_area;
- msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]);
- r.rq_clntcred = &(cred_area[2*MAX_AUTH_BYTES]);
-
-
-#ifdef FD_SETSIZE
- setsize = _rpc_dtablesize();
- maskp = (u_long *)readfds->fds_bits;
- for (sock = 0; sock < setsize; sock += NFDBITS) {
- for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) {
- /* sock has input waiting */
- xprt = xports[sock + bit - 1];
-#else
- for (sock = 0; readfds_local != 0; sock++, readfds_local >>= 1) {
- if ((readfds_local & 1) != 0) {
- /* sock has input waiting */
- xprt = xports[sock];
-#endif /* def FD_SETSIZE */
- /* now receive msgs from xprtprt (support batch calls) */
- do {
- if (SVC_RECV(xprt, &msg)) {
-
- /* now find the exported program and call it */
- register struct svc_callout *s;
- enum auth_stat why;
-
- r.rq_xprt = xprt;
- r.rq_prog = msg.rm_call.cb_prog;
- r.rq_vers = msg.rm_call.cb_vers;
- r.rq_proc = msg.rm_call.cb_proc;
- r.rq_cred = msg.rm_call.cb_cred;
- /* first authenticate the message */
- if ((why= _authenticate(&r, &msg)) != AUTH_OK) {
- svcerr_auth(xprt, why);
- goto call_done;
- }
- /* now match message with a registered service*/
- prog_found = FALSE;
- low_vers = 0 - 1;
- high_vers = 0;
- for (s = svc_head; s != NULL_SVC; s = s->sc_next) {
- if (s->sc_prog == r.rq_prog) {
- if (s->sc_vers == r.rq_vers) {
- (*s->sc_dispatch)(&r, xprt);
- goto call_done;
- } /* found correct version */
- prog_found = TRUE;
- if (s->sc_vers < low_vers)
- low_vers = s->sc_vers;
- if (s->sc_vers > high_vers)
- high_vers = s->sc_vers;
- } /* found correct program */
- }
- /*
- * if we got here, the program or version
- * is not served ...
- */
- if (prog_found)
- svcerr_progvers(xprt,
- low_vers, high_vers);
- else
- svcerr_noprog(xprt);
- /* Fall through to ... */
- }
- call_done:
- if ((stat = SVC_STAT(xprt)) == XPRT_DIED){
- SVC_DESTROY(xprt);
- break;
- }
- } while (stat == XPRT_MOREREQS);
- }
- }
-}
diff --git a/lib/librpc/rpc/svc.h b/lib/librpc/rpc/svc.h
deleted file mode 100644
index dbae45d..0000000
--- a/lib/librpc/rpc/svc.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * svc.h, Server-side remote procedure call interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef __SVC_HEADER__
-#define __SVC_HEADER__
-
-/*
- * This interface must manage two items concerning remote procedure calling:
- *
- * 1) An arbitrary number of transport connections upon which rpc requests
- * are received. The two most notable transports are TCP and UDP; they are
- * created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
- * they in turn call xprt_register and xprt_unregister.
- *
- * 2) An arbitrary number of locally registered services. Services are
- * described by the following four data: program number, version number,
- * "service dispatch" function, a transport handle, and a boolean that
- * indicates whether or not the exported program should be registered with a
- * local binder service; if true the program's number and version and the
- * port number from the transport handle are registered with the binder.
- * These data are registered with the rpc svc system via svc_register.
- *
- * A service's dispatch function is called whenever an rpc request comes in
- * on a transport. The request's program and version numbers must match
- * those of the registered service. The dispatch function is passed two
- * parameters, struct svc_req * and SVCXPRT *, defined below.
- */
-
-enum xprt_stat {
- XPRT_DIED,
- XPRT_MOREREQS,
- XPRT_IDLE
-};
-
-/*
- * Server side transport handle
- */
-typedef struct {
- int xp_sock;
- u_short xp_port; /* associated port number */
- struct xp_ops {
- bool_t (*xp_recv)(); /* receive incomming requests */
- enum xprt_stat (*xp_stat)(); /* get transport status */
- bool_t (*xp_getargs)(); /* get arguments */
- bool_t (*xp_reply)(); /* send reply */
- bool_t (*xp_freeargs)();/* free mem allocated for args */
- void (*xp_destroy)(); /* destroy this struct */
- } *xp_ops;
- int xp_addrlen; /* length of remote address */
- struct sockaddr_in xp_raddr; /* remote address */
- struct opaque_auth xp_verf; /* raw response verifier */
- caddr_t xp_p1; /* private */
- caddr_t xp_p2; /* private */
-} SVCXPRT;
-
-/*
- * Approved way of getting address of caller
- */
-#define svc_getcaller(x) (&(x)->xp_raddr)
-
-/*
- * Operations defined on an SVCXPRT handle
- *
- * SVCXPRT *xprt;
- * struct rpc_msg *msg;
- * xdrproc_t xargs;
- * caddr_t argsp;
- */
-#define SVC_RECV(xprt, msg) \
- (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
-#define svc_recv(xprt, msg) \
- (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
-
-#define SVC_STAT(xprt) \
- (*(xprt)->xp_ops->xp_stat)(xprt)
-#define svc_stat(xprt) \
- (*(xprt)->xp_ops->xp_stat)(xprt)
-
-#define SVC_GETARGS(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
-#define svc_getargs(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
-
-#define SVC_REPLY(xprt, msg) \
- (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
-#define svc_reply(xprt, msg) \
- (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
-
-#define SVC_FREEARGS(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
-#define svc_freeargs(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
-
-#define SVC_DESTROY(xprt) \
- (*(xprt)->xp_ops->xp_destroy)(xprt)
-#define svc_destroy(xprt) \
- (*(xprt)->xp_ops->xp_destroy)(xprt)
-
-
-/*
- * Service request
- */
-struct svc_req {
- u_long rq_prog; /* service program number */
- u_long rq_vers; /* service protocol version */
- u_long rq_proc; /* the desired procedure */
- struct opaque_auth rq_cred; /* raw creds from the wire */
- caddr_t rq_clntcred; /* read only cooked cred */
- SVCXPRT *rq_xprt; /* associated transport */
-};
-
-
-/*
- * Service registration
- *
- * svc_register(xprt, prog, vers, dispatch, protocol)
- * SVCXPRT *xprt;
- * u_long prog;
- * u_long vers;
- * void (*dispatch)();
- * int protocol; (like TCP or UDP, zero means do not register)
- */
-extern bool_t svc_register();
-
-/*
- * Service un-registration
- *
- * svc_unregister(prog, vers)
- * u_long prog;
- * u_long vers;
- */
-extern void svc_unregister();
-
-/*
- * Transport registration.
- *
- * xprt_register(xprt)
- * SVCXPRT *xprt;
- */
-extern void xprt_register();
-
-/*
- * Transport un-register
- *
- * xprt_unregister(xprt)
- * SVCXPRT *xprt;
- */
-extern void xprt_unregister();
-
-
-
-
-/*
- * When the service routine is called, it must first check to see if it
- * knows about the procedure; if not, it should call svcerr_noproc
- * and return. If so, it should deserialize its arguments via
- * SVC_GETARGS (defined above). If the deserialization does not work,
- * svcerr_decode should be called followed by a return. Successful
- * decoding of the arguments should be followed the execution of the
- * procedure's code and a call to svc_sendreply.
- *
- * Also, if the service refuses to execute the procedure due to too-
- * weak authentication parameters, svcerr_weakauth should be called.
- * Note: do not confuse access-control failure with weak authentication!
- *
- * NB: In pure implementations of rpc, the caller always waits for a reply
- * msg. This message is sent when svc_sendreply is called.
- * Therefore pure service implementations should always call
- * svc_sendreply even if the function logically returns void; use
- * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
- * for the abuse of pure rpc via batched calling or pipelining. In the
- * case of a batched call, svc_sendreply should NOT be called since
- * this would send a return message, which is what batching tries to avoid.
- * It is the service/protocol writer's responsibility to know which calls are
- * batched and which are not. Warning: responding to batch calls may
- * deadlock the caller and server processes!
- */
-
-extern bool_t svc_sendreply();
-extern void svcerr_decode();
-extern void svcerr_weakauth();
-extern void svcerr_noproc();
-extern void svcerr_progvers();
-extern void svcerr_auth();
-extern void svcerr_noprog();
-extern void svcerr_systemerr();
-
-/*
- * Lowest level dispatching -OR- who owns this process anyway.
- * Somebody has to wait for incoming requests and then call the correct
- * service routine. The routine svc_run does infinite waiting; i.e.,
- * svc_run never returns.
- * Since another (co-existant) package may wish to selectively wait for
- * incoming calls or other events outside of the rpc architecture, the
- * routine svc_getreq is provided. It must be passed readfds, the
- * "in-place" results of a select system call (see select, section 2).
- */
-
-/*
- * Global keeper of rpc service descriptors in use
- * dynamic; must be inspected before each call to select
- */
-#ifdef FD_SETSIZE
-extern fd_set svc_fdset;
-#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
-#else
-extern int svc_fds;
-#endif /* def FD_SETSIZE */
-
-/*
- * a small program implemented by the svc_rpc implementation itself;
- * also see clnt.h for protocol numbers.
- */
-extern void rpctest_service();
-
-extern void svc_getreq();
-extern void svc_getreqset(); /* takes fdset instead of int */
-extern void svc_run(); /* never returns */
-
-/*
- * Socket to use on svcxxx_create call to get default socket
- */
-#define RPC_ANYSOCK -1
-
-/*
- * These are the existing service side transport implementations
- */
-
-/*
- * Memory based rpc for testing and timing.
- */
-extern SVCXPRT *svcraw_create();
-
-/*
- * Udp based rpc.
- */
-extern SVCXPRT *svcudp_create();
-extern SVCXPRT *svcudp_bufcreate();
-
-/*
- * Tcp based rpc.
- */
-extern SVCXPRT *svctcp_create();
-
-
-
-#endif !__SVC_HEADER__
diff --git a/lib/librpc/rpc/svc_auth.c b/lib/librpc/rpc/svc_auth.c
deleted file mode 100644
index ab7ab69..0000000
--- a/lib/librpc/rpc/svc_auth.c
+++ /dev/null
@@ -1,114 +0,0 @@
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC; from 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * svc_auth_nodes.c, Server-side rpc authenticator interface,
- * *WITHOUT* DES authentication.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-
-/*
- * svcauthsw is the bdevsw of server side authentication.
- *
- * Server side authenticators are called from authenticate by
- * using the client auth struct flavor field to index into svcauthsw.
- * The server auth flavors must implement a routine that looks
- * like:
- *
- * enum auth_stat
- * flavorx_auth(rqst, msg)
- * register struct svc_req *rqst;
- * register struct rpc_msg *msg;
- *
- */
-
-enum auth_stat _svcauth_null(); /* no authentication */
-enum auth_stat _svcauth_unix(); /* unix style (uid, gids) */
-enum auth_stat _svcauth_short(); /* short hand unix style */
-
-static struct {
- enum auth_stat (*authenticator)();
-} svcauthsw[] = {
- _svcauth_null, /* AUTH_NULL */
- _svcauth_unix, /* AUTH_UNIX */
- _svcauth_short, /* AUTH_SHORT */
-};
-#define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */
-
-
-/*
- * The call rpc message, msg has been obtained from the wire. The msg contains
- * the raw form of credentials and verifiers. authenticate returns AUTH_OK
- * if the msg is successfully authenticated. If AUTH_OK then the routine also
- * does the following things:
- * set rqst->rq_xprt->verf to the appropriate response verifier;
- * sets rqst->rq_client_cred to the "cooked" form of the credentials.
- *
- * NB: rqst->rq_cxprt->verf must be pre-alloctaed;
- * its length is set appropriately.
- *
- * The caller still owns and is responsible for msg->u.cmb.cred and
- * msg->u.cmb.verf. The authentication system retains ownership of
- * rqst->rq_client_cred, the cooked credentials.
- *
- * There is an assumption that any flavour less than AUTH_NULL is
- * invalid.
- */
-enum auth_stat
-_authenticate(rqst, msg)
- register struct svc_req *rqst;
- struct rpc_msg *msg;
-{
- register int cred_flavor;
-
- rqst->rq_cred = msg->rm_call.cb_cred;
- rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor;
- rqst->rq_xprt->xp_verf.oa_length = 0;
- cred_flavor = rqst->rq_cred.oa_flavor;
- if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) {
- return ((*(svcauthsw[cred_flavor].authenticator))(rqst, msg));
- }
-
- return (AUTH_REJECTEDCRED);
-}
-
-enum auth_stat
-_svcauth_null(/*rqst, msg*/)
- /*struct svc_req *rqst;
- struct rpc_msg *msg;*/
-{
-
- return (AUTH_OK);
-}
diff --git a/lib/librpc/rpc/svc_auth.h b/lib/librpc/rpc/svc_auth.h
deleted file mode 100644
index a36a01a..0000000
--- a/lib/librpc/rpc/svc_auth.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)svc_auth.h 1.6 86/07/16 SMI */
-
-/*
- * svc_auth.h, Service side of rpc authentication.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-
-/*
- * Server side authenticator
- */
-extern enum auth_stat _authenticate();
diff --git a/lib/librpc/rpc/svc_auth_unix.c b/lib/librpc/rpc/svc_auth_unix.c
deleted file mode 100644
index ea00b78..0000000
--- a/lib/librpc/rpc/svc_auth_unix.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* @(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC; from 1.28 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_auth_unix.c
- * Handles UNIX flavor authentication parameters on the service side of rpc.
- * There are two svc auth implementations here: AUTH_UNIX and AUTH_SHORT.
- * _svcauth_unix does full blown unix style uid,gid+gids auth,
- * _svcauth_short uses a shorthand auth to index into a cache of longhand auths.
- * Note: the shorthand has been gutted for efficiency.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-
-/*
- * Unix longhand authenticator
- */
-enum auth_stat
-_svcauth_unix(rqst, msg)
- register struct svc_req *rqst;
- register struct rpc_msg *msg;
-{
- register enum auth_stat stat;
- XDR xdrs;
- register struct authunix_parms *aup;
- register long *buf;
- struct area {
- struct authunix_parms area_aup;
- char area_machname[MAX_MACHINE_NAME+1];
- int area_gids[NGRPS];
- } *area;
- u_int auth_len;
- int str_len, gid_len;
- register int i;
-
- area = (struct area *) rqst->rq_clntcred;
- aup = &area->area_aup;
- aup->aup_machname = area->area_machname;
- aup->aup_gids = area->area_gids;
- auth_len = (u_int)msg->rm_call.cb_cred.oa_length;
- xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len,XDR_DECODE);
- buf = XDR_INLINE(&xdrs, auth_len);
- if (buf != NULL) {
- aup->aup_time = IXDR_GET_LONG(buf);
- str_len = IXDR_GET_U_LONG(buf);
- if (str_len > MAX_MACHINE_NAME) {
- stat = AUTH_BADCRED;
- goto done;
- }
- bcopy((caddr_t)buf, aup->aup_machname, (u_int)str_len);
- aup->aup_machname[str_len] = 0;
- str_len = RNDUP(str_len);
- buf += str_len / sizeof (long);
- aup->aup_uid = IXDR_GET_LONG(buf);
- aup->aup_gid = IXDR_GET_LONG(buf);
- gid_len = IXDR_GET_U_LONG(buf);
- if (gid_len > NGRPS) {
- stat = AUTH_BADCRED;
- goto done;
- }
- aup->aup_len = gid_len;
- for (i = 0; i < gid_len; i++) {
- aup->aup_gids[i] = IXDR_GET_LONG(buf);
- }
- /*
- * five is the smallest unix credentials structure -
- * timestamp, hostname len (0), uid, gid, and gids len (0).
- */
- if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) {
- (void) printf("bad auth_len gid %d str %d auth %d\n",
- gid_len, str_len, auth_len);
- stat = AUTH_BADCRED;
- goto done;
- }
- } else if (! xdr_authunix_parms(&xdrs, aup)) {
- xdrs.x_op = XDR_FREE;
- (void)xdr_authunix_parms(&xdrs, aup);
- stat = AUTH_BADCRED;
- goto done;
- }
- rqst->rq_xprt->xp_verf.oa_flavor = AUTH_NULL;
- rqst->rq_xprt->xp_verf.oa_length = 0;
- stat = AUTH_OK;
-done:
- XDR_DESTROY(&xdrs);
- return (stat);
-}
-
-
-/*
- * Shorthand unix authenticator
- * Looks up longhand in a cache.
- */
-/*ARGSUSED*/
-enum auth_stat
-_svcauth_short(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
-{
- return (AUTH_REJECTEDCRED);
-}
diff --git a/lib/librpc/rpc/svc_raw.c b/lib/librpc/rpc/svc_raw.c
deleted file mode 100644
index 1170ece..0000000
--- a/lib/librpc/rpc/svc_raw.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* @(#)svc_raw.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_raw.c, This a toy for simple testing and timing.
- * Interface to create an rpc client and server in the same UNIX process.
- * This lets us similate rpc and get rpc (round trip) overhead, without
- * any interference from the kernal.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-
-
-/*
- * This is the "network" that we will be moving data over
- */
-static struct svcraw_private {
- char _raw_buf[UDPMSGSIZE];
- SVCXPRT server;
- XDR xdr_stream;
- char verf_body[MAX_AUTH_BYTES];
-} *svcraw_private;
-
-static bool_t svcraw_recv();
-static enum xprt_stat svcraw_stat();
-static bool_t svcraw_getargs();
-static bool_t svcraw_reply();
-static bool_t svcraw_freeargs();
-static void svcraw_destroy();
-
-static struct xp_ops server_ops = {
- svcraw_recv,
- svcraw_stat,
- svcraw_getargs,
- svcraw_reply,
- svcraw_freeargs,
- svcraw_destroy
-};
-
-SVCXPRT *
-svcraw_create()
-{
- register struct svcraw_private *srp = svcraw_private;
-
- if (srp == 0) {
- srp = (struct svcraw_private *)calloc(1, sizeof (*srp));
- if (srp == 0)
- return (0);
- }
- srp->server.xp_sock = 0;
- srp->server.xp_port = 0;
- srp->server.xp_ops = &server_ops;
- srp->server.xp_verf.oa_base = srp->verf_body;
- xdrmem_create(&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE, XDR_FREE);
- return (&srp->server);
-}
-
-static enum xprt_stat
-svcraw_stat()
-{
-
- return (XPRT_IDLE);
-}
-
-static bool_t
-svcraw_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
-{
- register struct svcraw_private *srp = svcraw_private;
- register XDR *xdrs;
-
- if (srp == 0)
- return (0);
- xdrs = &srp->xdr_stream;
- xdrs->x_op = XDR_DECODE;
- XDR_SETPOS(xdrs, 0);
- if (! xdr_callmsg(xdrs, msg))
- return (FALSE);
- return (TRUE);
-}
-
-static bool_t
-svcraw_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
-{
- register struct svcraw_private *srp = svcraw_private;
- register XDR *xdrs;
-
- if (srp == 0)
- return (FALSE);
- xdrs = &srp->xdr_stream;
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, 0);
- if (! xdr_replymsg(xdrs, msg))
- return (FALSE);
- (void)XDR_GETPOS(xdrs); /* called just for overhead */
- return (TRUE);
-}
-
-static bool_t
-svcraw_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
-{
- register struct svcraw_private *srp = svcraw_private;
-
- if (srp == 0)
- return (FALSE);
- return ((*xdr_args)(&srp->xdr_stream, args_ptr));
-}
-
-static bool_t
-svcraw_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
-{
- register struct svcraw_private *srp = svcraw_private;
- register XDR *xdrs;
-
- if (srp == 0)
- return (FALSE);
- xdrs = &srp->xdr_stream;
- xdrs->x_op = XDR_FREE;
- return ((*xdr_args)(xdrs, args_ptr));
-}
-
-static void
-svcraw_destroy()
-{
-}
diff --git a/lib/librpc/rpc/svc_run.c b/lib/librpc/rpc/svc_run.c
deleted file mode 100644
index c1c3e04..0000000
--- a/lib/librpc/rpc/svc_run.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * This is the rpc server side idle loop
- * Wait for input, call server program.
- */
-#include <rpc/rpc.h>
-#include <sys/errno.h>
-
-void
-svc_run()
-{
-#ifdef FD_SETSIZE
- fd_set readfds;
-#else
- int readfds;
-#endif /* def FD_SETSIZE */
- extern int errno;
-
- for (;;) {
-#ifdef FD_SETSIZE
- readfds = svc_fdset;
-#else
- readfds = svc_fds;
-#endif /* def FD_SETSIZE */
- switch (select(_rpc_dtablesize(), &readfds, (int *)0, (int *)0,
- (struct timeval *)0)) {
- case -1:
- if (errno == EINTR) {
- continue;
- }
- perror("svc_run: - select failed");
- return;
- case 0:
- continue;
- default:
- svc_getreqset(&readfds);
- }
- }
-}
diff --git a/lib/librpc/rpc/svc_simple.c b/lib/librpc/rpc/svc_simple.c
deleted file mode 100644
index d6bcbd3..0000000
--- a/lib/librpc/rpc/svc_simple.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* @(#)svc_simple.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_simple.c
- * Simplified front end to rpc.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
-static struct proglst {
- char *(*p_progname)();
- int p_prognum;
- int p_procnum;
- xdrproc_t p_inproc, p_outproc;
- struct proglst *p_nxt;
-} *proglst;
-static void universal();
-static SVCXPRT *transp;
-struct proglst *pl;
-
-registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
- char *(*progname)();
- xdrproc_t inproc, outproc;
-{
-
- if (procnum == NULLPROC) {
- (void) fprintf(stderr,
- "can't reassign procedure number %d\n", NULLPROC);
- return (-1);
- }
- if (transp == 0) {
- transp = svcudp_create(RPC_ANYSOCK);
- if (transp == NULL) {
- (void) fprintf(stderr, "couldn't create an rpc server\n");
- return (-1);
- }
- }
- (void) pmap_unset((u_long)prognum, (u_long)versnum);
- if (!svc_register(transp, (u_long)prognum, (u_long)versnum,
- universal, IPPROTO_UDP)) {
- (void) fprintf(stderr, "couldn't register prog %d vers %d\n",
- prognum, versnum);
- return (-1);
- }
- pl = (struct proglst *)malloc(sizeof(struct proglst));
- if (pl == NULL) {
- (void) fprintf(stderr, "registerrpc: out of memory\n");
- return (-1);
- }
- pl->p_progname = progname;
- pl->p_prognum = prognum;
- pl->p_procnum = procnum;
- pl->p_inproc = inproc;
- pl->p_outproc = outproc;
- pl->p_nxt = proglst;
- proglst = pl;
- return (0);
-}
-
-static void
-universal(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- int prog, proc;
- char *outdata;
- char xdrbuf[UDPMSGSIZE];
- struct proglst *pl;
-
- /*
- * enforce "procnum 0 is echo" convention
- */
- if (rqstp->rq_proc == NULLPROC) {
- if (svc_sendreply(transp, xdr_void, (char *)NULL) == FALSE) {
- (void) fprintf(stderr, "xxx\n");
- exit(1);
- }
- return;
- }
- prog = rqstp->rq_prog;
- proc = rqstp->rq_proc;
- for (pl = proglst; pl != NULL; pl = pl->p_nxt)
- if (pl->p_prognum == prog && pl->p_procnum == proc) {
- /* decode arguments into a CLEAN buffer */
- bzero(xdrbuf, sizeof(xdrbuf)); /* required ! */
- if (!svc_getargs(transp, pl->p_inproc, xdrbuf)) {
- svcerr_decode(transp);
- return;
- }
- outdata = (*(pl->p_progname))(xdrbuf);
- if (outdata == NULL && pl->p_outproc != xdr_void)
- /* there was an error */
- return;
- if (!svc_sendreply(transp, pl->p_outproc, outdata)) {
- (void) fprintf(stderr,
- "trouble replying to prog %d\n",
- pl->p_prognum);
- exit(1);
- }
- /* free the decoded arguments */
- (void)svc_freeargs(transp, pl->p_inproc, xdrbuf);
- return;
- }
- (void) fprintf(stderr, "never registered prog %d\n", prog);
- exit(1);
-}
-
diff --git a/lib/librpc/rpc/svc_tcp.c b/lib/librpc/rpc/svc_tcp.c
deleted file mode 100644
index efa21dc..0000000
--- a/lib/librpc/rpc/svc_tcp.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/* @(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_tcp.c, Server side for TCP/IP based RPC.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * Actually implements two flavors of transporter -
- * a tcp rendezvouser (a listner and connection establisher)
- * and a record/tcp stream.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <errno.h>
-extern errno;
-
-/*
- * Ops vector for TCP/IP based rpc service handle
- */
-static bool_t svctcp_recv();
-static enum xprt_stat svctcp_stat();
-static bool_t svctcp_getargs();
-static bool_t svctcp_reply();
-static bool_t svctcp_freeargs();
-static void svctcp_destroy();
-
-static struct xp_ops svctcp_op = {
- svctcp_recv,
- svctcp_stat,
- svctcp_getargs,
- svctcp_reply,
- svctcp_freeargs,
- svctcp_destroy
-};
-
-/*
- * Ops vector for TCP/IP rendezvous handler
- */
-static bool_t rendezvous_request();
-static enum xprt_stat rendezvous_stat();
-
-static struct xp_ops svctcp_rendezvous_op = {
- rendezvous_request,
- rendezvous_stat,
- (bool_t (*)())abort,
- (bool_t (*)())abort,
- (bool_t (*)())abort,
- svctcp_destroy
-};
-
-static int readtcp(), writetcp();
-static SVCXPRT *makefd_xprt();
-
-struct tcp_rendezvous { /* kept in xprt->xp_p1 */
- u_int sendsize;
- u_int recvsize;
-};
-
-struct tcp_conn { /* kept in xprt->xp_p1 */
- enum xprt_stat strm_stat;
- u_long x_id;
- XDR xdrs;
- char verf_body[MAX_AUTH_BYTES];
-};
-
-/*
- * Usage:
- * xprt = svctcp_create(sock, send_buf_size, recv_buf_size);
- *
- * Creates, registers, and returns a (rpc) tcp based transporter.
- * Once *xprt is initialized, it is registered as a transporter
- * see (svc.h, xprt_register). This routine returns
- * a NULL if a problem occurred.
- *
- * If sock<0 then a socket is created, else sock is used.
- * If the socket, sock is not bound to a port then svctcp_create
- * binds it to an arbitrary port. The routine then starts a tcp
- * listener on the socket's associated port. In any (successful) case,
- * xprt->xp_sock is the registered socket number and xprt->xp_port is the
- * associated port number.
- *
- * Since tcp streams do buffered io similar to stdio, the caller can specify
- * how big the send and receive buffers are via the second and third parms;
- * 0 => use the system default.
- */
-SVCXPRT *
-svctcp_create(sock, sendsize, recvsize)
- register int sock;
- u_int sendsize;
- u_int recvsize;
-{
- bool_t madesock = FALSE;
- register SVCXPRT *xprt;
- register struct tcp_rendezvous *r;
- struct sockaddr_in addr;
- int len = sizeof(struct sockaddr_in);
-
- if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- perror("svctcp_.c - udp socket creation problem");
- return ((SVCXPRT *)NULL);
- }
- madesock = TRUE;
- }
- bzero((char *)&addr, sizeof (addr));
- addr.sin_family = AF_INET;
- if (bindresvport(sock, &addr)) {
- addr.sin_port = 0;
- (void)bind(sock, (struct sockaddr *)&addr, len);
- }
- if ((getsockname(sock, (struct sockaddr *)&addr, &len) != 0) ||
- (listen(sock, 2) != 0)) {
- perror("svctcp_.c - cannot getsockname or listen");
- if (madesock)
- (void)close(sock);
- return ((SVCXPRT *)NULL);
- }
- r = (struct tcp_rendezvous *)mem_alloc(sizeof(*r));
- if (r == NULL) {
- (void) fprintf(stderr, "svctcp_create: out of memory\n");
- return (NULL);
- }
- r->sendsize = sendsize;
- r->recvsize = recvsize;
- xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- (void) fprintf(stderr, "svctcp_create: out of memory\n");
- return (NULL);
- }
- xprt->xp_p2 = NULL;
- xprt->xp_p1 = (caddr_t)r;
- xprt->xp_verf = _null_auth;
- xprt->xp_ops = &svctcp_rendezvous_op;
- xprt->xp_port = ntohs(addr.sin_port);
- xprt->xp_sock = sock;
- xprt_register(xprt);
- return (xprt);
-}
-
-/*
- * Like svtcp_create(), except the routine takes any *open* UNIX file
- * descriptor as its first input.
- */
-SVCXPRT *
-svcfd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
-{
-
- return (makefd_xprt(fd, sendsize, recvsize));
-}
-
-static SVCXPRT *
-makefd_xprt(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
-{
- register SVCXPRT *xprt;
- register struct tcp_conn *cd;
-
- xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
- if (xprt == (SVCXPRT *)NULL) {
- (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
- goto done;
- }
- cd = (struct tcp_conn *)mem_alloc(sizeof(struct tcp_conn));
- if (cd == (struct tcp_conn *)NULL) {
- (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
- mem_free((char *) xprt, sizeof(SVCXPRT));
- xprt = (SVCXPRT *)NULL;
- goto done;
- }
- cd->strm_stat = XPRT_IDLE;
- xdrrec_create(&(cd->xdrs), sendsize, recvsize,
- (caddr_t)xprt, readtcp, writetcp);
- xprt->xp_p2 = NULL;
- xprt->xp_p1 = (caddr_t)cd;
- xprt->xp_verf.oa_base = cd->verf_body;
- xprt->xp_addrlen = 0;
- xprt->xp_ops = &svctcp_op; /* truely deals with calls */
- xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
- xprt->xp_sock = fd;
- xprt_register(xprt);
- done:
- return (xprt);
-}
-
-static bool_t
-rendezvous_request(xprt)
- register SVCXPRT *xprt;
-{
- int sock;
- struct tcp_rendezvous *r;
- struct sockaddr_in addr;
- int len;
-
- r = (struct tcp_rendezvous *)xprt->xp_p1;
- again:
- len = sizeof(struct sockaddr_in);
- if ((sock = accept(xprt->xp_sock, (struct sockaddr *)&addr,
- &len)) < 0) {
- if (errno == EINTR)
- goto again;
- return (FALSE);
- }
- /*
- * make a new transporter (re-uses xprt)
- */
- xprt = makefd_xprt(sock, r->sendsize, r->recvsize);
- xprt->xp_raddr = addr;
- xprt->xp_addrlen = len;
- return (FALSE); /* there is never an rpc msg to be processed */
-}
-
-static enum xprt_stat
-rendezvous_stat()
-{
-
- return (XPRT_IDLE);
-}
-
-static void
-svctcp_destroy(xprt)
- register SVCXPRT *xprt;
-{
- register struct tcp_conn *cd = (struct tcp_conn *)xprt->xp_p1;
-
- xprt_unregister(xprt);
- (void)close(xprt->xp_sock);
- if (xprt->xp_port != 0) {
- /* a rendezvouser socket */
- xprt->xp_port = 0;
- } else {
- /* an actual connection socket */
- XDR_DESTROY(&(cd->xdrs));
- }
- mem_free((caddr_t)cd, sizeof(struct tcp_conn));
- mem_free((caddr_t)xprt, sizeof(SVCXPRT));
-}
-
-/*
- * All read operations timeout after 35 seconds.
- * A timeout is fatal for the connection.
- */
-static struct timeval wait_per_try = { 35, 0 };
-
-/*
- * reads data from the tcp conection.
- * any error is fatal and the connection is closed.
- * (And a read of zero bytes is a half closed stream => error.)
- */
-static int
-readtcp(xprt, buf, len)
- register SVCXPRT *xprt;
- caddr_t buf;
- register int len;
-{
- register int sock = xprt->xp_sock;
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
-
- FD_ZERO(&mask);
- FD_SET(sock, &mask);
-#else
- register int mask = 1 << sock;
- int readfds;
-#endif /* def FD_SETSIZE */
- do {
- readfds = mask;
- if (select(_rpc_dtablesize(), &readfds, (int*)NULL, (int*)NULL,
- &wait_per_try) <= 0) {
- if (errno == EINTR) {
- continue;
- }
- goto fatal_err;
- }
-#ifdef FD_SETSIZE
- } while (!FD_ISSET(sock, &readfds));
-#else
- } while (readfds != mask);
-#endif /* def FD_SETSIZE */
- if ((len = read(sock, buf, len)) > 0) {
- return (len);
- }
-fatal_err:
- ((struct tcp_conn *)(xprt->xp_p1))->strm_stat = XPRT_DIED;
- return (-1);
-}
-
-/*
- * writes data to the tcp connection.
- * Any error is fatal and the connection is closed.
- */
-static int
-writetcp(xprt, buf, len)
- register SVCXPRT *xprt;
- caddr_t buf;
- int len;
-{
- register int i, cnt;
-
- for (cnt = len; cnt > 0; cnt -= i, buf += i) {
- if ((i = write(xprt->xp_sock, buf, cnt)) < 0) {
- ((struct tcp_conn *)(xprt->xp_p1))->strm_stat =
- XPRT_DIED;
- return (-1);
- }
- }
- return (len);
-}
-
-static enum xprt_stat
-svctcp_stat(xprt)
- SVCXPRT *xprt;
-{
- register struct tcp_conn *cd =
- (struct tcp_conn *)(xprt->xp_p1);
-
- if (cd->strm_stat == XPRT_DIED)
- return (XPRT_DIED);
- if (! xdrrec_eof(&(cd->xdrs)))
- return (XPRT_MOREREQS);
- return (XPRT_IDLE);
-}
-
-static bool_t
-svctcp_recv(xprt, msg)
- SVCXPRT *xprt;
- register struct rpc_msg *msg;
-{
- register struct tcp_conn *cd =
- (struct tcp_conn *)(xprt->xp_p1);
- register XDR *xdrs = &(cd->xdrs);
-
- xdrs->x_op = XDR_DECODE;
- (void)xdrrec_skiprecord(xdrs);
- if (xdr_callmsg(xdrs, msg)) {
- cd->x_id = msg->rm_xid;
- return (TRUE);
- }
- return (FALSE);
-}
-
-static bool_t
-svctcp_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
-{
-
- return ((*xdr_args)(&(((struct tcp_conn *)(xprt->xp_p1))->xdrs), args_ptr));
-}
-
-static bool_t
-svctcp_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
-{
- register XDR *xdrs =
- &(((struct tcp_conn *)(xprt->xp_p1))->xdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_args)(xdrs, args_ptr));
-}
-
-static bool_t
-svctcp_reply(xprt, msg)
- SVCXPRT *xprt;
- register struct rpc_msg *msg;
-{
- register struct tcp_conn *cd =
- (struct tcp_conn *)(xprt->xp_p1);
- register XDR *xdrs = &(cd->xdrs);
- register bool_t stat;
-
- xdrs->x_op = XDR_ENCODE;
- msg->rm_xid = cd->x_id;
- stat = xdr_replymsg(xdrs, msg);
- (void)xdrrec_endofrecord(xdrs, TRUE);
- return (stat);
-}
diff --git a/lib/librpc/rpc/svc_udp.c b/lib/librpc/rpc/svc_udp.c
deleted file mode 100644
index 429b01b..0000000
--- a/lib/librpc/rpc/svc_udp.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/* @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_udp.c,
- * Server side for UDP/IP based RPC. (Does some caching in the hopes of
- * achieving execute-at-most-once semantics.)
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <errno.h>
-
-
-#define rpc_buffer(xprt) ((xprt)->xp_p1)
-#define MAX(a, b) ((a > b) ? a : b)
-
-static bool_t svcudp_recv();
-static bool_t svcudp_reply();
-static enum xprt_stat svcudp_stat();
-static bool_t svcudp_getargs();
-static bool_t svcudp_freeargs();
-static void svcudp_destroy();
-
-static struct xp_ops svcudp_op = {
- svcudp_recv,
- svcudp_stat,
- svcudp_getargs,
- svcudp_reply,
- svcudp_freeargs,
- svcudp_destroy
-};
-
-extern int errno;
-
-/*
- * kept in xprt->xp_p2
- */
-struct svcudp_data {
- u_int su_iosz; /* byte size of send.recv buffer */
- u_long su_xid; /* transaction id */
- XDR su_xdrs; /* XDR handle */
- char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */
- char * su_cache; /* cached data, NULL if no cache */
-};
-#define su_data(xprt) ((struct svcudp_data *)(xprt->xp_p2))
-
-/*
- * Usage:
- * xprt = svcudp_create(sock);
- *
- * If sock<0 then a socket is created, else sock is used.
- * If the socket, sock is not bound to a port then svcudp_create
- * binds it to an arbitrary port. In any (successful) case,
- * xprt->xp_sock is the registered socket number and xprt->xp_port is the
- * associated port number.
- * Once *xprt is initialized, it is registered as a transporter;
- * see (svc.h, xprt_register).
- * The routines returns NULL if a problem occurred.
- */
-SVCXPRT *
-svcudp_bufcreate(sock, sendsz, recvsz)
- register int sock;
- u_int sendsz, recvsz;
-{
- bool_t madesock = FALSE;
- register SVCXPRT *xprt;
- register struct svcudp_data *su;
- struct sockaddr_in addr;
- int len = sizeof(struct sockaddr_in);
-
- if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- perror("svcudp_create: socket creation problem");
- return ((SVCXPRT *)NULL);
- }
- madesock = TRUE;
- }
- bzero((char *)&addr, sizeof (addr));
- addr.sin_family = AF_INET;
- if (bindresvport(sock, &addr)) {
- addr.sin_port = 0;
- (void)bind(sock, (struct sockaddr *)&addr, len);
- }
- if (getsockname(sock, (struct sockaddr *)&addr, &len) != 0) {
- perror("svcudp_create - cannot getsockname");
- if (madesock)
- (void)close(sock);
- return ((SVCXPRT *)NULL);
- }
- xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- (void)fprintf(stderr, "svcudp_create: out of memory\n");
- return (NULL);
- }
- su = (struct svcudp_data *)mem_alloc(sizeof(*su));
- if (su == NULL) {
- (void)fprintf(stderr, "svcudp_create: out of memory\n");
- return (NULL);
- }
- su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4;
- if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL) {
- (void)fprintf(stderr, "svcudp_create: out of memory\n");
- return (NULL);
- }
- xdrmem_create(
- &(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, XDR_DECODE);
- su->su_cache = NULL;
- xprt->xp_p2 = (caddr_t)su;
- xprt->xp_verf.oa_base = su->su_verfbody;
- xprt->xp_ops = &svcudp_op;
- xprt->xp_port = ntohs(addr.sin_port);
- xprt->xp_sock = sock;
- xprt_register(xprt);
- return (xprt);
-}
-
-SVCXPRT *
-svcudp_create(sock)
- int sock;
-{
-
- return(svcudp_bufcreate(sock, UDPMSGSIZE, UDPMSGSIZE));
-}
-
-static enum xprt_stat
-svcudp_stat(xprt)
- SVCXPRT *xprt;
-{
-
- return (XPRT_IDLE);
-}
-
-static bool_t
-svcudp_recv(xprt, msg)
- register SVCXPRT *xprt;
- struct rpc_msg *msg;
-{
- register struct svcudp_data *su = su_data(xprt);
- register XDR *xdrs = &(su->su_xdrs);
- register int rlen;
- char *reply;
- u_long replylen;
- static int cache_get();
-
- again:
- xprt->xp_addrlen = sizeof(struct sockaddr_in);
- rlen = recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz,
- 0, (struct sockaddr *)&(xprt->xp_raddr), &(xprt->xp_addrlen));
- if (rlen == -1 && errno == EINTR)
- goto again;
- if (rlen < 4*sizeof(u_long))
- return (FALSE);
- xdrs->x_op = XDR_DECODE;
- XDR_SETPOS(xdrs, 0);
- if (! xdr_callmsg(xdrs, msg))
- return (FALSE);
- su->su_xid = msg->rm_xid;
- if (su->su_cache != NULL) {
- if (cache_get(xprt, msg, &reply, &replylen)) {
- (void) sendto(xprt->xp_sock, reply, (int) replylen, 0,
- (struct sockaddr *) &xprt->xp_raddr, xprt->xp_addrlen);
- return (TRUE);
- }
- }
- return (TRUE);
-}
-
-static bool_t
-svcudp_reply(xprt, msg)
- register SVCXPRT *xprt;
- struct rpc_msg *msg;
-{
- register struct svcudp_data *su = su_data(xprt);
- register XDR *xdrs = &(su->su_xdrs);
- register int slen;
- register bool_t stat = FALSE;
- static void cache_set();
-
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, 0);
- msg->rm_xid = su->su_xid;
- if (xdr_replymsg(xdrs, msg)) {
- slen = (int)XDR_GETPOS(xdrs);
- if (sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0,
- (struct sockaddr *)&(xprt->xp_raddr), xprt->xp_addrlen)
- == slen) {
- stat = TRUE;
- if (su->su_cache && slen >= 0) {
- cache_set(xprt, (u_long) slen);
- }
- }
- }
- return (stat);
-}
-
-static bool_t
-svcudp_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
-{
-
- return ((*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr));
-}
-
-static bool_t
-svcudp_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
-{
- register XDR *xdrs = &(su_data(xprt)->su_xdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_args)(xdrs, args_ptr));
-}
-
-static void
-svcudp_destroy(xprt)
- register SVCXPRT *xprt;
-{
- register struct svcudp_data *su = su_data(xprt);
-
- xprt_unregister(xprt);
- (void)close(xprt->xp_sock);
- XDR_DESTROY(&(su->su_xdrs));
- mem_free(rpc_buffer(xprt), su->su_iosz);
- mem_free((caddr_t)su, sizeof(struct svcudp_data));
- mem_free((caddr_t)xprt, sizeof(SVCXPRT));
-}
-
-
-/***********this could be a separate file*********************/
-
-/*
- * Fifo cache for udp server
- * Copies pointers to reply buffers into fifo cache
- * Buffers are sent again if retransmissions are detected.
- */
-
-#define SPARSENESS 4 /* 75% sparse */
-
-#define CACHE_PERROR(msg) \
- (void) fprintf(stderr,"%s\n", msg)
-
-#define ALLOC(type, size) \
- (type *) mem_alloc((unsigned) (sizeof(type) * (size)))
-
-#define BZERO(addr, type, size) \
- bzero((char *) addr, sizeof(type) * (int) (size))
-
-/*
- * An entry in the cache
- */
-typedef struct cache_node *cache_ptr;
-struct cache_node {
- /*
- * Index into cache is xid, proc, vers, prog and address
- */
- u_long cache_xid;
- u_long cache_proc;
- u_long cache_vers;
- u_long cache_prog;
- struct sockaddr_in cache_addr;
- /*
- * The cached reply and length
- */
- char * cache_reply;
- u_long cache_replylen;
- /*
- * Next node on the list, if there is a collision
- */
- cache_ptr cache_next;
-};
-
-
-
-/*
- * The entire cache
- */
-struct udp_cache {
- u_long uc_size; /* size of cache */
- cache_ptr *uc_entries; /* hash table of entries in cache */
- cache_ptr *uc_fifo; /* fifo list of entries in cache */
- u_long uc_nextvictim; /* points to next victim in fifo list */
- u_long uc_prog; /* saved program number */
- u_long uc_vers; /* saved version number */
- u_long uc_proc; /* saved procedure number */
- struct sockaddr_in uc_addr; /* saved caller's address */
-};
-
-
-/*
- * the hashing function
- */
-#define CACHE_LOC(transp, xid) \
- (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size))
-
-
-/*
- * Enable use of the cache.
- * Note: there is no disable.
- */
-svcudp_enablecache(transp, size)
- SVCXPRT *transp;
- u_long size;
-{
- struct svcudp_data *su = su_data(transp);
- struct udp_cache *uc;
-
- if (su->su_cache != NULL) {
- CACHE_PERROR("enablecache: cache already enabled");
- return(0);
- }
- uc = ALLOC(struct udp_cache, 1);
- if (uc == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache");
- return(0);
- }
- uc->uc_size = size;
- uc->uc_nextvictim = 0;
- uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS);
- if (uc->uc_entries == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache data");
- return(0);
- }
- BZERO(uc->uc_entries, cache_ptr, size * SPARSENESS);
- uc->uc_fifo = ALLOC(cache_ptr, size);
- if (uc->uc_fifo == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache fifo");
- return(0);
- }
- BZERO(uc->uc_fifo, cache_ptr, size);
- su->su_cache = (char *) uc;
- return(1);
-}
-
-
-/*
- * Set an entry in the cache
- */
-static void
-cache_set(xprt, replylen)
- SVCXPRT *xprt;
- u_long replylen;
-{
- register cache_ptr victim;
- register cache_ptr *vicp;
- register struct svcudp_data *su = su_data(xprt);
- struct udp_cache *uc = (struct udp_cache *) su->su_cache;
- u_int loc;
- char *newbuf;
-
- /*
- * Find space for the new entry, either by
- * reusing an old entry, or by mallocing a new one
- */
- victim = uc->uc_fifo[uc->uc_nextvictim];
- if (victim != NULL) {
- loc = CACHE_LOC(xprt, victim->cache_xid);
- for (vicp = &uc->uc_entries[loc];
- *vicp != NULL && *vicp != victim;
- vicp = &(*vicp)->cache_next)
- ;
- if (*vicp == NULL) {
- CACHE_PERROR("cache_set: victim not found");
- return;
- }
- *vicp = victim->cache_next; /* remote from cache */
- newbuf = victim->cache_reply;
- } else {
- victim = ALLOC(struct cache_node, 1);
- if (victim == NULL) {
- CACHE_PERROR("cache_set: victim alloc failed");
- return;
- }
- newbuf = mem_alloc(su->su_iosz);
- if (newbuf == NULL) {
- CACHE_PERROR("cache_set: could not allocate new rpc_buffer");
- return;
- }
- }
-
- /*
- * Store it away
- */
- victim->cache_replylen = replylen;
- victim->cache_reply = rpc_buffer(xprt);
- rpc_buffer(xprt) = newbuf;
- xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, XDR_ENCODE);
- victim->cache_xid = su->su_xid;
- victim->cache_proc = uc->uc_proc;
- victim->cache_vers = uc->uc_vers;
- victim->cache_prog = uc->uc_prog;
- victim->cache_addr = uc->uc_addr;
- loc = CACHE_LOC(xprt, victim->cache_xid);
- victim->cache_next = uc->uc_entries[loc];
- uc->uc_entries[loc] = victim;
- uc->uc_fifo[uc->uc_nextvictim++] = victim;
- uc->uc_nextvictim %= uc->uc_size;
-}
-
-/*
- * Try to get an entry from the cache
- * return 1 if found, 0 if not found
- */
-static
-cache_get(xprt, msg, replyp, replylenp)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
- char **replyp;
- u_long *replylenp;
-{
- u_int loc;
- register cache_ptr ent;
- register struct svcudp_data *su = su_data(xprt);
- register struct udp_cache *uc = (struct udp_cache *) su->su_cache;
-
-# define EQADDR(a1, a2) (bcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
-
- loc = CACHE_LOC(xprt, su->su_xid);
- for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) {
- if (ent->cache_xid == su->su_xid &&
- ent->cache_proc == uc->uc_proc &&
- ent->cache_vers == uc->uc_vers &&
- ent->cache_prog == uc->uc_prog &&
- EQADDR(ent->cache_addr, uc->uc_addr)) {
- *replyp = ent->cache_reply;
- *replylenp = ent->cache_replylen;
- return(1);
- }
- }
- /*
- * Failed to find entry
- * Remember a few things so we can do a set later
- */
- uc->uc_proc = msg->rm_call.cb_proc;
- uc->uc_vers = msg->rm_call.cb_vers;
- uc->uc_prog = msg->rm_call.cb_prog;
- uc->uc_addr = xprt->xp_raddr;
- return(0);
-}
-
diff --git a/lib/librpc/rpc/types.h b/lib/librpc/rpc/types.h
deleted file mode 100644
index 06d22bf..0000000
--- a/lib/librpc/rpc/types.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)types.h 1.18 87/07/24 SMI */
-
-/*
- * Rpc additions to <sys/types.h>
- */
-#ifndef __TYPES_RPC_HEADER__
-#define __TYPES_RPC_HEADER__
-
-#define bool_t int
-#define enum_t int
-#define FALSE (0)
-#define TRUE (1)
-#define __dontcare__ -1
-#ifndef NULL
-# define NULL 0
-#endif
-
-void *malloc();
-#define mem_alloc(bsize) malloc(bsize)
-#define mem_free(ptr, bsize) free(ptr)
-
-#ifndef makedev /* ie, we haven't already included it */
-#include <sys/types.h>
-#endif
-#include <sys/time.h>
-
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK (u_long)0x7F000001
-#endif
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-#endif /* ndef __TYPES_RPC_HEADER__ */
diff --git a/lib/librpc/rpc/xdr.c b/lib/librpc/rpc/xdr.c
deleted file mode 100644
index 6c379c9..0000000
--- a/lib/librpc/rpc/xdr.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
-#endif
-
-/*
- * xdr.c, Generic XDR routines implementation.
- *
- * Copyright (C) 1986, Sun Microsystems, Inc.
- *
- * These are the "generic" xdr routines used to serialize and de-serialize
- * most common data items. See xdr.h for more info on the interface to
- * xdr.
- */
-
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-
-/*
- * constants specific to the xdr "protocol"
- */
-#define XDR_FALSE ((long) 0)
-#define XDR_TRUE ((long) 1)
-#define LASTUNSIGNED ((u_int) 0-1)
-
-/*
- * for unit alignment
- */
-static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
-
-/*
- * Free a data structure using XDR
- * Not a filter, but a convenient utility nonetheless
- */
-void
-xdr_free(proc, objp)
- xdrproc_t proc;
- char *objp;
-{
- XDR x;
-
- x.x_op = XDR_FREE;
- (*proc)(&x, objp);
-}
-
-/*
- * XDR nothing
- */
-bool_t
-xdr_void(/* xdrs, addr */)
- /* XDR *xdrs; */
- /* caddr_t addr; */
-{
-
- return (TRUE);
-}
-
-/*
- * XDR integers
- */
-bool_t
-xdr_int(xdrs, ip)
- XDR *xdrs;
- int *ip;
-{
-
-#ifdef lint
- (void) (xdr_short(xdrs, (short *)ip));
- return (xdr_long(xdrs, (long *)ip));
-#else
- if (sizeof (int) == sizeof (long)) {
- return (xdr_long(xdrs, (long *)ip));
- } else {
- return (xdr_short(xdrs, (short *)ip));
- }
-#endif
-}
-
-/*
- * XDR unsigned integers
- */
-bool_t
-xdr_u_int(xdrs, up)
- XDR *xdrs;
- u_int *up;
-{
-
-#ifdef lint
- (void) (xdr_short(xdrs, (short *)up));
- return (xdr_u_long(xdrs, (u_long *)up));
-#else
- if (sizeof (u_int) == sizeof (u_long)) {
- return (xdr_u_long(xdrs, (u_long *)up));
- } else {
- return (xdr_short(xdrs, (short *)up));
- }
-#endif
-}
-
-/*
- * XDR long integers
- * same as xdr_u_long - open coded to save a proc call!
- */
-bool_t
-xdr_long(xdrs, lp)
- register XDR *xdrs;
- long *lp;
-{
-
- if (xdrs->x_op == XDR_ENCODE)
- return (XDR_PUTLONG(xdrs, lp));
-
- if (xdrs->x_op == XDR_DECODE)
- return (XDR_GETLONG(xdrs, lp));
-
- if (xdrs->x_op == XDR_FREE)
- return (TRUE);
-
- return (FALSE);
-}
-
-/*
- * XDR unsigned long integers
- * same as xdr_long - open coded to save a proc call!
- */
-bool_t
-xdr_u_long(xdrs, ulp)
- register XDR *xdrs;
- u_long *ulp;
-{
-
- if (xdrs->x_op == XDR_DECODE)
- return (XDR_GETLONG(xdrs, (long *)ulp));
- if (xdrs->x_op == XDR_ENCODE)
- return (XDR_PUTLONG(xdrs, (long *)ulp));
- if (xdrs->x_op == XDR_FREE)
- return (TRUE);
- return (FALSE);
-}
-
-/*
- * XDR short integers
- */
-bool_t
-xdr_short(xdrs, sp)
- register XDR *xdrs;
- short *sp;
-{
- long l;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- l = (long) *sp;
- return (XDR_PUTLONG(xdrs, &l));
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &l)) {
- return (FALSE);
- }
- *sp = (short) l;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR unsigned short integers
- */
-bool_t
-xdr_u_short(xdrs, usp)
- register XDR *xdrs;
- u_short *usp;
-{
- u_long l;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- l = (u_long) *usp;
- return (XDR_PUTLONG(xdrs, &l));
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &l)) {
- return (FALSE);
- }
- *usp = (u_short) l;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-
-/*
- * XDR a char
- */
-bool_t
-xdr_char(xdrs, cp)
- XDR *xdrs;
- char *cp;
-{
- int i;
-
- i = (*cp);
- if (!xdr_int(xdrs, &i)) {
- return (FALSE);
- }
- *cp = i;
- return (TRUE);
-}
-
-/*
- * XDR an unsigned char
- */
-bool_t
-xdr_u_char(xdrs, cp)
- XDR *xdrs;
- char *cp;
-{
- u_int u;
-
- u = (*cp);
- if (!xdr_u_int(xdrs, &u)) {
- return (FALSE);
- }
- *cp = u;
- return (TRUE);
-}
-
-/*
- * XDR booleans
- */
-bool_t
-xdr_bool(xdrs, bp)
- register XDR *xdrs;
- bool_t *bp;
-{
- long lb;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- lb = *bp ? XDR_TRUE : XDR_FALSE;
- return (XDR_PUTLONG(xdrs, &lb));
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &lb)) {
- return (FALSE);
- }
- *bp = (lb == XDR_FALSE) ? FALSE : TRUE;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR enumerations
- */
-bool_t
-xdr_enum(xdrs, ep)
- XDR *xdrs;
- enum_t *ep;
-{
-#ifndef lint
- enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
-
- /*
- * enums are treated as ints
- */
- if (sizeof (enum sizecheck) == sizeof (long)) {
- return (xdr_long(xdrs, (long *)ep));
- } else if (sizeof (enum sizecheck) == sizeof (short)) {
- return (xdr_short(xdrs, (short *)ep));
- } else {
- return (FALSE);
- }
-#else
- (void) (xdr_short(xdrs, (short *)ep));
- return (xdr_long(xdrs, (long *)ep));
-#endif
-}
-
-/*
- * XDR opaque data
- * Allows the specification of a fixed size sequence of opaque bytes.
- * cp points to the opaque object and cnt gives the byte length.
- */
-bool_t
-xdr_opaque(xdrs, cp, cnt)
- register XDR *xdrs;
- caddr_t cp;
- register u_int cnt;
-{
- register u_int rndup;
- static crud[BYTES_PER_XDR_UNIT];
-
- /*
- * if no data we are done
- */
- if (cnt == 0)
- return (TRUE);
-
- /*
- * round byte count to full xdr units
- */
- rndup = cnt % BYTES_PER_XDR_UNIT;
- if (rndup > 0)
- rndup = BYTES_PER_XDR_UNIT - rndup;
-
- if (xdrs->x_op == XDR_DECODE) {
- if (!XDR_GETBYTES(xdrs, cp, cnt)) {
- return (FALSE);
- }
- if (rndup == 0)
- return (TRUE);
- return (XDR_GETBYTES(xdrs, crud, rndup));
- }
-
- if (xdrs->x_op == XDR_ENCODE) {
- if (!XDR_PUTBYTES(xdrs, cp, cnt)) {
- return (FALSE);
- }
- if (rndup == 0)
- return (TRUE);
- return (XDR_PUTBYTES(xdrs, xdr_zero, rndup));
- }
-
- if (xdrs->x_op == XDR_FREE) {
- return (TRUE);
- }
-
- return (FALSE);
-}
-
-/*
- * XDR counted bytes
- * *cpp is a pointer to the bytes, *sizep is the count.
- * If *cpp is NULL maxsize bytes are allocated
- */
-bool_t
-xdr_bytes(xdrs, cpp, sizep, maxsize)
- register XDR *xdrs;
- char **cpp;
- register u_int *sizep;
- u_int maxsize;
-{
- register char *sp = *cpp; /* sp is the actual string pointer */
- register u_int nodesize;
-
- /*
- * first deal with the length since xdr bytes are counted
- */
- if (! xdr_u_int(xdrs, sizep)) {
- return (FALSE);
- }
- nodesize = *sizep;
- if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
- return (FALSE);
- }
-
- /*
- * now deal with the actual bytes
- */
- switch (xdrs->x_op) {
-
- case XDR_DECODE:
- if (nodesize == 0) {
- return (TRUE);
- }
- if (sp == NULL) {
- *cpp = sp = (char *)mem_alloc(nodesize);
- }
- if (sp == NULL) {
- (void) fprintf(stderr, "xdr_bytes: out of memory\n");
- return (FALSE);
- }
- /* fall into ... */
-
- case XDR_ENCODE:
- return (xdr_opaque(xdrs, sp, nodesize));
-
- case XDR_FREE:
- if (sp != NULL) {
- mem_free(sp, nodesize);
- *cpp = NULL;
- }
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * Implemented here due to commonality of the object.
- */
-bool_t
-xdr_netobj(xdrs, np)
- XDR *xdrs;
- struct netobj *np;
-{
-
- return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ));
-}
-
-/*
- * XDR a descriminated union
- * Support routine for discriminated unions.
- * You create an array of xdrdiscrim structures, terminated with
- * an entry with a null procedure pointer. The routine gets
- * the discriminant value and then searches the array of xdrdiscrims
- * looking for that value. It calls the procedure given in the xdrdiscrim
- * to handle the discriminant. If there is no specific routine a default
- * routine may be called.
- * If there is no specific or default routine an error is returned.
- */
-bool_t
-xdr_union(xdrs, dscmp, unp, choices, dfault)
- register XDR *xdrs;
- enum_t *dscmp; /* enum to decide which arm to work on */
- char *unp; /* the union itself */
- struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
- xdrproc_t dfault; /* default xdr routine */
-{
- register enum_t dscm;
-
- /*
- * we deal with the discriminator; it's an enum
- */
- if (! xdr_enum(xdrs, dscmp)) {
- return (FALSE);
- }
- dscm = *dscmp;
-
- /*
- * search choices for a value that matches the discriminator.
- * if we find one, execute the xdr routine for that value.
- */
- for (; choices->proc != NULL_xdrproc_t; choices++) {
- if (choices->value == dscm)
- return ((*(choices->proc))(xdrs, unp, LASTUNSIGNED));
- }
-
- /*
- * no match - execute the default xdr routine if there is one
- */
- return ((dfault == NULL_xdrproc_t) ? FALSE :
- (*dfault)(xdrs, unp, LASTUNSIGNED));
-}
-
-
-/*
- * Non-portable xdr primitives.
- * Care should be taken when moving these routines to new architectures.
- */
-
-
-/*
- * XDR null terminated ASCII strings
- * xdr_string deals with "C strings" - arrays of bytes that are
- * terminated by a NULL character. The parameter cpp references a
- * pointer to storage; If the pointer is null, then the necessary
- * storage is allocated. The last parameter is the max allowed length
- * of the string as specified by a protocol.
- */
-bool_t
-xdr_string(xdrs, cpp, maxsize)
- register XDR *xdrs;
- char **cpp;
- u_int maxsize;
-{
- register char *sp = *cpp; /* sp is the actual string pointer */
- u_int size;
- u_int nodesize;
-
- /*
- * first deal with the length since xdr strings are counted-strings
- */
- switch (xdrs->x_op) {
- case XDR_FREE:
- if (sp == NULL) {
- return(TRUE); /* already free */
- }
- /* fall through... */
- case XDR_ENCODE:
- size = strlen(sp);
- break;
- }
- if (! xdr_u_int(xdrs, &size)) {
- return (FALSE);
- }
- if (size > maxsize) {
- return (FALSE);
- }
- nodesize = size + 1;
-
- /*
- * now deal with the actual bytes
- */
- switch (xdrs->x_op) {
-
- case XDR_DECODE:
- if (nodesize == 0) {
- return (TRUE);
- }
- if (sp == NULL)
- *cpp = sp = (char *)mem_alloc(nodesize);
- if (sp == NULL) {
- (void) fprintf(stderr, "xdr_string: out of memory\n");
- return (FALSE);
- }
- sp[size] = 0;
- /* fall into ... */
-
- case XDR_ENCODE:
- return (xdr_opaque(xdrs, sp, size));
-
- case XDR_FREE:
- mem_free(sp, nodesize);
- *cpp = NULL;
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * Wrapper for xdr_string that can be called directly from
- * routines like clnt_call
- */
-bool_t
-xdr_wrapstring(xdrs, cpp)
- XDR *xdrs;
- char **cpp;
-{
- if (xdr_string(xdrs, cpp, LASTUNSIGNED)) {
- return (TRUE);
- }
- return (FALSE);
-}
diff --git a/lib/librpc/rpc/xdr.h b/lib/librpc/rpc/xdr.h
deleted file mode 100644
index 6cd3e6f..0000000
--- a/lib/librpc/rpc/xdr.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)xdr.h 1.19 87/04/22 SMI */
-
-/*
- * xdr.h, External Data Representation Serialization Routines.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef __XDR_HEADER__
-#define __XDR_HEADER__
-
-/*
- * XDR provides a conventional way for converting between C data
- * types and an external bit-string representation. Library supplied
- * routines provide for the conversion on built-in C data types. These
- * routines and utility routines defined here are used to help implement
- * a type encode/decode routine for each user-defined type.
- *
- * Each data type provides a single procedure which takes two arguments:
- *
- * bool_t
- * xdrproc(xdrs, argresp)
- * XDR *xdrs;
- * <type> *argresp;
- *
- * xdrs is an instance of a XDR handle, to which or from which the data
- * type is to be converted. argresp is a pointer to the structure to be
- * converted. The XDR handle contains an operation field which indicates
- * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
- *
- * XDR_DECODE may allocate space if the pointer argresp is null. This
- * data can be freed with the XDR_FREE operation.
- *
- * We write only one procedure per data type to make it easy
- * to keep the encode and decode procedures for a data type consistent.
- * In many cases the same code performs all operations on a user defined type,
- * because all the hard work is done in the component type routines.
- * decode as a series of calls on the nested data types.
- */
-
-/*
- * Xdr operations. XDR_ENCODE causes the type to be encoded into the
- * stream. XDR_DECODE causes the type to be extracted from the stream.
- * XDR_FREE can be used to release the space allocated by an XDR_DECODE
- * request.
- */
-enum xdr_op {
- XDR_ENCODE=0,
- XDR_DECODE=1,
- XDR_FREE=2
-};
-
-/*
- * This is the number of bytes per unit of external data.
- */
-#define BYTES_PER_XDR_UNIT (4)
-#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
- * BYTES_PER_XDR_UNIT)
-
-/*
- * A xdrproc_t exists for each data type which is to be encoded or decoded.
- *
- * The second argument to the xdrproc_t is a pointer to an opaque pointer.
- * The opaque pointer generally points to a structure of the data type
- * to be decoded. If this pointer is 0, then the type routines should
- * allocate dynamic storage of the appropriate size and return it.
- * bool_t (*xdrproc_t)(XDR *, caddr_t *);
- */
-typedef bool_t (*xdrproc_t)();
-
-/*
- * The XDR handle.
- * Contains operation which is being applied to the stream,
- * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
- * and two private fields for the use of the particular impelementation.
- */
-typedef struct {
- enum xdr_op x_op; /* operation; fast additional param */
- struct xdr_ops {
- bool_t (*x_getlong)(); /* get a long from underlying stream */
- bool_t (*x_putlong)(); /* put a long to " */
- bool_t (*x_getbytes)();/* get some bytes from " */
- bool_t (*x_putbytes)();/* put some bytes to " */
- u_int (*x_getpostn)();/* returns bytes off from beginning */
- bool_t (*x_setpostn)();/* lets you reposition the stream */
- long * (*x_inline)(); /* buf quick ptr to buffered data */
- void (*x_destroy)(); /* free privates of this xdr_stream */
- } *x_ops;
- caddr_t x_public; /* users' data */
- caddr_t x_private; /* pointer to private data */
- caddr_t x_base; /* private used for position info */
- int x_handy; /* extra private word */
-} XDR;
-
-/*
- * Operations defined on a XDR handle
- *
- * XDR *xdrs;
- * long *longp;
- * caddr_t addr;
- * u_int len;
- * u_int pos;
- */
-#define XDR_GETLONG(xdrs, longp) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
-#define xdr_getlong(xdrs, longp) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
-
-#define XDR_PUTLONG(xdrs, longp) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
-#define xdr_putlong(xdrs, longp) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
-
-#define XDR_GETBYTES(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
-#define xdr_getbytes(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
-
-#define XDR_PUTBYTES(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
-#define xdr_putbytes(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
-
-#define XDR_GETPOS(xdrs) \
- (*(xdrs)->x_ops->x_getpostn)(xdrs)
-#define xdr_getpos(xdrs) \
- (*(xdrs)->x_ops->x_getpostn)(xdrs)
-
-#define XDR_SETPOS(xdrs, pos) \
- (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
-#define xdr_setpos(xdrs, pos) \
- (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
-
-#define XDR_INLINE(xdrs, len) \
- (*(xdrs)->x_ops->x_inline)(xdrs, len)
-#define xdr_inline(xdrs, len) \
- (*(xdrs)->x_ops->x_inline)(xdrs, len)
-
-#define XDR_DESTROY(xdrs) \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs)
-#define xdr_destroy(xdrs) \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs)
-
-/*
- * Support struct for discriminated unions.
- * You create an array of xdrdiscrim structures, terminated with
- * a entry with a null procedure pointer. The xdr_union routine gets
- * the discriminant value and then searches the array of structures
- * for a matching value. If a match is found the associated xdr routine
- * is called to handle that part of the union. If there is
- * no match, then a default routine may be called.
- * If there is no match and no default routine it is an error.
- */
-#define NULL_xdrproc_t ((xdrproc_t)0)
-struct xdr_discrim {
- int value;
- xdrproc_t proc;
-};
-
-/*
- * In-line routines for fast encode/decode of primitve data types.
- * Caveat emptor: these use single memory cycles to get the
- * data from the underlying buffer, and will fail to operate
- * properly if the data is not aligned. The standard way to use these
- * is to say:
- * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
- * return (FALSE);
- * <<< macro calls >>>
- * where ``count'' is the number of bytes of data occupied
- * by the primitive data types.
- *
- * N.B. and frozen for all time: each data type here uses 4 bytes
- * of external representation.
- */
-#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++))
-#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v))
-
-#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
-#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
-#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
-
-#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v)))
-
-/*
- * These are the "generic" xdr routines.
- */
-extern bool_t xdr_void();
-extern bool_t xdr_int();
-extern bool_t xdr_u_int();
-extern bool_t xdr_long();
-extern bool_t xdr_u_long();
-extern bool_t xdr_short();
-extern bool_t xdr_u_short();
-extern bool_t xdr_bool();
-extern bool_t xdr_enum();
-extern bool_t xdr_array();
-extern bool_t xdr_bytes();
-extern bool_t xdr_opaque();
-extern bool_t xdr_string();
-extern bool_t xdr_union();
-extern bool_t xdr_char();
-extern bool_t xdr_u_char();
-extern bool_t xdr_vector();
-extern bool_t xdr_float();
-extern bool_t xdr_double();
-extern bool_t xdr_reference();
-extern bool_t xdr_pointer();
-extern bool_t xdr_wrapstring();
-
-/*
- * Common opaque bytes objects used by many rpc protocols;
- * declared here due to commonality.
- */
-#define MAX_NETOBJ_SZ 1024
-struct netobj {
- u_int n_len;
- char *n_bytes;
-};
-typedef struct netobj netobj;
-extern bool_t xdr_netobj();
-
-/*
- * These are the public routines for the various implementations of
- * xdr streams.
- */
-extern void xdrmem_create(); /* XDR using memory buffers */
-extern void xdrstdio_create(); /* XDR using stdio library */
-extern void xdrrec_create(); /* XDR pseudo records for tcp */
-extern bool_t xdrrec_endofrecord(); /* make end of xdr record */
-extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */
-extern bool_t xdrrec_eof(); /* true if no more input */
-
-#endif !__XDR_HEADER__
diff --git a/lib/librpc/rpc/xdr_array.c b/lib/librpc/rpc/xdr_array.c
deleted file mode 100644
index 7c2831c..0000000
--- a/lib/librpc/rpc/xdr_array.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_array.c, Generic XDR routines impelmentation.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * These are the "non-trivial" xdr primitives used to serialize and de-serialize
- * arrays. See xdr.h for more info on the interface to xdr.
- */
-
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-
-#define LASTUNSIGNED ((u_int)0-1)
-
-
-/*
- * XDR an array of arbitrary elements
- * *addrp is a pointer to the array, *sizep is the number of elements.
- * If addrp is NULL (*sizep * elsize) bytes are allocated.
- * elsize is the size (in bytes) of each element, and elproc is the
- * xdr procedure to call to handle each element of the array.
- */
-bool_t
-xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
- register XDR *xdrs;
- caddr_t *addrp; /* array pointer */
- u_int *sizep; /* number of elements */
- u_int maxsize; /* max numberof elements */
- u_int elsize; /* size in bytes of each element */
- xdrproc_t elproc; /* xdr routine to handle each element */
-{
- register u_int i;
- register caddr_t target = *addrp;
- register u_int c; /* the actual element count */
- register bool_t stat = TRUE;
- register u_int nodesize;
-
- /* like strings, arrays are really counted arrays */
- if (! xdr_u_int(xdrs, sizep)) {
- return (FALSE);
- }
- c = *sizep;
- if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
- return (FALSE);
- }
- nodesize = c * elsize;
-
- /*
- * if we are deserializing, we may need to allocate an array.
- * We also save time by checking for a null array if we are freeing.
- */
- if (target == NULL)
- switch (xdrs->x_op) {
- case XDR_DECODE:
- if (c == 0)
- return (TRUE);
- *addrp = target = mem_alloc(nodesize);
- if (target == NULL) {
- (void) fprintf(stderr,
- "xdr_array: out of memory\n");
- return (FALSE);
- }
- bzero(target, nodesize);
- break;
-
- case XDR_FREE:
- return (TRUE);
- }
-
- /*
- * now we xdr each element of array
- */
- for (i = 0; (i < c) && stat; i++) {
- stat = (*elproc)(xdrs, target, LASTUNSIGNED);
- target += elsize;
- }
-
- /*
- * the array may need freeing
- */
- if (xdrs->x_op == XDR_FREE) {
- mem_free(*addrp, nodesize);
- *addrp = NULL;
- }
- return (stat);
-}
-
-/*
- * xdr_vector():
- *
- * XDR a fixed length array. Unlike variable-length arrays,
- * the storage of fixed length arrays is static and unfreeable.
- * > basep: base of the array
- * > size: size of the array
- * > elemsize: size of each element
- * > xdr_elem: routine to XDR each element
- */
-bool_t
-xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
- register XDR *xdrs;
- register char *basep;
- register u_int nelem;
- register u_int elemsize;
- register xdrproc_t xdr_elem;
-{
- register u_int i;
- register char *elptr;
-
- elptr = basep;
- for (i = 0; i < nelem; i++) {
- if (! (*xdr_elem)(xdrs, elptr, LASTUNSIGNED)) {
- return(FALSE);
- }
- elptr += elemsize;
- }
- return(TRUE);
-}
-
diff --git a/lib/librpc/rpc/xdr_float.c b/lib/librpc/rpc/xdr_float.c
deleted file mode 100644
index 4b5b697..0000000
--- a/lib/librpc/rpc/xdr_float.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/* @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_float.c, Generic XDR routines impelmentation.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * These are the "floating point" xdr routines used to (de)serialize
- * most common data items. See xdr.h for more info on the interface to
- * xdr.
- */
-
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-
-/*
- * NB: Not portable.
- * This routine works on Suns (Sky / 68000's) and Vaxen.
- */
-
-#ifdef vax
-
-/* What IEEE single precision floating point looks like on a Vax */
-struct ieee_single {
- unsigned int mantissa: 23;
- unsigned int exp : 8;
- unsigned int sign : 1;
-};
-
-/* Vax single precision floating point */
-struct vax_single {
- unsigned int mantissa1 : 7;
- unsigned int exp : 8;
- unsigned int sign : 1;
- unsigned int mantissa2 : 16;
-};
-
-#define VAX_SNG_BIAS 0x81
-#define IEEE_SNG_BIAS 0x7f
-
-static struct sgl_limits {
- struct vax_single s;
- struct ieee_single ieee;
-} sgl_limits[2] = {
- {{ 0x7f, 0xff, 0x0, 0xffff }, /* Max Vax */
- { 0x0, 0xff, 0x0 }}, /* Max IEEE */
- {{ 0x0, 0x0, 0x0, 0x0 }, /* Min Vax */
- { 0x0, 0x0, 0x0 }} /* Min IEEE */
-};
-#endif /* vax */
-
-bool_t
-xdr_float(xdrs, fp)
- register XDR *xdrs;
- register float *fp;
-{
-#if !defined(mc68000) && !defined(sparc)
- struct ieee_single is;
- struct vax_single vs, *vsp;
- struct sgl_limits *lim;
- int i;
-#endif
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc)
- return (XDR_PUTLONG(xdrs, (long *)fp));
-#else
- vs = *((struct vax_single *)fp);
- for (i = 0, lim = sgl_limits;
- i < sizeof(sgl_limits)/sizeof(struct sgl_limits);
- i++, lim++) {
- if ((vs.mantissa2 == lim->s.mantissa2) &&
- (vs.exp == lim->s.exp) &&
- (vs.mantissa1 == lim->s.mantissa1)) {
- is = lim->ieee;
- goto shipit;
- }
- }
- is.exp = vs.exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
- is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2;
- shipit:
- is.sign = vs.sign;
- return (XDR_PUTLONG(xdrs, (long *)&is));
-#endif
-
- case XDR_DECODE:
-#if defined(mc68000) || defined(sparc)
- return (XDR_GETLONG(xdrs, (long *)fp));
-#else
- vsp = (struct vax_single *)fp;
- if (!XDR_GETLONG(xdrs, (long *)&is))
- return (FALSE);
- for (i = 0, lim = sgl_limits;
- i < sizeof(sgl_limits)/sizeof(struct sgl_limits);
- i++, lim++) {
- if ((is.exp == lim->ieee.exp) &&
- (is.mantissa == lim->ieee.mantissa)) {
- *vsp = lim->s;
- goto doneit;
- }
- }
- vsp->exp = is.exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
- vsp->mantissa2 = is.mantissa;
- vsp->mantissa1 = (is.mantissa >> 16);
- doneit:
- vsp->sign = is.sign;
- return (TRUE);
-#endif
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * This routine works on Suns (Sky / 68000's) and Vaxen.
- */
-
-#ifdef vax
-/* What IEEE double precision floating point looks like on a Vax */
-struct ieee_double {
- unsigned int mantissa1 : 20;
- unsigned int exp : 11;
- unsigned int sign : 1;
- unsigned int mantissa2 : 32;
-};
-
-/* Vax double precision floating point */
-struct vax_double {
- unsigned int mantissa1 : 7;
- unsigned int exp : 8;
- unsigned int sign : 1;
- unsigned int mantissa2 : 16;
- unsigned int mantissa3 : 16;
- unsigned int mantissa4 : 16;
-};
-
-#define VAX_DBL_BIAS 0x81
-#define IEEE_DBL_BIAS 0x3ff
-#define MASK(nbits) ((1 << nbits) - 1)
-
-static struct dbl_limits {
- struct vax_double d;
- struct ieee_double ieee;
-} dbl_limits[2] = {
- {{ 0x7f, 0xff, 0x0, 0xffff, 0xffff, 0xffff }, /* Max Vax */
- { 0x0, 0x7ff, 0x0, 0x0 }}, /* Max IEEE */
- {{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* Min Vax */
- { 0x0, 0x0, 0x0, 0x0 }} /* Min IEEE */
-};
-
-#endif /* vax */
-
-
-bool_t
-xdr_double(xdrs, dp)
- register XDR *xdrs;
- double *dp;
-{
- register long *lp;
-#if !defined(mc68000) && !defined(sparc)
- struct ieee_double id;
- struct vax_double vd;
- register struct dbl_limits *lim;
- int i;
-#endif
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc)
- lp = (long *)dp;
-#else
- vd = *((struct vax_double *)dp);
- for (i = 0, lim = dbl_limits;
- i < sizeof(dbl_limits)/sizeof(struct dbl_limits);
- i++, lim++) {
- if ((vd.mantissa4 == lim->d.mantissa4) &&
- (vd.mantissa3 == lim->d.mantissa3) &&
- (vd.mantissa2 == lim->d.mantissa2) &&
- (vd.mantissa1 == lim->d.mantissa1) &&
- (vd.exp == lim->d.exp)) {
- id = lim->ieee;
- goto shipit;
- }
- }
- id.exp = vd.exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
- id.mantissa1 = (vd.mantissa1 << 13) | (vd.mantissa2 >> 3);
- id.mantissa2 = ((vd.mantissa2 & MASK(3)) << 29) |
- (vd.mantissa3 << 13) |
- ((vd.mantissa4 >> 3) & MASK(13));
- shipit:
- id.sign = vd.sign;
- lp = (long *)&id;
-#endif
- return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp));
-
- case XDR_DECODE:
-#if defined(mc68000) || defined(sparc)
- lp = (long *)dp;
- return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
-#else
- lp = (long *)&id;
- if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
- return (FALSE);
- for (i = 0, lim = dbl_limits;
- i < sizeof(dbl_limits)/sizeof(struct dbl_limits);
- i++, lim++) {
- if ((id.mantissa2 == lim->ieee.mantissa2) &&
- (id.mantissa1 == lim->ieee.mantissa1) &&
- (id.exp == lim->ieee.exp)) {
- vd = lim->d;
- goto doneit;
- }
- }
- vd.exp = id.exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
- vd.mantissa1 = (id.mantissa1 >> 13);
- vd.mantissa2 = ((id.mantissa1 & MASK(13)) << 3) |
- (id.mantissa2 >> 29);
- vd.mantissa3 = (id.mantissa2 >> 13);
- vd.mantissa4 = (id.mantissa2 << 3);
- doneit:
- vd.sign = id.sign;
- *dp = *((double *)&vd);
- return (TRUE);
-#endif
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
diff --git a/lib/librpc/rpc/xdr_mem.c b/lib/librpc/rpc/xdr_mem.c
deleted file mode 100644
index 558d369..0000000
--- a/lib/librpc/rpc/xdr_mem.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_mem.h, XDR implementation using memory buffers.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * If you have some data to be interpreted as external data representation
- * or to be converted to external data representation in a memory buffer,
- * then this is the package for you.
- *
- */
-
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <netinet/in.h>
-
-static bool_t xdrmem_getlong();
-static bool_t xdrmem_putlong();
-static bool_t xdrmem_getbytes();
-static bool_t xdrmem_putbytes();
-static u_int xdrmem_getpos();
-static bool_t xdrmem_setpos();
-static long * xdrmem_inline();
-static void xdrmem_destroy();
-
-static struct xdr_ops xdrmem_ops = {
- xdrmem_getlong,
- xdrmem_putlong,
- xdrmem_getbytes,
- xdrmem_putbytes,
- xdrmem_getpos,
- xdrmem_setpos,
- xdrmem_inline,
- xdrmem_destroy
-};
-
-/*
- * The procedure xdrmem_create initializes a stream descriptor for a
- * memory buffer.
- */
-void
-xdrmem_create(xdrs, addr, size, op)
- register XDR *xdrs;
- caddr_t addr;
- u_int size;
- enum xdr_op op;
-{
-
- xdrs->x_op = op;
- xdrs->x_ops = &xdrmem_ops;
- xdrs->x_private = xdrs->x_base = addr;
- xdrs->x_handy = size;
-}
-
-static void
-xdrmem_destroy(/*xdrs*/)
- /*XDR *xdrs;*/
-{
-}
-
-static bool_t
-xdrmem_getlong(xdrs, lp)
- register XDR *xdrs;
- long *lp;
-{
-
- if ((xdrs->x_handy -= sizeof(long)) < 0)
- return (FALSE);
- *lp = (long)ntohl((u_long)(*((long *)(xdrs->x_private))));
- xdrs->x_private += sizeof(long);
- return (TRUE);
-}
-
-static bool_t
-xdrmem_putlong(xdrs, lp)
- register XDR *xdrs;
- long *lp;
-{
-
- if ((xdrs->x_handy -= sizeof(long)) < 0)
- return (FALSE);
- *(long *)xdrs->x_private = (long)htonl((u_long)(*lp));
- xdrs->x_private += sizeof(long);
- return (TRUE);
-}
-
-static bool_t
-xdrmem_getbytes(xdrs, addr, len)
- register XDR *xdrs;
- caddr_t addr;
- register u_int len;
-{
-
- if ((xdrs->x_handy -= len) < 0)
- return (FALSE);
- bcopy(xdrs->x_private, addr, len);
- xdrs->x_private += len;
- return (TRUE);
-}
-
-static bool_t
-xdrmem_putbytes(xdrs, addr, len)
- register XDR *xdrs;
- caddr_t addr;
- register u_int len;
-{
-
- if ((xdrs->x_handy -= len) < 0)
- return (FALSE);
- bcopy(addr, xdrs->x_private, len);
- xdrs->x_private += len;
- return (TRUE);
-}
-
-static u_int
-xdrmem_getpos(xdrs)
- register XDR *xdrs;
-{
-
- return ((u_int)xdrs->x_private - (u_int)xdrs->x_base);
-}
-
-static bool_t
-xdrmem_setpos(xdrs, pos)
- register XDR *xdrs;
- u_int pos;
-{
- register caddr_t newaddr = xdrs->x_base + pos;
- register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
-
- if ((long)newaddr > (long)lastaddr)
- return (FALSE);
- xdrs->x_private = newaddr;
- xdrs->x_handy = (int)lastaddr - (int)newaddr;
- return (TRUE);
-}
-
-static long *
-xdrmem_inline(xdrs, len)
- register XDR *xdrs;
- int len;
-{
- long *buf = 0;
-
- if (xdrs->x_handy >= len) {
- xdrs->x_handy -= len;
- buf = (long *) xdrs->x_private;
- xdrs->x_private += len;
- }
- return (buf);
-}
diff --git a/lib/librpc/rpc/xdr_rec.c b/lib/librpc/rpc/xdr_rec.c
deleted file mode 100644
index 6ebea84..0000000
--- a/lib/librpc/rpc/xdr_rec.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/* @(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
- * layer above tcp (for rpc's use).
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * These routines interface XDRSTREAMS to a tcp/ip connection.
- * There is a record marking layer between the xdr stream
- * and the tcp transport level. A record is composed on one or more
- * record fragments. A record fragment is a thirty-two bit header followed
- * by n bytes of data, where n is contained in the header. The header
- * is represented as a htonl(u_long). Thegh order bit encodes
- * whether or not the fragment is the last fragment of the record
- * (1 => fragment is last, 0 => more fragments to follow.
- * The other 31 bits encode the byte length of the fragment.
- */
-
-#include <stdio.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <netinet/in.h>
-#include <unistd.h>
-
-static u_int fix_buf_size();
-static bool_t flush_out();
-static bool_t get_input_bytes();
-static bool_t set_input_fragment();
-static bool_t skip_input_bytes();
-
-static bool_t xdrrec_getlong();
-static bool_t xdrrec_putlong();
-static bool_t xdrrec_getbytes();
-static bool_t xdrrec_putbytes();
-static u_int xdrrec_getpos();
-static bool_t xdrrec_setpos();
-static long * xdrrec_inline();
-static void xdrrec_destroy();
-
-static struct xdr_ops xdrrec_ops = {
- xdrrec_getlong,
- xdrrec_putlong,
- xdrrec_getbytes,
- xdrrec_putbytes,
- xdrrec_getpos,
- xdrrec_setpos,
- xdrrec_inline,
- xdrrec_destroy
-};
-
-/*
- * A record is composed of one or more record fragments.
- * A record fragment is a two-byte header followed by zero to
- * 2**32-1 bytes. The header is treated as a long unsigned and is
- * encode/decoded to the network via htonl/ntohl. The low order 31 bits
- * are a byte count of the fragment. The highest order bit is a boolean:
- * 1 => this fragment is the last fragment of the record,
- * 0 => this fragment is followed by more fragment(s).
- *
- * The fragment/record machinery is not general; it is constructed to
- * meet the needs of xdr and rpc based on tcp.
- */
-
-#define LAST_FRAG ((u_long)(1 << 31))
-
-typedef struct rec_strm {
- caddr_t tcp_handle;
- caddr_t the_buffer;
- /*
- * out-goung bits
- */
- int (*writeit)();
- caddr_t out_base; /* output buffer (points to frag header) */
- caddr_t out_finger; /* next output position */
- caddr_t out_boundry; /* data cannot up to this address */
- u_long *frag_header; /* beginning of curren fragment */
- bool_t frag_sent; /* true if buffer sent in middle of record */
- /*
- * in-coming bits
- */
- int (*readit)();
- u_long in_size; /* fixed size of the input buffer */
- caddr_t in_base;
- caddr_t in_finger; /* location of next byte to be had */
- caddr_t in_boundry; /* can read up to this location */
- long fbtbc; /* fragment bytes to be consumed */
- bool_t last_frag;
- u_int sendsize;
- u_int recvsize;
-} RECSTREAM;
-
-
-/*
- * Create an xdr handle for xdrrec
- * xdrrec_create fills in xdrs. Sendsize and recvsize are
- * send and recv buffer sizes (0 => use default).
- * tcp_handle is an opaque handle that is passed as the first parameter to
- * the procedures readit and writeit. Readit and writeit are read and
- * write respectively. They are like the system
- * calls expect that they take an opaque handle rather than an fd.
- */
-void
-xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
- register XDR *xdrs;
- register u_int sendsize;
- register u_int recvsize;
- caddr_t tcp_handle;
- int (*readit)(); /* like read, but pass it a tcp_handle, not sock */
- int (*writeit)(); /* like write, but pass it a tcp_handle, not sock */
-{
- register RECSTREAM *rstrm =
- (RECSTREAM *)mem_alloc(sizeof(RECSTREAM));
-
- if (rstrm == NULL) {
- (void)fprintf(stderr, "xdrrec_create: out of memory\n");
- /*
- * This is bad. Should rework xdrrec_create to
- * return a handle, and in this case return NULL
- */
- return;
- }
- /*
- * adjust sizes and allocate buffer quad byte aligned
- */
- rstrm->sendsize = sendsize = fix_buf_size(sendsize);
- rstrm->recvsize = recvsize = fix_buf_size(recvsize);
- rstrm->the_buffer = mem_alloc(sendsize + recvsize + BYTES_PER_XDR_UNIT);
- if (rstrm->the_buffer == NULL) {
- (void)fprintf(stderr, "xdrrec_create: out of memory\n");
- return;
- }
- for (rstrm->out_base = rstrm->the_buffer;
- (u_int)rstrm->out_base % BYTES_PER_XDR_UNIT != 0;
- rstrm->out_base++);
- rstrm->in_base = rstrm->out_base + sendsize;
- /*
- * now the rest ...
- */
- xdrs->x_ops = &xdrrec_ops;
- xdrs->x_private = (caddr_t)rstrm;
- rstrm->tcp_handle = tcp_handle;
- rstrm->readit = readit;
- rstrm->writeit = writeit;
- rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
- rstrm->frag_header = (u_long *)rstrm->out_base;
- rstrm->out_finger += sizeof(u_long);
- rstrm->out_boundry += sendsize;
- rstrm->frag_sent = FALSE;
- rstrm->in_size = recvsize;
- rstrm->in_boundry = rstrm->in_base;
- rstrm->in_finger = (rstrm->in_boundry += recvsize);
- rstrm->fbtbc = 0;
- rstrm->last_frag = TRUE;
-}
-
-
-/*
- * The reoutines defined below are the xdr ops which will go into the
- * xdr handle filled in by xdrrec_create.
- */
-
-static bool_t
-xdrrec_getlong(xdrs, lp)
- XDR *xdrs;
- long *lp;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
- register long *buflp = (long *)(rstrm->in_finger);
- long mylong;
-
- /* first try the inline, fast case */
- if ((rstrm->fbtbc >= sizeof(long)) &&
- (((int)rstrm->in_boundry - (int)buflp) >= sizeof(long))) {
- *lp = (long)ntohl((u_long)(*buflp));
- rstrm->fbtbc -= sizeof(long);
- rstrm->in_finger += sizeof(long);
- } else {
- if (! xdrrec_getbytes(xdrs, (caddr_t)&mylong, sizeof(long)))
- return (FALSE);
- *lp = (long)ntohl((u_long)mylong);
- }
- return (TRUE);
-}
-
-static bool_t
-xdrrec_putlong(xdrs, lp)
- XDR *xdrs;
- long *lp;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
- register long *dest_lp = ((long *)(rstrm->out_finger));
-
- if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) {
- /*
- * this case should almost never happen so the code is
- * inefficient
- */
- rstrm->out_finger -= sizeof(long);
- rstrm->frag_sent = TRUE;
- if (! flush_out(rstrm, FALSE))
- return (FALSE);
- dest_lp = ((long *)(rstrm->out_finger));
- rstrm->out_finger += sizeof(long);
- }
- *dest_lp = (long)htonl((u_long)(*lp));
- return (TRUE);
-}
-
-static bool_t /* must manage buffers, fragments, and records */
-xdrrec_getbytes(xdrs, addr, len)
- XDR *xdrs;
- register caddr_t addr;
- register u_int len;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
- register int current;
-
- while (len > 0) {
- current = rstrm->fbtbc;
- if (current == 0) {
- if (rstrm->last_frag)
- return (FALSE);
- if (! set_input_fragment(rstrm))
- return (FALSE);
- continue;
- }
- current = (len < current) ? len : current;
- if (! get_input_bytes(rstrm, addr, current))
- return (FALSE);
- addr += current;
- rstrm->fbtbc -= current;
- len -= current;
- }
- return (TRUE);
-}
-
-static bool_t
-xdrrec_putbytes(xdrs, addr, len)
- XDR *xdrs;
- register caddr_t addr;
- register u_int len;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
- register int current;
-
- while (len > 0) {
- current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger;
- current = (len < current) ? len : current;
- bcopy(addr, rstrm->out_finger, current);
- rstrm->out_finger += current;
- addr += current;
- len -= current;
- if (rstrm->out_finger == rstrm->out_boundry) {
- rstrm->frag_sent = TRUE;
- if (! flush_out(rstrm, FALSE))
- return (FALSE);
- }
- }
- return (TRUE);
-}
-
-static u_int
-xdrrec_getpos(xdrs)
- register XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
- register long pos;
-
- pos = lseek((int)rstrm->tcp_handle, (long) 0, 1);
- if (pos != -1)
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- pos += rstrm->out_finger - rstrm->out_base;
- break;
-
- case XDR_DECODE:
- pos -= rstrm->in_boundry - rstrm->in_finger;
- break;
-
- default:
- pos = (u_int) -1;
- break;
- }
- return ((u_int) pos);
-}
-
-static bool_t
-xdrrec_setpos(xdrs, pos)
- register XDR *xdrs;
- u_int pos;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
- u_int currpos = xdrrec_getpos(xdrs);
- int delta = currpos - pos;
- caddr_t newpos;
-
- if ((int)currpos != -1)
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- newpos = rstrm->out_finger - delta;
- if ((newpos > (caddr_t)(rstrm->frag_header)) &&
- (newpos < rstrm->out_boundry)) {
- rstrm->out_finger = newpos;
- return (TRUE);
- }
- break;
-
- case XDR_DECODE:
- newpos = rstrm->in_finger - delta;
- if ((delta < (int)(rstrm->fbtbc)) &&
- (newpos <= rstrm->in_boundry) &&
- (newpos >= rstrm->in_base)) {
- rstrm->in_finger = newpos;
- rstrm->fbtbc -= delta;
- return (TRUE);
- }
- break;
- }
- return (FALSE);
-}
-
-static long *
-xdrrec_inline(xdrs, len)
- register XDR *xdrs;
- int len;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
- long * buf = NULL;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- if ((rstrm->out_finger + len) <= rstrm->out_boundry) {
- buf = (long *) rstrm->out_finger;
- rstrm->out_finger += len;
- }
- break;
-
- case XDR_DECODE:
- if ((len <= rstrm->fbtbc) &&
- ((rstrm->in_finger + len) <= rstrm->in_boundry)) {
- buf = (long *) rstrm->in_finger;
- rstrm->fbtbc -= len;
- rstrm->in_finger += len;
- }
- break;
- }
- return (buf);
-}
-
-static void
-xdrrec_destroy(xdrs)
- register XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
-
- mem_free(rstrm->the_buffer,
- rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT);
- mem_free((caddr_t)rstrm, sizeof(RECSTREAM));
-}
-
-
-/*
- * Exported routines to manage xdr records
- */
-
-/*
- * Before reading (deserializing from the stream, one should always call
- * this procedure to guarantee proper record alignment.
- */
-bool_t
-xdrrec_skiprecord(xdrs)
- XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
-
- while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
- if (! skip_input_bytes(rstrm, rstrm->fbtbc))
- return (FALSE);
- rstrm->fbtbc = 0;
- if ((! rstrm->last_frag) && (! set_input_fragment(rstrm)))
- return (FALSE);
- }
- rstrm->last_frag = FALSE;
- return (TRUE);
-}
-
-/*
- * Look ahead fuction.
- * Returns TRUE iff there is no more input in the buffer
- * after consuming the rest of the current record.
- */
-bool_t
-xdrrec_eof(xdrs)
- XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
-
- while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
- if (! skip_input_bytes(rstrm, rstrm->fbtbc))
- return (TRUE);
- rstrm->fbtbc = 0;
- if ((! rstrm->last_frag) && (! set_input_fragment(rstrm)))
- return (TRUE);
- }
- if (rstrm->in_finger == rstrm->in_boundry)
- return (TRUE);
- return (FALSE);
-}
-
-/*
- * The client must tell the package when an end-of-record has occurred.
- * The second paraemters tells whether the record should be flushed to the
- * (output) tcp stream. (This let's the package support batched or
- * pipelined procedure calls.) TRUE => immmediate flush to tcp connection.
- */
-bool_t
-xdrrec_endofrecord(xdrs, sendnow)
- XDR *xdrs;
- bool_t sendnow;
-{
- register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
- register u_long len; /* fragment length */
-
- if (sendnow || rstrm->frag_sent ||
- ((u_long)rstrm->out_finger + sizeof(u_long) >=
- (u_long)rstrm->out_boundry)) {
- rstrm->frag_sent = FALSE;
- return (flush_out(rstrm, TRUE));
- }
- len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) -
- sizeof(u_long);
- *(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG);
- rstrm->frag_header = (u_long *)rstrm->out_finger;
- rstrm->out_finger += sizeof(u_long);
- return (TRUE);
-}
-
-
-/*
- * Internal useful routines
- */
-static bool_t
-flush_out(rstrm, eor)
- register RECSTREAM *rstrm;
- bool_t eor;
-{
- register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
- register u_long len = (u_long)(rstrm->out_finger) -
- (u_long)(rstrm->frag_header) - sizeof(u_long);
-
- *(rstrm->frag_header) = htonl(len | eormask);
- len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base);
- if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len)
- != (int)len)
- return (FALSE);
- rstrm->frag_header = (u_long *)rstrm->out_base;
- rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(u_long);
- return (TRUE);
-}
-
-static bool_t /* knows nothing about records! Only about input buffers */
-fill_input_buf(rstrm)
- register RECSTREAM *rstrm;
-{
- register caddr_t where;
- u_int i;
- register int len;
-
- where = rstrm->in_base;
- i = (u_int)rstrm->in_boundry % BYTES_PER_XDR_UNIT;
- where += i;
- len = rstrm->in_size - i;
- if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1)
- return (FALSE);
- rstrm->in_finger = where;
- where += len;
- rstrm->in_boundry = where;
- return (TRUE);
-}
-
-static bool_t /* knows nothing about records! Only about input buffers */
-get_input_bytes(rstrm, addr, len)
- register RECSTREAM *rstrm;
- register caddr_t addr;
- register int len;
-{
- register int current;
-
- while (len > 0) {
- current = (int)rstrm->in_boundry - (int)rstrm->in_finger;
- if (current == 0) {
- if (! fill_input_buf(rstrm))
- return (FALSE);
- continue;
- }
- current = (len < current) ? len : current;
- bcopy(rstrm->in_finger, addr, current);
- rstrm->in_finger += current;
- addr += current;
- len -= current;
- }
- return (TRUE);
-}
-
-static bool_t /* next two bytes of the input stream are treated as a header */
-set_input_fragment(rstrm)
- register RECSTREAM *rstrm;
-{
- u_long header;
-
- if (! get_input_bytes(rstrm, (caddr_t)&header, sizeof(header)))
- return (FALSE);
- header = (long)ntohl(header);
- rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
- rstrm->fbtbc = header & (~LAST_FRAG);
- return (TRUE);
-}
-
-static bool_t /* consumes input bytes; knows nothing about records! */
-skip_input_bytes(rstrm, cnt)
- register RECSTREAM *rstrm;
- long cnt;
-{
- register int current;
-
- while (cnt > 0) {
- current = (int)rstrm->in_boundry - (int)rstrm->in_finger;
- if (current == 0) {
- if (! fill_input_buf(rstrm))
- return (FALSE);
- continue;
- }
- current = (cnt < current) ? cnt : current;
- rstrm->in_finger += current;
- cnt -= current;
- }
- return (TRUE);
-}
-
-static u_int
-fix_buf_size(s)
- register u_int s;
-{
-
- if (s < 100)
- s = 4000;
- return (RNDUP(s));
-}
diff --git a/lib/librpc/rpc/xdr_reference.c b/lib/librpc/rpc/xdr_reference.c
deleted file mode 100644
index 32d91d9..0000000
--- a/lib/librpc/rpc/xdr_reference.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
-#endif
-
-/*
- * xdr_reference.c, Generic XDR routines impelmentation.
- *
- * Copyright (C) 1987, Sun Microsystems, Inc.
- *
- * These are the "non-trivial" xdr primitives used to serialize and de-serialize
- * "pointers". See xdr.h for more info on the interface to xdr.
- */
-
-#include <stdio.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-
-#define LASTUNSIGNED ((u_int)0-1)
-
-/*
- * XDR an indirect pointer
- * xdr_reference is for recursively translating a structure that is
- * referenced by a pointer inside the structure that is currently being
- * translated. pp references a pointer to storage. If *pp is null
- * the necessary storage is allocated.
- * size is the sizeof the referneced structure.
- * proc is the routine to handle the referenced structure.
- */
-bool_t
-xdr_reference(xdrs, pp, size, proc)
- register XDR *xdrs;
- caddr_t *pp; /* the pointer to work on */
- u_int size; /* size of the object pointed to */
- xdrproc_t proc; /* xdr routine to handle the object */
-{
- register caddr_t loc = *pp;
- register bool_t stat;
-
- if (loc == NULL)
- switch (xdrs->x_op) {
- case XDR_FREE:
- return (TRUE);
-
- case XDR_DECODE:
- *pp = loc = (caddr_t) mem_alloc(size);
- if (loc == NULL) {
- (void) fprintf(stderr,
- "xdr_reference: out of memory\n");
- return (FALSE);
- }
- bzero(loc, (int)size);
- break;
- }
-
- stat = (*proc)(xdrs, loc, LASTUNSIGNED);
-
- if (xdrs->x_op == XDR_FREE) {
- mem_free(loc, size);
- *pp = NULL;
- }
- return (stat);
-}
-
-
-/*
- * xdr_pointer():
- *
- * XDR a pointer to a possibly recursive data structure. This
- * differs with xdr_reference in that it can serialize/deserialiaze
- * trees correctly.
- *
- * What's sent is actually a union:
- *
- * union object_pointer switch (boolean b) {
- * case TRUE: object_data data;
- * case FALSE: void nothing;
- * }
- *
- * > objpp: Pointer to the pointer to the object.
- * > obj_size: size of the object.
- * > xdr_obj: routine to XDR an object.
- *
- */
-bool_t
-xdr_pointer(xdrs,objpp,obj_size,xdr_obj)
- register XDR *xdrs;
- char **objpp;
- u_int obj_size;
- xdrproc_t xdr_obj;
-{
-
- bool_t more_data;
-
- more_data = (*objpp != NULL);
- if (! xdr_bool(xdrs,&more_data)) {
- return (FALSE);
- }
- if (! more_data) {
- *objpp = NULL;
- return (TRUE);
- }
- return (xdr_reference(xdrs,objpp,obj_size,xdr_obj));
-}
diff --git a/lib/librpc/rpc/xdr_stdio.c b/lib/librpc/rpc/xdr_stdio.c
deleted file mode 100644
index 694774f..0000000
--- a/lib/librpc/rpc/xdr_stdio.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_stdio.c, XDR implementation on standard i/o file.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * This set of routines implements a XDR on a stdio stream.
- * XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes
- * from the stream.
- */
-
-#include <rpc/types.h>
-#include <stdio.h>
-#include <rpc/xdr.h>
-
-static bool_t xdrstdio_getlong();
-static bool_t xdrstdio_putlong();
-static bool_t xdrstdio_getbytes();
-static bool_t xdrstdio_putbytes();
-static u_int xdrstdio_getpos();
-static bool_t xdrstdio_setpos();
-static long * xdrstdio_inline();
-static void xdrstdio_destroy();
-
-/*
- * Ops vector for stdio type XDR
- */
-static struct xdr_ops xdrstdio_ops = {
- xdrstdio_getlong, /* deseraialize a long int */
- xdrstdio_putlong, /* seraialize a long int */
- xdrstdio_getbytes, /* deserialize counted bytes */
- xdrstdio_putbytes, /* serialize counted bytes */
- xdrstdio_getpos, /* get offset in the stream */
- xdrstdio_setpos, /* set offset in the stream */
- xdrstdio_inline, /* prime stream for inline macros */
- xdrstdio_destroy /* destroy stream */
-};
-
-/*
- * Initialize a stdio xdr stream.
- * Sets the xdr stream handle xdrs for use on the stream file.
- * Operation flag is set to op.
- */
-void
-xdrstdio_create(xdrs, file, op)
- register XDR *xdrs;
- FILE *file;
- enum xdr_op op;
-{
-
- xdrs->x_op = op;
- xdrs->x_ops = &xdrstdio_ops;
- xdrs->x_private = (caddr_t)file;
- xdrs->x_handy = 0;
- xdrs->x_base = 0;
-}
-
-/*
- * Destroy a stdio xdr stream.
- * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
- */
-static void
-xdrstdio_destroy(xdrs)
- register XDR *xdrs;
-{
- (void)fflush((FILE *)xdrs->x_private);
- /* xx should we close the file ?? */
-};
-
-static bool_t
-xdrstdio_getlong(xdrs, lp)
- XDR *xdrs;
- register long *lp;
-{
-
- if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
- return (FALSE);
-#ifndef mc68000
- *lp = ntohl(*lp);
-#endif
- return (TRUE);
-}
-
-static bool_t
-xdrstdio_putlong(xdrs, lp)
- XDR *xdrs;
- long *lp;
-{
-
-#ifndef mc68000
- long mycopy = htonl(*lp);
- lp = &mycopy;
-#endif
- if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
- return (FALSE);
- return (TRUE);
-}
-
-static bool_t
-xdrstdio_getbytes(xdrs, addr, len)
- XDR *xdrs;
- caddr_t addr;
- u_int len;
-{
-
- if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
- return (FALSE);
- return (TRUE);
-}
-
-static bool_t
-xdrstdio_putbytes(xdrs, addr, len)
- XDR *xdrs;
- caddr_t addr;
- u_int len;
-{
-
- if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
- return (FALSE);
- return (TRUE);
-}
-
-static u_int
-xdrstdio_getpos(xdrs)
- XDR *xdrs;
-{
-
- return ((u_int) ftell((FILE *)xdrs->x_private));
-}
-
-static bool_t
-xdrstdio_setpos(xdrs, pos)
- XDR *xdrs;
- u_int pos;
-{
-
- return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
- FALSE : TRUE);
-}
-
-static long *
-xdrstdio_inline(xdrs, len)
- XDR *xdrs;
- u_int len;
-{
-
- /*
- * Must do some work to implement this: must insure
- * enough data in the underlying stdio buffer,
- * that the buffer is aligned so that we can indirect through a
- * long *, and stuff this pointer in xdrs->x_buf. Doing
- * a fread or fwrite to a scratch buffer would defeat
- * most of the gains to be had here and require storage
- * management on this buffer, so we don't do this.
- */
- return (NULL);
-}
diff --git a/lib/librpc/rpcgen/Makefile b/lib/librpc/rpcgen/Makefile
deleted file mode 100644
index f6d15c3..0000000
--- a/lib/librpc/rpcgen/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/01 4.0 RPCSRC
-#
-# Makefile for rpc protocol compiler
-# Copyright (C) 1987, Sun Microsystems, Inc.
-#
-SRCS= rpc_main.c rpc_hout.c rpc_cout.c rpc_parse.c rpc_scan.c rpc_util.c \
- rpc_svcout.c rpc_clntout.c
-HDRS= rpc_util.h rpc_parse.h rpc_scan.h
-OBJS= rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o rpc_scan.o rpc_util.o \
- rpc_svcout.o rpc_clntout.o
-
-GOAL=rpcgen
-CFLAGS = -O
-DESTDIR=
-
-$(GOAL): $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -o $@
-
-install: $(GOAL)
- @echo "Installing the RPC Protocol Compiler"
- install -s $(GOAL) $(DESTDIR)/usr/bin
-
-lint: $(SRCS) $(HDRS)
- lint $(SRCS)
-
-clean:
- rm -f $(GOAL) $(OBJS)
-
-depend: $(SRCS) $(HDRS)
- @${CC} ${CFLAGS} -M ${SRCS} > makedep
- @echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
- @echo '$$r makedep' >>eddep
- @echo 'w' >>eddep
- @cp Makefile makefile.bak
- @ed - Makefile < eddep
- @rm eddep makedep makefile.bak
-
-depend.42BSD depend.42bsd:
- cp /dev/null x.c
- for i in $(SRCS) ; do \
- (/bin/grep '^#[ ]*include' x.c $$i | sed \
- -e '/\.\.\/h/d' \
- -e '/\.\.\/ufs/d' \
- -e 's,<\(.*\)>,"/usr/include/\1",' \
- -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
- -e 's/\.c/\.o/' >>makedep); done
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep x.c
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile
-
-# DO NOT DELETE THIS LINE
-
-
diff --git a/lib/librpc/rpcgen/rpc_clntout.c b/lib/librpc/rpcgen/rpc_clntout.c
deleted file mode 100644
index 555681b..0000000
--- a/lib/librpc/rpcgen/rpc_clntout.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* @(#)rpc_clntout.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_clntout.c 1.2 87/06/24 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_clntout.c, Client-stub outputter for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsytsems, Inc.
- */
-#include <stdio.h>
-#include <strings.h>
-#include "rpc_parse.h"
-#include "rpc_util.h"
-
-#define DEFAULT_TIMEOUT 25 /* in seconds */
-
-void
-write_stubs()
-{
- list *l;
- definition *def;
-
- f_print(fout,
- "\n/* Default timeout can be changed using clnt_control() */\n");
- f_print(fout, "static struct timeval TIMEOUT = { %d, 0 };\n",
- DEFAULT_TIMEOUT);
- for (l = defined; l != NULL; l = l->next) {
- def = (definition *) l->val;
- if (def->def_kind == DEF_PROGRAM) {
- write_program(def);
- }
- }
-}
-
-
-static
-write_program(def)
- definition *def;
-{
- version_list *vp;
- proc_list *proc;
-
- for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
- for (proc = vp->procs; proc != NULL; proc = proc->next) {
- f_print(fout, "\n");
- ptype(proc->res_prefix, proc->res_type, 1);
- f_print(fout, "*\n");
- pvname(proc->proc_name, vp->vers_num);
- f_print(fout, "(argp, clnt)\n");
- f_print(fout, "\t");
- ptype(proc->arg_prefix, proc->arg_type, 1);
- f_print(fout, "*argp;\n");
- f_print(fout, "\tCLIENT *clnt;\n");
- f_print(fout, "{\n");
- printbody(proc);
- f_print(fout, "}\n\n");
- }
- }
-}
-
-static char *
-ampr(type)
- char *type;
-{
- if (isvectordef(type, REL_ALIAS)) {
- return ("");
- } else {
- return ("&");
- }
-}
-
-static
-printbody(proc)
- proc_list *proc;
-{
- f_print(fout, "\tstatic ");
- if (streq(proc->res_type, "void")) {
- f_print(fout, "char ");
- } else {
- ptype(proc->res_prefix, proc->res_type, 0);
- }
- f_print(fout, "res;\n");
- f_print(fout, "\n");
- f_print(fout, "\tbzero((char *)%sres, sizeof(res));\n",
- ampr(proc->res_type));
- f_print(fout,
- "\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n",
- proc->proc_name, stringfix(proc->arg_type),
- stringfix(proc->res_type), ampr(proc->res_type));
- f_print(fout, "\t\treturn (NULL);\n");
- f_print(fout, "\t}\n");
- if (streq(proc->res_type, "void")) {
- f_print(fout, "\treturn ((void *)%sres);\n",
- ampr(proc->res_type));
- } else {
- f_print(fout, "\treturn (%sres);\n", ampr(proc->res_type));
- }
-}
diff --git a/lib/librpc/rpcgen/rpc_cout.c b/lib/librpc/rpcgen/rpc_cout.c
deleted file mode 100644
index 86d3865..0000000
--- a/lib/librpc/rpcgen/rpc_cout.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* @(#)rpc_cout.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_cout.c 1.8 87/06/24 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_cout.c, XDR routine outputter for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-#include <stdio.h>
-#include <strings.h>
-#include "rpc_util.h"
-#include "rpc_parse.h"
-
-/*
- * Emit the C-routine for the given definition
- */
-void
-emit(def)
- definition *def;
-{
- if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
- return;
- }
- print_header(def);
- switch (def->def_kind) {
- case DEF_UNION:
- emit_union(def);
- break;
- case DEF_ENUM:
- emit_enum(def);
- break;
- case DEF_STRUCT:
- emit_struct(def);
- break;
- case DEF_TYPEDEF:
- emit_typedef(def);
- break;
- }
- print_trailer();
-}
-
-static
-findtype(def, type)
- definition *def;
- char *type;
-{
- if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
- return (0);
- } else {
- return (streq(def->def_name, type));
- }
-}
-
-static
-undefined(type)
- char *type;
-{
- definition *def;
-
- def = (definition *) FINDVAL(defined, type, findtype);
- return (def == NULL);
-}
-
-
-static
-print_header(def)
- definition *def;
-{
- space();
- f_print(fout, "bool_t\n");
- f_print(fout, "xdr_%s(xdrs, objp)\n", def->def_name);
- f_print(fout, "\tXDR *xdrs;\n");
- f_print(fout, "\t%s ", def->def_name);
- if (def->def_kind != DEF_TYPEDEF ||
- !isvectordef(def->def.ty.old_type, def->def.ty.rel)) {
- f_print(fout, "*");
- }
- f_print(fout, "objp;\n");
- f_print(fout, "{\n");
-}
-
-static
-print_trailer()
-{
- f_print(fout, "\treturn (TRUE);\n");
- f_print(fout, "}\n");
- space();
-}
-
-
-static
-print_ifopen(indent, name)
- int indent;
- char *name;
-{
- tabify(fout, indent);
- f_print(fout, "if (!xdr_%s(xdrs", name);
-}
-
-
-static
-print_ifarg(arg)
- char *arg;
-{
- f_print(fout, ", %s", arg);
-}
-
-
-static
-print_ifsizeof(prefix, type)
- char *prefix;
- char *type;
-{
- if (streq(type, "bool")) {
- f_print(fout, ", sizeof(bool_t), xdr_bool");
- } else {
- f_print(fout, ", sizeof(");
- if (undefined(type) && prefix) {
- f_print(fout, "%s ", prefix);
- }
- f_print(fout, "%s), xdr_%s", type, type);
- }
-}
-
-static
-print_ifclose(indent)
- int indent;
-{
- f_print(fout, ")) {\n");
- tabify(fout, indent);
- f_print(fout, "\treturn (FALSE);\n");
- tabify(fout, indent);
- f_print(fout, "}\n");
-}
-
-static
-space()
-{
- f_print(fout, "\n\n");
-}
-
-static
-print_ifstat(indent, prefix, type, rel, amax, objname, name)
- int indent;
- char *prefix;
- char *type;
- relation rel;
- char *amax;
- char *objname;
- char *name;
-{
- char *alt = NULL;
-
- switch (rel) {
- case REL_POINTER:
- print_ifopen(indent, "pointer");
- print_ifarg("(char **)");
- f_print(fout, "%s", objname);
- print_ifsizeof(prefix, type);
- break;
- case REL_VECTOR:
- if (streq(type, "string")) {
- alt = "string";
- } else if (streq(type, "opaque")) {
- alt = "opaque";
- }
- if (alt) {
- print_ifopen(indent, alt);
- print_ifarg(objname);
- } else {
- print_ifopen(indent, "vector");
- print_ifarg("(char *)");
- f_print(fout, "%s", objname);
- }
- print_ifarg(amax);
- if (!alt) {
- print_ifsizeof(prefix, type);
- }
- break;
- case REL_ARRAY:
- if (streq(type, "string")) {
- alt = "string";
- } else if (streq(type, "opaque")) {
- alt = "bytes";
- }
- if (streq(type, "string")) {
- print_ifopen(indent, alt);
- print_ifarg(objname);
- } else {
- if (alt) {
- print_ifopen(indent, alt);
- } else {
- print_ifopen(indent, "array");
- }
- print_ifarg("(char **)");
- if (*objname == '&') {
- f_print(fout, "%s.%s_val, (u_int *)%s.%s_len",
- objname, name, objname, name);
- } else {
- f_print(fout, "&%s->%s_val, (u_int *)&%s->%s_len",
- objname, name, objname, name);
- }
- }
- print_ifarg(amax);
- if (!alt) {
- print_ifsizeof(prefix, type);
- }
- break;
- case REL_ALIAS:
- print_ifopen(indent, type);
- print_ifarg(objname);
- break;
- }
- print_ifclose(indent);
-}
-
-
-/* ARGSUSED */
-static
-emit_enum(def)
- definition *def;
-{
- print_ifopen(1, "enum");
- print_ifarg("(enum_t *)objp");
- print_ifclose(1);
-}
-
-
-static
-emit_union(def)
- definition *def;
-{
- declaration *dflt;
- case_list *cl;
- declaration *cs;
- char *object;
- char *format = "&objp->%s_u.%s";
-
- print_stat(&def->def.un.enum_decl);
- f_print(fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);
- for (cl = def->def.un.cases; cl != NULL; cl = cl->next) {
- cs = &cl->case_decl;
- f_print(fout, "\tcase %s:\n", cl->case_name);
- if (!streq(cs->type, "void")) {
- object = alloc(strlen(def->def_name) + strlen(format) +
- strlen(cs->name) + 1);
- s_print(object, format, def->def_name, cs->name);
- print_ifstat(2, cs->prefix, cs->type, cs->rel, cs->array_max,
- object, cs->name);
- free(object);
- }
- f_print(fout, "\t\tbreak;\n");
- }
- dflt = def->def.un.default_decl;
- if (dflt != NULL) {
- if (!streq(dflt->type, "void")) {
- f_print(fout, "\tdefault:\n");
- object = alloc(strlen(def->def_name) + strlen(format) +
- strlen(dflt->name) + 1);
- s_print(object, format, def->def_name, dflt->name);
- print_ifstat(2, dflt->prefix, dflt->type, dflt->rel,
- dflt->array_max, object, dflt->name);
- free(object);
- f_print(fout, "\t\tbreak;\n");
- }
- } else {
- f_print(fout, "\tdefault:\n");
- f_print(fout, "\t\treturn (FALSE);\n");
- }
- f_print(fout, "\t}\n");
-}
-
-
-
-static
-emit_struct(def)
- definition *def;
-{
- decl_list *dl;
-
- for (dl = def->def.st.decls; dl != NULL; dl = dl->next) {
- print_stat(&dl->decl);
- }
-}
-
-
-
-
-static
-emit_typedef(def)
- definition *def;
-{
- char *prefix = def->def.ty.old_prefix;
- char *type = def->def.ty.old_type;
- char *amax = def->def.ty.array_max;
- relation rel = def->def.ty.rel;
-
- print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name);
-}
-
-
-
-
-
-static
-print_stat(dec)
- declaration *dec;
-{
- char *prefix = dec->prefix;
- char *type = dec->type;
- char *amax = dec->array_max;
- relation rel = dec->rel;
- char name[256];
-
- if (isvectordef(type, rel)) {
- s_print(name, "objp->%s", dec->name);
- } else {
- s_print(name, "&objp->%s", dec->name);
- }
- print_ifstat(1, prefix, type, rel, amax, name, dec->name);
-}
diff --git a/lib/librpc/rpcgen/rpc_hout.c b/lib/librpc/rpcgen/rpc_hout.c
deleted file mode 100644
index 1bf0097..0000000
--- a/lib/librpc/rpcgen/rpc_hout.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/* @(#)rpc_hout.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_hout.c 1.6 87/07/28 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_hout.c, Header file outputter for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-#include <stdio.h>
-#include <ctype.h>
-#include "rpc_util.h"
-#include "rpc_parse.h"
-
-
-/*
- * Print the C-version of an xdr definition
- */
-void
-print_datadef(def)
- definition *def;
-{
- if (def->def_kind != DEF_CONST) {
- f_print(fout, "\n");
- }
- switch (def->def_kind) {
- case DEF_STRUCT:
- pstructdef(def);
- break;
- case DEF_UNION:
- puniondef(def);
- break;
- case DEF_ENUM:
- penumdef(def);
- break;
- case DEF_TYPEDEF:
- ptypedef(def);
- break;
- case DEF_PROGRAM:
- pprogramdef(def);
- break;
- case DEF_CONST:
- pconstdef(def);
- break;
- }
- if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
- f_print(fout, "bool_t xdr_%s();\n", def->def_name);
- }
- if (def->def_kind != DEF_CONST) {
- f_print(fout, "\n");
- }
-}
-
-static
-pconstdef(def)
- definition *def;
-{
- pdefine(def->def_name, def->def.co);
-}
-
-static
-pstructdef(def)
- definition *def;
-{
- decl_list *l;
- char *name = def->def_name;
-
- f_print(fout, "struct %s {\n", name);
- for (l = def->def.st.decls; l != NULL; l = l->next) {
- pdeclaration(name, &l->decl, 1);
- }
- f_print(fout, "};\n");
- f_print(fout, "typedef struct %s %s;\n", name, name);
-}
-
-static
-puniondef(def)
- definition *def;
-{
- case_list *l;
- char *name = def->def_name;
- declaration *decl;
-
- f_print(fout, "struct %s {\n", name);
- decl = &def->def.un.enum_decl;
- if (streq(decl->type, "bool")) {
- f_print(fout, "\tbool_t %s;\n", decl->name);
- } else {
- f_print(fout, "\t%s %s;\n", decl->type, decl->name);
- }
- f_print(fout, "\tunion {\n");
- for (l = def->def.un.cases; l != NULL; l = l->next) {
- pdeclaration(name, &l->case_decl, 2);
- }
- decl = def->def.un.default_decl;
- if (decl && !streq(decl->type, "void")) {
- pdeclaration(name, decl, 2);
- }
- f_print(fout, "\t} %s_u;\n", name);
- f_print(fout, "};\n");
- f_print(fout, "typedef struct %s %s;\n", name, name);
-}
-
-
-
-static
-pdefine(name, num)
- char *name;
- char *num;
-{
- f_print(fout, "#define %s %s\n", name, num);
-}
-
-static
-puldefine(name, num)
- char *name;
- char *num;
-{
- f_print(fout, "#define %s ((u_long)%s)\n", name, num);
-}
-
-static
-define_printed(stop, start)
- proc_list *stop;
- version_list *start;
-{
- version_list *vers;
- proc_list *proc;
-
- for (vers = start; vers != NULL; vers = vers->next) {
- for (proc = vers->procs; proc != NULL; proc = proc->next) {
- if (proc == stop) {
- return (0);
- } else if (streq(proc->proc_name, stop->proc_name)) {
- return (1);
- }
- }
- }
- abort();
- /* NOTREACHED */
-}
-
-
-static
-pprogramdef(def)
- definition *def;
-{
- version_list *vers;
- proc_list *proc;
-
- puldefine(def->def_name, def->def.pr.prog_num);
- for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
- puldefine(vers->vers_name, vers->vers_num);
- for (proc = vers->procs; proc != NULL; proc = proc->next) {
- if (!define_printed(proc, def->def.pr.versions)) {
- puldefine(proc->proc_name, proc->proc_num);
- }
- pprocdef(proc, vers);
- }
- }
-}
-
-
-pprocdef(proc, vp)
- proc_list *proc;
- version_list *vp;
-{
- f_print(fout, "extern ");
- if (proc->res_prefix) {
- if (streq(proc->res_prefix, "enum")) {
- f_print(fout, "enum ");
- } else {
- f_print(fout, "struct ");
- }
- }
- if (streq(proc->res_type, "bool")) {
- f_print(fout, "bool_t *");
- } else if (streq(proc->res_type, "string")) {
- f_print(fout, "char **");
- } else {
- f_print(fout, "%s *", fixtype(proc->res_type));
- }
- pvname(proc->proc_name, vp->vers_num);
- f_print(fout, "();\n");
-}
-
-static
-penumdef(def)
- definition *def;
-{
- char *name = def->def_name;
- enumval_list *l;
- char *last = NULL;
- int count = 0;
-
- f_print(fout, "enum %s {\n", name);
- for (l = def->def.en.vals; l != NULL; l = l->next) {
- f_print(fout, "\t%s", l->name);
- if (l->assignment) {
- f_print(fout, " = %s", l->assignment);
- last = l->assignment;
- count = 1;
- } else {
- if (last == NULL) {
- f_print(fout, " = %d", count++);
- } else {
- f_print(fout, " = %s + %d", last, count++);
- }
- }
- f_print(fout, ",\n");
- }
- f_print(fout, "};\n");
- f_print(fout, "typedef enum %s %s;\n", name, name);
-}
-
-static
-ptypedef(def)
- definition *def;
-{
- char *name = def->def_name;
- char *old = def->def.ty.old_type;
- char prefix[8]; /* enough to contain "struct ", including NUL */
- relation rel = def->def.ty.rel;
-
-
- if (!streq(name, old)) {
- if (streq(old, "string")) {
- old = "char";
- rel = REL_POINTER;
- } else if (streq(old, "opaque")) {
- old = "char";
- } else if (streq(old, "bool")) {
- old = "bool_t";
- }
- if (undefined2(old, name) && def->def.ty.old_prefix) {
- s_print(prefix, "%s ", def->def.ty.old_prefix);
- } else {
- prefix[0] = 0;
- }
- f_print(fout, "typedef ");
- switch (rel) {
- case REL_ARRAY:
- f_print(fout, "struct {\n");
- f_print(fout, "\tu_int %s_len;\n", name);
- f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
- f_print(fout, "} %s", name);
- break;
- case REL_POINTER:
- f_print(fout, "%s%s *%s", prefix, old, name);
- break;
- case REL_VECTOR:
- f_print(fout, "%s%s %s[%s]", prefix, old, name,
- def->def.ty.array_max);
- break;
- case REL_ALIAS:
- f_print(fout, "%s%s %s", prefix, old, name);
- break;
- }
- f_print(fout, ";\n");
- }
-}
-
-
-static
-pdeclaration(name, dec, tab)
- char *name;
- declaration *dec;
- int tab;
-{
- char buf[8]; /* enough to hold "struct ", include NUL */
- char *prefix;
- char *type;
-
- if (streq(dec->type, "void")) {
- return;
- }
- tabify(fout, tab);
- if (streq(dec->type, name) && !dec->prefix) {
- f_print(fout, "struct ");
- }
- if (streq(dec->type, "string")) {
- f_print(fout, "char *%s", dec->name);
- } else {
- prefix = "";
- if (streq(dec->type, "bool")) {
- type = "bool_t";
- } else if (streq(dec->type, "opaque")) {
- type = "char";
- } else {
- if (dec->prefix) {
- s_print(buf, "%s ", dec->prefix);
- prefix = buf;
- }
- type = dec->type;
- }
- switch (dec->rel) {
- case REL_ALIAS:
- f_print(fout, "%s%s %s", prefix, type, dec->name);
- break;
- case REL_VECTOR:
- f_print(fout, "%s%s %s[%s]", prefix, type, dec->name,
- dec->array_max);
- break;
- case REL_POINTER:
- f_print(fout, "%s%s *%s", prefix, type, dec->name);
- break;
- case REL_ARRAY:
- f_print(fout, "struct {\n");
- tabify(fout, tab);
- f_print(fout, "\tu_int %s_len;\n", dec->name);
- tabify(fout, tab);
- f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
- tabify(fout, tab);
- f_print(fout, "} %s", dec->name);
- break;
- }
- }
- f_print(fout, ";\n");
-}
-
-
-
-static
-undefined2(type, stop)
- char *type;
- char *stop;
-{
- list *l;
- definition *def;
-
- for (l = defined; l != NULL; l = l->next) {
- def = (definition *) l->val;
- if (def->def_kind != DEF_PROGRAM) {
- if (streq(def->def_name, stop)) {
- return (1);
- } else if (streq(def->def_name, type)) {
- return (0);
- }
- }
- }
- return (1);
-}
diff --git a/lib/librpc/rpcgen/rpc_main.c b/lib/librpc/rpcgen/rpc_main.c
deleted file mode 100644
index 795bf2a..0000000
--- a/lib/librpc/rpcgen/rpc_main.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* @(#)rpc_main.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_main.c 1.7 87/06/24 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_main.c, Top level of the RPC protocol compiler.
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <strings.h>
-#include <sys/file.h>
-#include "rpc_util.h"
-#include "rpc_parse.h"
-#include "rpc_scan.h"
-
-#define EXTEND 1 /* alias for TRUE */
-
-struct commandline {
- int cflag;
- int hflag;
- int lflag;
- int sflag;
- int mflag;
- char *infile;
- char *outfile;
-};
-
-static char *cmdname;
-static char CPP[] = "/lib/cpp";
-static char CPPFLAGS[] = "-C";
-static char *allv[] = {
- "rpcgen", "-s", "udp", "-s", "tcp",
-};
-static int allc = sizeof(allv)/sizeof(allv[0]);
-
-main(argc, argv)
- int argc;
- char *argv[];
-
-{
- struct commandline cmd;
-
- if (!parseargs(argc, argv, &cmd)) {
- f_print(stderr,
- "usage: %s infile\n", cmdname);
- f_print(stderr,
- " %s [-c | -h | -l | -m] [-o outfile] [infile]\n",
- cmdname);
- f_print(stderr,
- " %s [-s udp|tcp]* [-o outfile] [infile]\n",
- cmdname);
- exit(1);
- }
- if (cmd.cflag) {
- c_output(cmd.infile, "-DRPC_XDR", !EXTEND, cmd.outfile);
- } else if (cmd.hflag) {
- h_output(cmd.infile, "-DRPC_HDR", !EXTEND, cmd.outfile);
- } else if (cmd.lflag) {
- l_output(cmd.infile, "-DRPC_CLNT", !EXTEND, cmd.outfile);
- } else if (cmd.sflag || cmd.mflag) {
- s_output(argc, argv, cmd.infile, "-DRPC_SVC", !EXTEND,
- cmd.outfile, cmd.mflag);
- } else {
- c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c");
- reinitialize();
- h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h");
- reinitialize();
- l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c");
- reinitialize();
- s_output(allc, allv, cmd.infile, "-DRPC_SVC", EXTEND,
- "_svc.c", cmd.mflag);
- }
- exit(0);
-}
-
-/*
- * add extension to filename
- */
-static char *
-extendfile(file, ext)
- char *file;
- char *ext;
-{
- char *res;
- char *p;
-
- res = alloc(strlen(file) + strlen(ext) + 1);
- if (res == NULL) {
- abort();
- }
- p = rindex(file, '.');
- if (p == NULL) {
- p = file + strlen(file);
- }
- (void) strcpy(res, file);
- (void) strcpy(res + (p - file), ext);
- return (res);
-}
-
-/*
- * Open output file with given extension
- */
-static
-open_output(infile, outfile)
- char *infile;
- char *outfile;
-{
- if (outfile == NULL) {
- fout = stdout;
- return;
- }
- if (infile != NULL && streq(outfile, infile)) {
- f_print(stderr, "%s: output would overwrite %s\n", cmdname,
- infile);
- crash();
- }
- fout = fopen(outfile, "w");
- if (fout == NULL) {
- f_print(stderr, "%s: unable to open ", cmdname);
- perror(outfile);
- crash();
- }
- record_open(outfile);
-}
-
-/*
- * Open input file with given define for C-preprocessor
- */
-static
-open_input(infile, define)
- char *infile;
- char *define;
-{
- int pd[2];
-
- infilename = (infile == NULL) ? "<stdin>" : infile;
- (void) pipe(pd);
- switch (fork()) {
- case 0:
- (void) close(1);
- (void) dup2(pd[1], 1);
- (void) close(pd[0]);
- execl(CPP, CPP, CPPFLAGS, define, infile, NULL);
- perror("execl");
- exit(1);
- case -1:
- perror("fork");
- exit(1);
- }
- (void) close(pd[1]);
- fin = fdopen(pd[0], "r");
- if (fin == NULL) {
- f_print(stderr, "%s: ", cmdname);
- perror(infilename);
- crash();
- }
-}
-
-/*
- * Compile into an XDR routine output file
- */
-static
-c_output(infile, define, extend, outfile)
- char *infile;
- char *define;
- int extend;
- char *outfile;
-{
- definition *def;
- char *include;
- char *outfilename;
- long tell;
-
- open_input(infile, define);
- outfilename = extend ? extendfile(infile, outfile) : outfile;
- open_output(infile, outfilename);
- f_print(fout, "#include <rpc/rpc.h>\n");
- if (infile && (include = extendfile(infile, ".h"))) {
- f_print(fout, "#include \"%s\"\n", include);
- free(include);
- }
- tell = ftell(fout);
- while (def = get_definition()) {
- emit(def);
- }
- if (extend && tell == ftell(fout)) {
- (void) unlink(outfilename);
- }
-}
-
-/*
- * Compile into an XDR header file
- */
-static
-h_output(infile, define, extend, outfile)
- char *infile;
- char *define;
- int extend;
- char *outfile;
-{
- definition *def;
- char *outfilename;
- long tell;
-
- open_input(infile, define);
- outfilename = extend ? extendfile(infile, outfile) : outfile;
- open_output(infile, outfilename);
- tell = ftell(fout);
- while (def = get_definition()) {
- print_datadef(def);
- }
- if (extend && tell == ftell(fout)) {
- (void) unlink(outfilename);
- }
-}
-
-/*
- * Compile into an RPC service
- */
-static
-s_output(argc, argv, infile, define, extend, outfile, nomain)
- int argc;
- char *argv[];
- char *infile;
- char *define;
- int extend;
- char *outfile;
- int nomain;
-{
- char *include;
- definition *def;
- int foundprogram;
- char *outfilename;
-
- open_input(infile, define);
- outfilename = extend ? extendfile(infile, outfile) : outfile;
- open_output(infile, outfilename);
- f_print(fout, "#include <stdio.h>\n");
- f_print(fout, "#include <rpc/rpc.h>\n");
- if (infile && (include = extendfile(infile, ".h"))) {
- f_print(fout, "#include \"%s\"\n", include);
- free(include);
- }
- foundprogram = 0;
- while (def = get_definition()) {
- foundprogram |= (def->def_kind == DEF_PROGRAM);
- }
- if (extend && !foundprogram) {
- (void) unlink(outfilename);
- return;
- }
- if (nomain) {
- write_programs((char *)NULL);
- } else {
- write_most();
- do_registers(argc, argv);
- write_rest();
- write_programs("static");
- }
-}
-
-static
-l_output(infile, define, extend, outfile)
- char *infile;
- char *define;
- int extend;
- char *outfile;
-{
- char *include;
- definition *def;
- int foundprogram;
- char *outfilename;
-
- open_input(infile, define);
- outfilename = extend ? extendfile(infile, outfile) : outfile;
- open_output(infile, outfilename);
- f_print(fout, "#include <rpc/rpc.h>\n");
- if (infile && (include = extendfile(infile, ".h"))) {
- f_print(fout, "#include \"%s\"\n", include);
- free(include);
- }
- foundprogram = 0;
- while (def = get_definition()) {
- foundprogram |= (def->def_kind == DEF_PROGRAM);
- }
- if (extend && !foundprogram) {
- (void) unlink(outfilename);
- return;
- }
- write_stubs();
-}
-
-/*
- * Perform registrations for service output
- */
-static
-do_registers(argc, argv)
- int argc;
- char *argv[];
-
-{
- int i;
-
- for (i = 1; i < argc; i++) {
- if (streq(argv[i], "-s")) {
- write_register(argv[i + 1]);
- i++;
- }
- }
-}
-
-/*
- * Parse command line arguments
- */
-static
-parseargs(argc, argv, cmd)
- int argc;
- char *argv[];
- struct commandline *cmd;
-
-{
- int i;
- int j;
- char c;
- char flag[(1 << 8 * sizeof(char))];
- int nflags;
-
- cmdname = argv[0];
- cmd->infile = cmd->outfile = NULL;
- if (argc < 2) {
- return (0);
- }
- flag['c'] = 0;
- flag['h'] = 0;
- flag['s'] = 0;
- flag['o'] = 0;
- flag['l'] = 0;
- flag['m'] = 0;
- for (i = 1; i < argc; i++) {
- if (argv[i][0] != '-') {
- if (cmd->infile) {
- return (0);
- }
- cmd->infile = argv[i];
- } else {
- for (j = 1; argv[i][j] != 0; j++) {
- c = argv[i][j];
- switch (c) {
- case 'c':
- case 'h':
- case 'l':
- case 'm':
- if (flag[c]) {
- return (0);
- }
- flag[c] = 1;
- break;
- case 'o':
- case 's':
- if (argv[i][j - 1] != '-' ||
- argv[i][j + 1] != 0) {
- return (0);
- }
- flag[c] = 1;
- if (++i == argc) {
- return (0);
- }
- if (c == 's') {
- if (!streq(argv[i], "udp") &&
- !streq(argv[i], "tcp")) {
- return (0);
- }
- } else if (c == 'o') {
- if (cmd->outfile) {
- return (0);
- }
- cmd->outfile = argv[i];
- }
- goto nextarg;
-
- default:
- return (0);
- }
- }
- nextarg:
- ;
- }
- }
- cmd->cflag = flag['c'];
- cmd->hflag = flag['h'];
- cmd->sflag = flag['s'];
- cmd->lflag = flag['l'];
- cmd->mflag = flag['m'];
- nflags = cmd->cflag + cmd->hflag + cmd->sflag + cmd->lflag + cmd->mflag;
- if (nflags == 0) {
- if (cmd->outfile != NULL || cmd->infile == NULL) {
- return (0);
- }
- } else if (nflags > 1) {
- return (0);
- }
- return (1);
-}
diff --git a/lib/librpc/rpcgen/rpc_parse.c b/lib/librpc/rpcgen/rpc_parse.c
deleted file mode 100644
index 9e4663f..0000000
--- a/lib/librpc/rpcgen/rpc_parse.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/* @(#)rpc_parse.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_parse.c 1.4 87/04/28 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_parse.c, Parser for the RPC protocol compiler
- * Copyright (C) 1987 Sun Microsystems, Inc.
- */
-#include <stdio.h>
-#include "rpc_util.h"
-#include "rpc_scan.h"
-#include "rpc_parse.h"
-
-/*
- * return the next definition you see
- */
-definition *
-get_definition()
-{
- definition *defp;
- token tok;
-
- defp = ALLOC(definition);
- get_token(&tok);
- switch (tok.kind) {
- case TOK_STRUCT:
- def_struct(defp);
- break;
- case TOK_UNION:
- def_union(defp);
- break;
- case TOK_TYPEDEF:
- def_typedef(defp);
- break;
- case TOK_ENUM:
- def_enum(defp);
- break;
- case TOK_PROGRAM:
- def_program(defp);
- break;
- case TOK_CONST:
- def_const(defp);
- break;
- case TOK_EOF:
- return (NULL);
- break;
- default:
- error("definition keyword expected");
- }
- scan(TOK_SEMICOLON, &tok);
- isdefined(defp);
- return (defp);
-}
-
-static
-isdefined(defp)
- definition *defp;
-{
- STOREVAL(&defined, defp);
-}
-
-
-static
-def_struct(defp)
- definition *defp;
-{
- token tok;
- declaration dec;
- decl_list *decls;
- decl_list **tailp;
-
- defp->def_kind = DEF_STRUCT;
-
- scan(TOK_IDENT, &tok);
- defp->def_name = tok.str;
- scan(TOK_LBRACE, &tok);
- tailp = &defp->def.st.decls;
- do {
- get_declaration(&dec, DEF_STRUCT);
- decls = ALLOC(decl_list);
- decls->decl = dec;
- *tailp = decls;
- tailp = &decls->next;
- scan(TOK_SEMICOLON, &tok);
- peek(&tok);
- } while (tok.kind != TOK_RBRACE);
- get_token(&tok);
- *tailp = NULL;
-}
-
-static
-def_program(defp)
- definition *defp;
-{
- token tok;
- version_list *vlist;
- version_list **vtailp;
- proc_list *plist;
- proc_list **ptailp;
-
- defp->def_kind = DEF_PROGRAM;
- scan(TOK_IDENT, &tok);
- defp->def_name = tok.str;
- scan(TOK_LBRACE, &tok);
- vtailp = &defp->def.pr.versions;
- scan(TOK_VERSION, &tok);
- do {
- scan(TOK_IDENT, &tok);
- vlist = ALLOC(version_list);
- vlist->vers_name = tok.str;
- scan(TOK_LBRACE, &tok);
- ptailp = &vlist->procs;
- do {
- plist = ALLOC(proc_list);
- get_type(&plist->res_prefix, &plist->res_type, DEF_PROGRAM);
- if (streq(plist->res_type, "opaque")) {
- error("illegal result type");
- }
- scan(TOK_IDENT, &tok);
- plist->proc_name = tok.str;
- scan(TOK_LPAREN, &tok);
- get_type(&plist->arg_prefix, &plist->arg_type, DEF_PROGRAM);
- if (streq(plist->arg_type, "opaque")) {
- error("illegal argument type");
- }
- scan(TOK_RPAREN, &tok);
- scan(TOK_EQUAL, &tok);
- scan_num(&tok);
- scan(TOK_SEMICOLON, &tok);
- plist->proc_num = tok.str;
- *ptailp = plist;
- ptailp = &plist->next;
- peek(&tok);
- } while (tok.kind != TOK_RBRACE);
- *vtailp = vlist;
- vtailp = &vlist->next;
- scan(TOK_RBRACE, &tok);
- scan(TOK_EQUAL, &tok);
- scan_num(&tok);
- vlist->vers_num = tok.str;
- scan(TOK_SEMICOLON, &tok);
- scan2(TOK_VERSION, TOK_RBRACE, &tok);
- } while (tok.kind == TOK_VERSION);
- scan(TOK_EQUAL, &tok);
- scan_num(&tok);
- defp->def.pr.prog_num = tok.str;
- *vtailp = NULL;
-}
-
-static
-def_enum(defp)
- definition *defp;
-{
- token tok;
- enumval_list *elist;
- enumval_list **tailp;
-
- defp->def_kind = DEF_ENUM;
- scan(TOK_IDENT, &tok);
- defp->def_name = tok.str;
- scan(TOK_LBRACE, &tok);
- tailp = &defp->def.en.vals;
- do {
- scan(TOK_IDENT, &tok);
- elist = ALLOC(enumval_list);
- elist->name = tok.str;
- elist->assignment = NULL;
- scan3(TOK_COMMA, TOK_RBRACE, TOK_EQUAL, &tok);
- if (tok.kind == TOK_EQUAL) {
- scan_num(&tok);
- elist->assignment = tok.str;
- scan2(TOK_COMMA, TOK_RBRACE, &tok);
- }
- *tailp = elist;
- tailp = &elist->next;
- } while (tok.kind != TOK_RBRACE);
- *tailp = NULL;
-}
-
-static
-def_const(defp)
- definition *defp;
-{
- token tok;
-
- defp->def_kind = DEF_CONST;
- scan(TOK_IDENT, &tok);
- defp->def_name = tok.str;
- scan(TOK_EQUAL, &tok);
- scan2(TOK_IDENT, TOK_STRCONST, &tok);
- defp->def.co = tok.str;
-}
-
-static
-def_union(defp)
- definition *defp;
-{
- token tok;
- declaration dec;
- case_list *cases;
- case_list **tailp;
-
- defp->def_kind = DEF_UNION;
- scan(TOK_IDENT, &tok);
- defp->def_name = tok.str;
- scan(TOK_SWITCH, &tok);
- scan(TOK_LPAREN, &tok);
- get_declaration(&dec, DEF_UNION);
- defp->def.un.enum_decl = dec;
- tailp = &defp->def.un.cases;
- scan(TOK_RPAREN, &tok);
- scan(TOK_LBRACE, &tok);
- scan(TOK_CASE, &tok);
- while (tok.kind == TOK_CASE) {
- scan(TOK_IDENT, &tok);
- cases = ALLOC(case_list);
- cases->case_name = tok.str;
- scan(TOK_COLON, &tok);
- get_declaration(&dec, DEF_UNION);
- cases->case_decl = dec;
- *tailp = cases;
- tailp = &cases->next;
- scan(TOK_SEMICOLON, &tok);
- scan3(TOK_CASE, TOK_DEFAULT, TOK_RBRACE, &tok);
- }
- *tailp = NULL;
- if (tok.kind == TOK_DEFAULT) {
- scan(TOK_COLON, &tok);
- get_declaration(&dec, DEF_UNION);
- defp->def.un.default_decl = ALLOC(declaration);
- *defp->def.un.default_decl = dec;
- scan(TOK_SEMICOLON, &tok);
- scan(TOK_RBRACE, &tok);
- } else {
- defp->def.un.default_decl = NULL;
- }
-}
-
-
-static
-def_typedef(defp)
- definition *defp;
-{
- declaration dec;
-
- defp->def_kind = DEF_TYPEDEF;
- get_declaration(&dec, DEF_TYPEDEF);
- defp->def_name = dec.name;
- defp->def.ty.old_prefix = dec.prefix;
- defp->def.ty.old_type = dec.type;
- defp->def.ty.rel = dec.rel;
- defp->def.ty.array_max = dec.array_max;
-}
-
-
-static
-get_declaration(dec, dkind)
- declaration *dec;
- defkind dkind;
-{
- token tok;
-
- get_type(&dec->prefix, &dec->type, dkind);
- dec->rel = REL_ALIAS;
- if (streq(dec->type, "void")) {
- return;
- }
- scan2(TOK_STAR, TOK_IDENT, &tok);
- if (tok.kind == TOK_STAR) {
- dec->rel = REL_POINTER;
- scan(TOK_IDENT, &tok);
- }
- dec->name = tok.str;
- if (peekscan(TOK_LBRACKET, &tok)) {
- if (dec->rel == REL_POINTER) {
- error("no array-of-pointer declarations -- use typedef");
- }
- dec->rel = REL_VECTOR;
- scan_num(&tok);
- dec->array_max = tok.str;
- scan(TOK_RBRACKET, &tok);
- } else if (peekscan(TOK_LANGLE, &tok)) {
- if (dec->rel == REL_POINTER) {
- error("no array-of-pointer declarations -- use typedef");
- }
- dec->rel = REL_ARRAY;
- if (peekscan(TOK_RANGLE, &tok)) {
- dec->array_max = "~0"; /* unspecified size, use max */
- } else {
- scan_num(&tok);
- dec->array_max = tok.str;
- scan(TOK_RANGLE, &tok);
- }
- }
- if (streq(dec->type, "opaque")) {
- if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR) {
- error("array declaration expected");
- }
- } else if (streq(dec->type, "string")) {
- if (dec->rel != REL_ARRAY) {
- error("variable-length array declaration expected");
- }
- }
-}
-
-
-static
-get_type(prefixp, typep, dkind)
- char **prefixp;
- char **typep;
- defkind dkind;
-{
- token tok;
-
- *prefixp = NULL;
- get_token(&tok);
- switch (tok.kind) {
- case TOK_IDENT:
- *typep = tok.str;
- break;
- case TOK_STRUCT:
- case TOK_ENUM:
- case TOK_UNION:
- *prefixp = tok.str;
- scan(TOK_IDENT, &tok);
- *typep = tok.str;
- break;
- case TOK_UNSIGNED:
- unsigned_dec(typep);
- break;
- case TOK_SHORT:
- *typep = "short";
- (void) peekscan(TOK_INT, &tok);
- break;
- case TOK_LONG:
- *typep = "long";
- (void) peekscan(TOK_INT, &tok);
- break;
- case TOK_VOID:
- if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
- error("voids allowed only inside union and program definitions");
- }
- *typep = tok.str;
- break;
- case TOK_STRING:
- case TOK_OPAQUE:
- case TOK_CHAR:
- case TOK_INT:
- case TOK_FLOAT:
- case TOK_DOUBLE:
- case TOK_BOOL:
- *typep = tok.str;
- break;
- default:
- error("expected type specifier");
- }
-}
-
-
-static
-unsigned_dec(typep)
- char **typep;
-{
- token tok;
-
- peek(&tok);
- switch (tok.kind) {
- case TOK_CHAR:
- get_token(&tok);
- *typep = "u_char";
- break;
- case TOK_SHORT:
- get_token(&tok);
- *typep = "u_short";
- (void) peekscan(TOK_INT, &tok);
- break;
- case TOK_LONG:
- get_token(&tok);
- *typep = "u_long";
- (void) peekscan(TOK_INT, &tok);
- break;
- case TOK_INT:
- get_token(&tok);
- *typep = "u_int";
- break;
- default:
- *typep = "u_int";
- break;
- }
-}
diff --git a/lib/librpc/rpcgen/rpc_parse.h b/lib/librpc/rpcgen/rpc_parse.h
deleted file mode 100644
index b53cc56..0000000
--- a/lib/librpc/rpcgen/rpc_parse.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)rpc_parse.h 1.3 87/03/09 (C) 1987 SMI */
-
-/*
- * rpc_parse.h, Definitions for the RPCL parser
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-
-enum defkind {
- DEF_CONST,
- DEF_STRUCT,
- DEF_UNION,
- DEF_ENUM,
- DEF_TYPEDEF,
- DEF_PROGRAM
-};
-typedef enum defkind defkind;
-
-typedef char *const_def;
-
-enum relation {
- REL_VECTOR, /* fixed length array */
- REL_ARRAY, /* variable length array */
- REL_POINTER, /* pointer */
- REL_ALIAS, /* simple */
-};
-typedef enum relation relation;
-
-struct typedef_def {
- char *old_prefix;
- char *old_type;
- relation rel;
- char *array_max;
-};
-typedef struct typedef_def typedef_def;
-
-
-struct enumval_list {
- char *name;
- char *assignment;
- struct enumval_list *next;
-};
-typedef struct enumval_list enumval_list;
-
-struct enum_def {
- enumval_list *vals;
-};
-typedef struct enum_def enum_def;
-
-
-struct declaration {
- char *prefix;
- char *type;
- char *name;
- relation rel;
- char *array_max;
-};
-typedef struct declaration declaration;
-
-
-struct decl_list {
- declaration decl;
- struct decl_list *next;
-};
-typedef struct decl_list decl_list;
-
-struct struct_def {
- decl_list *decls;
-};
-typedef struct struct_def struct_def;
-
-
-struct case_list {
- char *case_name;
- declaration case_decl;
- struct case_list *next;
-};
-typedef struct case_list case_list;
-
-struct union_def {
- declaration enum_decl;
- case_list *cases;
- declaration *default_decl;
-};
-typedef struct union_def union_def;
-
-
-
-struct proc_list {
- char *proc_name;
- char *proc_num;
- char *arg_type;
- char *arg_prefix;
- char *res_type;
- char *res_prefix;
- struct proc_list *next;
-};
-typedef struct proc_list proc_list;
-
-
-struct version_list {
- char *vers_name;
- char *vers_num;
- proc_list *procs;
- struct version_list *next;
-};
-typedef struct version_list version_list;
-
-struct program_def {
- char *prog_num;
- version_list *versions;
-};
-typedef struct program_def program_def;
-
-struct definition {
- char *def_name;
- defkind def_kind;
- union {
- const_def co;
- struct_def st;
- union_def un;
- enum_def en;
- typedef_def ty;
- program_def pr;
- } def;
-};
-typedef struct definition definition;
-
-/* @(#)rpc_parse.h 2.1 88/08/01 4.0 RPCSRC */
-definition *get_definition();
diff --git a/lib/librpc/rpcgen/rpc_scan.c b/lib/librpc/rpcgen/rpc_scan.c
deleted file mode 100644
index e46a1b5..0000000
--- a/lib/librpc/rpcgen/rpc_scan.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* @(#)rpc_scan.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_scan.c 1.6 87/06/24 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_scan.c, Scanner for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-#include <stdio.h>
-#include <ctype.h>
-#include <strings.h>
-#include "rpc_scan.h"
-#include "rpc_util.h"
-
-#define startcomment(where) (where[0] == '/' && where[1] == '*')
-#define endcomment(where) (where[-1] == '*' && where[0] == '/')
-
-static int pushed = 0; /* is a token pushed */
-static token lasttok; /* last token, if pushed */
-
-/*
- * scan expecting 1 given token
- */
-void
-scan(expect, tokp)
- tok_kind expect;
- token *tokp;
-{
- get_token(tokp);
- if (tokp->kind != expect) {
- expected1(expect);
- }
-}
-
-/*
- * scan expecting 2 given tokens
- */
-void
-scan2(expect1, expect2, tokp)
- tok_kind expect1;
- tok_kind expect2;
- token *tokp;
-{
- get_token(tokp);
- if (tokp->kind != expect1 && tokp->kind != expect2) {
- expected2(expect1, expect2);
- }
-}
-
-/*
- * scan expecting 3 given token
- */
-void
-scan3(expect1, expect2, expect3, tokp)
- tok_kind expect1;
- tok_kind expect2;
- tok_kind expect3;
- token *tokp;
-{
- get_token(tokp);
- if (tokp->kind != expect1 && tokp->kind != expect2
- && tokp->kind != expect3) {
- expected3(expect1, expect2, expect3);
- }
-}
-
-
-/*
- * scan expecting a constant, possibly symbolic
- */
-void
-scan_num(tokp)
- token *tokp;
-{
- get_token(tokp);
- switch (tokp->kind) {
- case TOK_IDENT:
- break;
- default:
- error("constant or identifier expected");
- }
-}
-
-
-/*
- * Peek at the next token
- */
-void
-peek(tokp)
- token *tokp;
-{
- get_token(tokp);
- unget_token(tokp);
-}
-
-
-/*
- * Peek at the next token and scan it if it matches what you expect
- */
-int
-peekscan(expect, tokp)
- tok_kind expect;
- token *tokp;
-{
- peek(tokp);
- if (tokp->kind == expect) {
- get_token(tokp);
- return (1);
- }
- return (0);
-}
-
-
-
-/*
- * Get the next token, printing out any directive that are encountered.
- */
-void
-get_token(tokp)
- token *tokp;
-{
- int commenting;
-
- if (pushed) {
- pushed = 0;
- *tokp = lasttok;
- return;
- }
- commenting = 0;
- for (;;) {
- if (*where == 0) {
- for (;;) {
- if (!fgets(curline, MAXLINESIZE, fin)) {
- tokp->kind = TOK_EOF;
- *where = 0;
- return;
- }
- linenum++;
- if (commenting) {
- break;
- } else if (cppline(curline)) {
- docppline(curline, &linenum,
- &infilename);
- } else if (directive(curline)) {
- printdirective(curline);
- } else {
- break;
- }
- }
- where = curline;
- } else if (isspace(*where)) {
- while (isspace(*where)) {
- where++; /* eat */
- }
- } else if (commenting) {
- where++;
- if (endcomment(where)) {
- where++;
- commenting--;
- }
- } else if (startcomment(where)) {
- where += 2;
- commenting++;
- } else {
- break;
- }
- }
-
- /*
- * 'where' is not whitespace, comment or directive Must be a token!
- */
- switch (*where) {
- case ':':
- tokp->kind = TOK_COLON;
- where++;
- break;
- case ';':
- tokp->kind = TOK_SEMICOLON;
- where++;
- break;
- case ',':
- tokp->kind = TOK_COMMA;
- where++;
- break;
- case '=':
- tokp->kind = TOK_EQUAL;
- where++;
- break;
- case '*':
- tokp->kind = TOK_STAR;
- where++;
- break;
- case '[':
- tokp->kind = TOK_LBRACKET;
- where++;
- break;
- case ']':
- tokp->kind = TOK_RBRACKET;
- where++;
- break;
- case '{':
- tokp->kind = TOK_LBRACE;
- where++;
- break;
- case '}':
- tokp->kind = TOK_RBRACE;
- where++;
- break;
- case '(':
- tokp->kind = TOK_LPAREN;
- where++;
- break;
- case ')':
- tokp->kind = TOK_RPAREN;
- where++;
- break;
- case '<':
- tokp->kind = TOK_LANGLE;
- where++;
- break;
- case '>':
- tokp->kind = TOK_RANGLE;
- where++;
- break;
-
- case '"':
- tokp->kind = TOK_STRCONST;
- findstrconst(&where, &tokp->str);
- break;
-
- case '-':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- tokp->kind = TOK_IDENT;
- findconst(&where, &tokp->str);
- break;
-
-
- default:
- if (!(isalpha(*where) || *where == '_')) {
- char buf[100];
- char *p;
-
- s_print(buf, "illegal character in file: ");
- p = buf + strlen(buf);
- if (isprint(*where)) {
- s_print(p, "%c", *where);
- } else {
- s_print(p, "%d", *where);
- }
- error(buf);
- }
- findkind(&where, tokp);
- break;
- }
-}
-
-
-
-static
-unget_token(tokp)
- token *tokp;
-{
- lasttok = *tokp;
- pushed = 1;
-}
-
-
-static
-findstrconst(str, val)
- char **str;
- char **val;
-{
- char *p;
- int size;
-
- p = *str;
- do {
- *p++;
- } while (*p && *p != '"');
- if (*p == 0) {
- error("unterminated string constant");
- }
- p++;
- size = p - *str;
- *val = alloc(size + 1);
- (void) strncpy(*val, *str, size);
- (*val)[size] = 0;
- *str = p;
-}
-
-static
-findconst(str, val)
- char **str;
- char **val;
-{
- char *p;
- int size;
-
- p = *str;
- if (*p == '0' && *(p + 1) == 'x') {
- p++;
- do {
- p++;
- } while (isxdigit(*p));
- } else {
- do {
- p++;
- } while (isdigit(*p));
- }
- size = p - *str;
- *val = alloc(size + 1);
- (void) strncpy(*val, *str, size);
- (*val)[size] = 0;
- *str = p;
-}
-
-
-
-static token symbols[] = {
- {TOK_CONST, "const"},
- {TOK_UNION, "union"},
- {TOK_SWITCH, "switch"},
- {TOK_CASE, "case"},
- {TOK_DEFAULT, "default"},
- {TOK_STRUCT, "struct"},
- {TOK_TYPEDEF, "typedef"},
- {TOK_ENUM, "enum"},
- {TOK_OPAQUE, "opaque"},
- {TOK_BOOL, "bool"},
- {TOK_VOID, "void"},
- {TOK_CHAR, "char"},
- {TOK_INT, "int"},
- {TOK_UNSIGNED, "unsigned"},
- {TOK_SHORT, "short"},
- {TOK_LONG, "long"},
- {TOK_FLOAT, "float"},
- {TOK_DOUBLE, "double"},
- {TOK_STRING, "string"},
- {TOK_PROGRAM, "program"},
- {TOK_VERSION, "version"},
- {TOK_EOF, "??????"},
-};
-
-
-static
-findkind(mark, tokp)
- char **mark;
- token *tokp;
-{
-
- int len;
- token *s;
- char *str;
-
- str = *mark;
- for (s = symbols; s->kind != TOK_EOF; s++) {
- len = strlen(s->str);
- if (strncmp(str, s->str, len) == 0) {
- if (!isalnum(str[len]) && str[len] != '_') {
- tokp->kind = s->kind;
- tokp->str = s->str;
- *mark = str + len;
- return;
- }
- }
- }
- tokp->kind = TOK_IDENT;
- for (len = 0; isalnum(str[len]) || str[len] == '_'; len++);
- tokp->str = alloc(len + 1);
- (void) strncpy(tokp->str, str, len);
- tokp->str[len] = 0;
- *mark = str + len;
-}
-
-static
-cppline(line)
- char *line;
-{
- return (line == curline && *line == '#');
-}
-
-static
-directive(line)
- char *line;
-{
- return (line == curline && *line == '%');
-}
-
-static
-printdirective(line)
- char *line;
-{
- f_print(fout, "%s", line + 1);
-}
-
-static
-docppline(line, lineno, fname)
- char *line;
- int *lineno;
- char **fname;
-{
- char *file;
- int num;
- char *p;
-
- line++;
- while (isspace(*line)) {
- line++;
- }
- num = atoi(line);
- while (isdigit(*line)) {
- line++;
- }
- while (isspace(*line)) {
- line++;
- }
- if (*line != '"') {
- error("preprocessor error");
- }
- line++;
- p = file = alloc(strlen(line) + 1);
- while (*line && *line != '"') {
- *p++ = *line++;
- }
- if (*line == 0) {
- error("preprocessor error");
- }
- *p = 0;
- if (*file == 0) {
- *fname = NULL;
- } else {
- *fname = file;
- }
- *lineno = num - 1;
-}
diff --git a/lib/librpc/rpcgen/rpc_scan.h b/lib/librpc/rpcgen/rpc_scan.h
deleted file mode 100644
index ad243d5..0000000
--- a/lib/librpc/rpcgen/rpc_scan.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* @(#)rpc_scan.h 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)rpc_scan.h 1.3 87/03/09 (C) 1987 SMI */
-
-/*
- * rpc_scan.h, Definitions for the RPCL scanner
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-
-/*
- * kinds of tokens
- */
-enum tok_kind {
- TOK_IDENT,
- TOK_STRCONST,
- TOK_LPAREN,
- TOK_RPAREN,
- TOK_LBRACE,
- TOK_RBRACE,
- TOK_LBRACKET,
- TOK_RBRACKET,
- TOK_LANGLE,
- TOK_RANGLE,
- TOK_STAR,
- TOK_COMMA,
- TOK_EQUAL,
- TOK_COLON,
- TOK_SEMICOLON,
- TOK_CONST,
- TOK_STRUCT,
- TOK_UNION,
- TOK_SWITCH,
- TOK_CASE,
- TOK_DEFAULT,
- TOK_ENUM,
- TOK_TYPEDEF,
- TOK_INT,
- TOK_SHORT,
- TOK_LONG,
- TOK_UNSIGNED,
- TOK_FLOAT,
- TOK_DOUBLE,
- TOK_OPAQUE,
- TOK_CHAR,
- TOK_STRING,
- TOK_BOOL,
- TOK_VOID,
- TOK_PROGRAM,
- TOK_VERSION,
- TOK_EOF
-};
-typedef enum tok_kind tok_kind;
-
-/*
- * a token
- */
-struct token {
- tok_kind kind;
- char *str;
-};
-typedef struct token token;
-
-
-/*
- * routine interface
- */
-void scanprint();
-void scan();
-void scan2();
-void scan3();
-void scan_num();
-void peek();
-int peekscan();
-void get_token();
diff --git a/lib/librpc/rpcgen/rpc_svcout.c b/lib/librpc/rpcgen/rpc_svcout.c
deleted file mode 100644
index 7289b0d..0000000
--- a/lib/librpc/rpcgen/rpc_svcout.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* @(#)rpc_svcout.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_svcout.c 1.6 87/06/24 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsytsems, Inc.
- */
-#include <stdio.h>
-#include <strings.h>
-#include "rpc_parse.h"
-#include "rpc_util.h"
-
-static char RQSTP[] = "rqstp";
-static char TRANSP[] = "transp";
-static char ARG[] = "argument";
-static char RESULT[] = "result";
-static char ROUTINE[] = "local";
-
-
-/*
- * write most of the service, that is, everything but the registrations.
- */
-void
-write_most()
-{
- list *l;
- definition *def;
- version_list *vp;
-
- for (l = defined; l != NULL; l = l->next) {
- def = (definition *) l->val;
- if (def->def_kind == DEF_PROGRAM) {
- for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
- f_print(fout, "\nstatic void ");
- pvname(def->def_name, vp->vers_num);
- f_print(fout, "();");
- }
- }
- }
- f_print(fout, "\n\n");
- f_print(fout, "main()\n");
- f_print(fout, "{\n");
- f_print(fout, "\tSVCXPRT *%s;\n", TRANSP);
- f_print(fout, "\n");
- for (l = defined; l != NULL; l = l->next) {
- def = (definition *) l->val;
- if (def->def_kind != DEF_PROGRAM) {
- continue;
- }
- for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
- f_print(fout, "\t(void)pmap_unset(%s, %s);\n", def->def_name, vp->vers_name);
- }
- }
-}
-
-
-/*
- * write a registration for the given transport
- */
-void
-write_register(transp)
- char *transp;
-{
- list *l;
- definition *def;
- version_list *vp;
-
- f_print(fout, "\n");
- f_print(fout, "\t%s = svc%s_create(RPC_ANYSOCK", TRANSP, transp);
- if (streq(transp, "tcp")) {
- f_print(fout, ", 0, 0");
- }
- f_print(fout, ");\n");
- f_print(fout, "\tif (%s == NULL) {\n", TRANSP);
- f_print(fout, "\t\t(void)fprintf(stderr, \"cannot create %s service.\\n\");\n", transp);
- f_print(fout, "\t\texit(1);\n");
- f_print(fout, "\t}\n");
-
- for (l = defined; l != NULL; l = l->next) {
- def = (definition *) l->val;
- if (def->def_kind != DEF_PROGRAM) {
- continue;
- }
- for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
- f_print(fout,
- "\tif (!svc_register(%s, %s, %s, ",
- TRANSP, def->def_name, vp->vers_name);
- pvname(def->def_name, vp->vers_num);
- f_print(fout, ", IPPROTO_%s)) {\n",
- streq(transp, "udp") ? "UDP" : "TCP");
- f_print(fout,
- "\t\t(void)fprintf(stderr, \"unable to register (%s, %s, %s).\\n\");\n",
- def->def_name, vp->vers_name, transp);
- f_print(fout, "\t\texit(1);\n");
- f_print(fout, "\t}\n");
- }
- }
-}
-
-
-/*
- * write the rest of the service
- */
-void
-write_rest()
-{
- f_print(fout, "\tsvc_run();\n");
- f_print(fout, "\t(void)fprintf(stderr, \"svc_run returned\\n\");\n");
- f_print(fout, "\texit(1);\n");
- f_print(fout, "}\n");
-}
-
-void
-write_programs(storage)
- char *storage;
-{
- list *l;
- definition *def;
-
- for (l = defined; l != NULL; l = l->next) {
- def = (definition *) l->val;
- if (def->def_kind == DEF_PROGRAM) {
- write_program(def, storage);
- }
- }
-}
-
-
-static
-write_program(def, storage)
- definition *def;
- char *storage;
-{
- version_list *vp;
- proc_list *proc;
- int filled;
-
- for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
- f_print(fout, "\n");
- if (storage != NULL) {
- f_print(fout, "%s ", storage);
- }
- f_print(fout, "void\n");
- pvname(def->def_name, vp->vers_num);
- f_print(fout, "(%s, %s)\n", RQSTP, TRANSP);
- f_print(fout, " struct svc_req *%s;\n", RQSTP);
- f_print(fout, " SVCXPRT *%s;\n", TRANSP);
- f_print(fout, "{\n");
-
- filled = 0;
- f_print(fout, "\tunion {\n");
- for (proc = vp->procs; proc != NULL; proc = proc->next) {
- if (streq(proc->arg_type, "void")) {
- continue;
- }
- filled = 1;
- f_print(fout, "\t\t");
- ptype(proc->arg_prefix, proc->arg_type, 0);
- pvname(proc->proc_name, vp->vers_num);
- f_print(fout, "_arg;\n");
- }
- if (!filled) {
- f_print(fout, "\t\tint fill;\n");
- }
- f_print(fout, "\t} %s;\n", ARG);
- f_print(fout, "\tchar *%s;\n", RESULT);
- f_print(fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT);
- f_print(fout, "\tchar *(*%s)();\n", ROUTINE);
- f_print(fout, "\n");
- f_print(fout, "\tswitch (%s->rq_proc) {\n", RQSTP);
-
- if (!nullproc(vp->procs)) {
- f_print(fout, "\tcase NULLPROC:\n");
- f_print(fout, "\t\t(void)svc_sendreply(%s, xdr_void, (char *)NULL);\n", TRANSP);
- f_print(fout, "\t\treturn;\n\n");
- }
- for (proc = vp->procs; proc != NULL; proc = proc->next) {
- f_print(fout, "\tcase %s:\n", proc->proc_name);
- f_print(fout, "\t\txdr_%s = xdr_%s;\n", ARG,
- stringfix(proc->arg_type));
- f_print(fout, "\t\txdr_%s = xdr_%s;\n", RESULT,
- stringfix(proc->res_type));
- f_print(fout, "\t\t%s = (char *(*)()) ", ROUTINE);
- pvname(proc->proc_name, vp->vers_num);
- f_print(fout, ";\n");
- f_print(fout, "\t\tbreak;\n\n");
- }
- f_print(fout, "\tdefault:\n");
- printerr("noproc", TRANSP);
- f_print(fout, "\t\treturn;\n");
- f_print(fout, "\t}\n");
-
- f_print(fout, "\tbzero((char *)&%s, sizeof(%s));\n", ARG, ARG);
- printif("getargs", TRANSP, "&", ARG);
- printerr("decode", TRANSP);
- f_print(fout, "\t\treturn;\n");
- f_print(fout, "\t}\n");
-
- f_print(fout, "\t%s = (*%s)(&%s, %s);\n", RESULT, ROUTINE, ARG,
- RQSTP);
- f_print(fout,
- "\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n",
- RESULT, TRANSP, RESULT, RESULT);
- printerr("systemerr", TRANSP);
- f_print(fout, "\t}\n");
-
- printif("freeargs", TRANSP, "&", ARG);
- f_print(fout, "\t\t(void)fprintf(stderr, \"unable to free arguments\\n\");\n");
- f_print(fout, "\t\texit(1);\n");
- f_print(fout, "\t}\n");
-
- f_print(fout, "}\n\n");
- }
-}
-
-static
-printerr(err, transp)
- char *err;
- char *transp;
-{
- f_print(fout, "\t\tsvcerr_%s(%s);\n", err, transp);
-}
-
-static
-printif(proc, transp, prefix, arg)
- char *proc;
- char *transp;
- char *prefix;
- char *arg;
-{
- f_print(fout, "\tif (!svc_%s(%s, xdr_%s, %s%s)) {\n",
- proc, transp, arg, prefix, arg);
-}
-
-
-nullproc(proc)
- proc_list *proc;
-{
- for (; proc != NULL; proc = proc->next) {
- if (streq(proc->proc_num, "0")) {
- return (1);
- }
- }
- return (0);
-}
diff --git a/lib/librpc/rpcgen/rpc_util.c b/lib/librpc/rpcgen/rpc_util.c
deleted file mode 100644
index 8136535..0000000
--- a/lib/librpc/rpcgen/rpc_util.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/* @(#)rpc_util.c 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#ifndef lint
-static char sccsid[] = "@(#)rpc_util.c 1.5 87/06/24 (C) 1987 SMI";
-#endif
-
-/*
- * rpc_util.c, Utility routines for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-#include <stdio.h>
-#include "rpc_scan.h"
-#include "rpc_parse.h"
-#include "rpc_util.h"
-
-char curline[MAXLINESIZE]; /* current read line */
-char *where = curline; /* current point in line */
-int linenum = 0; /* current line number */
-
-char *infilename; /* input filename */
-
-#define NFILES 4
-char *outfiles[NFILES]; /* output file names */
-int nfiles;
-
-FILE *fout; /* file pointer of current output */
-FILE *fin; /* file pointer of current input */
-
-list *defined; /* list of defined things */
-
-/*
- * Reinitialize the world
- */
-reinitialize()
-{
- bzero(curline, MAXLINESIZE);
- where = curline;
- linenum = 0;
- defined = NULL;
-}
-
-/*
- * string equality
- */
-streq(a, b)
- char *a;
- char *b;
-{
- return (strcmp(a, b) == 0);
-}
-
-/*
- * find a value in a list
- */
-char *
-findval(lst, val, cmp)
- list *lst;
- char *val;
- int (*cmp) ();
-
-{
- for (; lst != NULL; lst = lst->next) {
- if ((*cmp) (lst->val, val)) {
- return (lst->val);
- }
- }
- return (NULL);
-}
-
-/*
- * store a value in a list
- */
-void
-storeval(lstp, val)
- list **lstp;
- char *val;
-{
- list **l;
- list *lst;
-
- for (l = lstp; *l != NULL; l = (list **) & (*l)->next);
- lst = ALLOC(list);
- lst->val = val;
- lst->next = NULL;
- *l = lst;
-}
-
-
-static
-findit(def, type)
- definition *def;
- char *type;
-{
- return (streq(def->def_name, type));
-}
-
-
-static char *
-fixit(type, orig)
- char *type;
- char *orig;
-{
- definition *def;
-
- def = (definition *) FINDVAL(defined, type, findit);
- if (def == NULL || def->def_kind != DEF_TYPEDEF) {
- return (orig);
- }
- switch (def->def.ty.rel) {
- case REL_VECTOR:
- return (def->def.ty.old_type);
- case REL_ALIAS:
- return (fixit(def->def.ty.old_type, orig));
- default:
- return (orig);
- }
-}
-
-char *
-fixtype(type)
- char *type;
-{
- return (fixit(type, type));
-}
-
-char *
-stringfix(type)
- char *type;
-{
- if (streq(type, "string")) {
- return ("wrapstring");
- } else {
- return (type);
- }
-}
-
-void
-ptype(prefix, type, follow)
- char *prefix;
- char *type;
- int follow;
-{
- if (prefix != NULL) {
- if (streq(prefix, "enum")) {
- f_print(fout, "enum ");
- } else {
- f_print(fout, "struct ");
- }
- }
- if (streq(type, "bool")) {
- f_print(fout, "bool_t ");
- } else if (streq(type, "string")) {
- f_print(fout, "char *");
- } else {
- f_print(fout, "%s ", follow ? fixtype(type) : type);
- }
-}
-
-
-static
-typedefed(def, type)
- definition *def;
- char *type;
-{
- if (def->def_kind != DEF_TYPEDEF || def->def.ty.old_prefix != NULL) {
- return (0);
- } else {
- return (streq(def->def_name, type));
- }
-}
-
-isvectordef(type, rel)
- char *type;
- relation rel;
-{
- definition *def;
-
- for (;;) {
- switch (rel) {
- case REL_VECTOR:
- return (!streq(type, "string"));
- case REL_ARRAY:
- return (0);
- case REL_POINTER:
- return (0);
- case REL_ALIAS:
- def = (definition *) FINDVAL(defined, type, typedefed);
- if (def == NULL) {
- return (0);
- }
- type = def->def.ty.old_type;
- rel = def->def.ty.rel;
- }
- }
-}
-
-
-static char *
-locase(str)
- char *str;
-{
- char c;
- static char buf[100];
- char *p = buf;
-
- while (c = *str++) {
- *p++ = (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c;
- }
- *p = 0;
- return (buf);
-}
-
-
-void
-pvname(pname, vnum)
- char *pname;
- char *vnum;
-{
- f_print(fout, "%s_%s", locase(pname), vnum);
-}
-
-
-/*
- * print a useful (?) error message, and then die
- */
-void
-error(msg)
- char *msg;
-{
- printwhere();
- f_print(stderr, "%s, line %d: ", infilename, linenum);
- f_print(stderr, "%s\n", msg);
- crash();
-}
-
-/*
- * Something went wrong, unlink any files that we may have created and then
- * die.
- */
-crash()
-{
- int i;
-
- for (i = 0; i < nfiles; i++) {
- (void) unlink(outfiles[i]);
- }
- exit(1);
-}
-
-
-void
-record_open(file)
- char *file;
-{
- if (nfiles < NFILES) {
- outfiles[nfiles++] = file;
- } else {
- f_print(stderr, "too many files!\n");
- crash();
- }
-}
-
-static char expectbuf[100];
-static char *toktostr();
-
-/*
- * error, token encountered was not the expected one
- */
-void
-expected1(exp1)
- tok_kind exp1;
-{
- s_print(expectbuf, "expected '%s'",
- toktostr(exp1));
- error(expectbuf);
-}
-
-/*
- * error, token encountered was not one of two expected ones
- */
-void
-expected2(exp1, exp2)
- tok_kind exp1, exp2;
-{
- s_print(expectbuf, "expected '%s' or '%s'",
- toktostr(exp1),
- toktostr(exp2));
- error(expectbuf);
-}
-
-/*
- * error, token encountered was not one of 3 expected ones
- */
-void
-expected3(exp1, exp2, exp3)
- tok_kind exp1, exp2, exp3;
-{
- s_print(expectbuf, "expected '%s', '%s' or '%s'",
- toktostr(exp1),
- toktostr(exp2),
- toktostr(exp3));
- error(expectbuf);
-}
-
-void
-tabify(f, tab)
- FILE *f;
- int tab;
-{
- while (tab--) {
- (void) fputc('\t', f);
- }
-}
-
-
-
-static token tokstrings[] = {
- {TOK_IDENT, "identifier"},
- {TOK_CONST, "const"},
- {TOK_RPAREN, ")"},
- {TOK_LPAREN, "("},
- {TOK_RBRACE, "}"},
- {TOK_LBRACE, "{"},
- {TOK_LBRACKET, "["},
- {TOK_RBRACKET, "]"},
- {TOK_STAR, "*"},
- {TOK_COMMA, ","},
- {TOK_EQUAL, "="},
- {TOK_COLON, ":"},
- {TOK_SEMICOLON, ";"},
- {TOK_UNION, "union"},
- {TOK_STRUCT, "struct"},
- {TOK_SWITCH, "switch"},
- {TOK_CASE, "case"},
- {TOK_DEFAULT, "default"},
- {TOK_ENUM, "enum"},
- {TOK_TYPEDEF, "typedef"},
- {TOK_INT, "int"},
- {TOK_SHORT, "short"},
- {TOK_LONG, "long"},
- {TOK_UNSIGNED, "unsigned"},
- {TOK_DOUBLE, "double"},
- {TOK_FLOAT, "float"},
- {TOK_CHAR, "char"},
- {TOK_STRING, "string"},
- {TOK_OPAQUE, "opaque"},
- {TOK_BOOL, "bool"},
- {TOK_VOID, "void"},
- {TOK_PROGRAM, "program"},
- {TOK_VERSION, "version"},
- {TOK_EOF, "??????"}
-};
-
-static char *
-toktostr(kind)
- tok_kind kind;
-{
- token *sp;
-
- for (sp = tokstrings; sp->kind != TOK_EOF && sp->kind != kind; sp++);
- return (sp->str);
-}
-
-
-
-static
-printbuf()
-{
- char c;
- int i;
- int cnt;
-
-# define TABSIZE 4
-
- for (i = 0; c = curline[i]; i++) {
- if (c == '\t') {
- cnt = 8 - (i % TABSIZE);
- c = ' ';
- } else {
- cnt = 1;
- }
- while (cnt--) {
- (void) fputc(c, stderr);
- }
- }
-}
-
-
-static
-printwhere()
-{
- int i;
- char c;
- int cnt;
-
- printbuf();
- for (i = 0; i < where - curline; i++) {
- c = curline[i];
- if (c == '\t') {
- cnt = 8 - (i % TABSIZE);
- } else {
- cnt = 1;
- }
- while (cnt--) {
- (void) fputc('^', stderr);
- }
- }
- (void) fputc('\n', stderr);
-}
diff --git a/lib/librpc/rpcgen/rpc_util.h b/lib/librpc/rpcgen/rpc_util.h
deleted file mode 100644
index f4525a0..0000000
--- a/lib/librpc/rpcgen/rpc_util.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* @(#)rpc_util.h 2.1 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)rpc_util.h 1.6 87/06/24 (C) 1987 SMI */
-
-/*
- * rpc_util.h, Useful definitions for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-extern char *malloc();
-
-#define alloc(size) malloc((unsigned)(size))
-#define ALLOC(object) (object *) malloc(sizeof(object))
-
-extern char *sprintf();
-
-#define s_print (void) sprintf
-#define f_print (void) fprintf
-
-struct list {
- char *val;
- struct list *next;
-};
-typedef struct list list;
-
-/*
- * Global variables
- */
-#define MAXLINESIZE 1024
-extern char curline[MAXLINESIZE];
-extern char *where;
-extern int linenum;
-
-extern char *infilename;
-extern FILE *fout;
-extern FILE *fin;
-
-extern list *defined;
-
-/*
- * rpc_util routines
- */
-void storeval();
-
-#define STOREVAL(list,item) \
- storeval(list,(char *)item)
-
-char *findval();
-
-#define FINDVAL(list,item,finder) \
- findval(list, (char *) item, finder)
-
-char *fixtype();
-char *stringfix();
-void pvname();
-void ptype();
-int isvectordef();
-int streq();
-void error();
-void expected1();
-void expected2();
-void expected3();
-void tabify();
-void record_open();
-
-/*
- * rpc_cout routines
- */
-void cprint();
-void emit();
-
-/*
- * rpc_hout routines
- */
-void print_datadef();
-
-/*
- * rpc_svcout routines
- */
-void write_most();
-void write_register();
-void write_rest();
-void write_programs();
-
-/*
- * rpc_clntout routines
- */
-void write_stubs();
diff --git a/lib/librpc/rpcsvc/Makefile b/lib/librpc/rpcsvc/Makefile
deleted file mode 100644
index 690d945..0000000
--- a/lib/librpc/rpcsvc/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# @(#)Makefile 2.3 88/08/11 4.0 RPCSRC
-#
-#
-RPCCOM = rpcgen
-LIB = -lrpclib
-
-DESTDIR=
-CFLAGS= -O
-LDFLAGS=
-
-HDRS= klm_prot.h mount.h nfs_prot.h nlm_prot.h rex.h rquota.h rnusers.h\
- rquota.h rstat.h sm_inter.h spray.h yppasswd.h yp.h
-XFILES= bootparam_prot.x klm_prot.x mount.x nfs_prot.x nlm_prot.x \
- rex.x rnusers.x rquota.x rstat.x sm_inter.x spray.x yppasswd.x yp.x
-BIN= rstat
-SVCBIN= rstat_svc
-GEN= rstat_clnt.c rstat_svc.c rstat_xdr.c
-
-all: $(HDRS) $(BIN) $(SVCBIN)
-
-install: $(HDRS) $(XFILES)
- @echo "Creating RPC service headers directory"
- -mkdir ${DESTDIR}/usr/include/rpcsvc && \
- chown bin ${DESTDIR}/usr/include/rpcsvc && \
- chmod 755 ${DESTDIR}/usr/include/rpcsvc
- @echo "Installing RPC service header and definition files"
- for i in $(HDRS) $(XFILES); do \
- (install -c -m 644 $$i ${DESTDIR}/usr/include/rpcsvc) done
- -mkdir ${DESTDIR}/etc && chown bin ${DESTDIR}/etc && \
- chmod 755 ${DESTDIR}/etc
- @echo "Installing ${SVCBIN} in ${DESTDIR}/etc"
- @set -x;for i in ${SVCBIN}; do \
- (install -c -s $$i ${DESTDIR}/etc/$$i); done
- @echo "Installing ${BIN} in ${DESTDIR}/usr/bin"
- @set -x;for i in ${BIN}; do \
- (install -c -s $$i ${DESTDIR}/usr/bin/$$i); done
-
-rstat_svc: rstat_proc.o rstat_svc.o rstat_xdr.o
- $(CC) $(LDFLAGS) -o $@ rstat_proc.o rstat_svc.o rstat_xdr.o $(LIB)
-
-rstat: rstat.o rstat_clnt.o rstat_xdr.o
- $(CC) $(LDFLAGS) -o $@ rstat.o rstat_clnt.o rstat_xdr.o $(LIB)
-
-rstat.c rstat_proc.c: rstat.h
-
-klm_prot.h: klm_prot.x
- $(RPCCOM) -h klm_prot.x -o $@
-mount.h: mount.x
- $(RPCCOM) -h mount.x -o $@
-nfs_prot.h: nfs_prot.x
- $(RPCCOM) -h nfs_prot.x -o $@
-nlm_prot.h: nlm_prot.x
- $(RPCCOM) -h nlm_prot.x -o $@
-rex.h: rex.x
- $(RPCCOM) -h rex.x -o $@
-rnusers.h: rnusers.x
- $(RPCCOM) -h rnusers.x -o $@
-rquota.h: rquota.x
- $(RPCCOM) -h rquota.x -o $@
-rstat.h: rstat.x
- $(RPCCOM) -h rstat.x -o $@
-sm_inter.h: sm_inter.x
- $(RPCCOM) -h sm_inter.x -o $@
-spray.h: spray.x
- $(RPCCOM) -h spray.x -o $@
-yp.h: yp.x
- $(RPCCOM) -h yp.x -o $@
-yppasswd.h: yppasswd.x
- $(RPCCOM) -h yppasswd.x -o $@
-
-rstat_clnt.c: rstat.x
- $(RPCCOM) -l rstat.x -o $@
-rstat_svc.c: rstat.x
- $(RPCCOM) -s udp rstat.x -o $@
-rstat_xdr.c: rstat.x
- $(RPCCOM) -c rstat.x -o $@
-
-clean cleanup:
- rm -f *.o $(GEN) $(BIN) $(SVCBIN)
diff --git a/lib/librpc/rpcsvc/bootparam_prot.x b/lib/librpc/rpcsvc/bootparam_prot.x
deleted file mode 100644
index 65bc0dc..0000000
--- a/lib/librpc/rpcsvc/bootparam_prot.x
+++ /dev/null
@@ -1,97 +0,0 @@
-/* @(#)bootparam_prot.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * RPC for bootparms service.
- * There are two procedures:
- * WHOAMI takes a net address and returns a client name and also a
- * likely net address for routing
- * GETFILE takes a client name and file identifier and returns the
- * server name, server net address and pathname for the file.
- * file identifiers typically include root, swap, pub and dump
- */
-
-#ifdef RPC_HDR
-%#include <rpc/types.h>
-%#include <sys/time.h>
-%#include <sys/errno.h>
-%#include <nfs/nfs.h>
-#endif
-
-const MAX_MACHINE_NAME = 255;
-const MAX_PATH_LEN = 1024;
-const MAX_FILEID = 32;
-const IP_ADDR_TYPE = 1;
-
-typedef string bp_machine_name_t<MAX_MACHINE_NAME>;
-typedef string bp_path_t<MAX_PATH_LEN>;
-typedef string bp_fileid_t<MAX_FILEID>;
-
-struct ip_addr_t {
- char net;
- char host;
- char lh;
- char impno;
-};
-
-union bp_address switch (int address_type) {
- case IP_ADDR_TYPE:
- ip_addr_t ip_addr;
-};
-
-struct bp_whoami_arg {
- bp_address client_address;
-};
-
-struct bp_whoami_res {
- bp_machine_name_t client_name;
- bp_machine_name_t domain_name;
- bp_address router_address;
-};
-
-struct bp_getfile_arg {
- bp_machine_name_t client_name;
- bp_fileid_t file_id;
-};
-
-struct bp_getfile_res {
- bp_machine_name_t server_name;
- bp_address server_address;
- bp_path_t server_path;
-};
-
-program BOOTPARAMPROG {
- version BOOTPARAMVERS {
- bp_whoami_res BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
- bp_getfile_res BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
- } = 1;
-} = 100026;
diff --git a/lib/librpc/rpcsvc/klm_prot.x b/lib/librpc/rpcsvc/klm_prot.x
deleted file mode 100644
index e23caf40..0000000
--- a/lib/librpc/rpcsvc/klm_prot.x
+++ /dev/null
@@ -1,132 +0,0 @@
-/* @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Kernel/lock manager protocol definition
- * Copyright (C) 1986 Sun Microsystems, Inc.
- *
- * protocol used between the UNIX kernel (the "client") and the
- * local lock manager. The local lock manager is a deamon running
- * above the kernel.
- */
-program KLM_PROG {
- version KLM_VERS {
-
- klm_testrply KLM_TEST (struct klm_testargs) = 1;
-
- klm_stat KLM_LOCK (struct klm_lockargs) = 2;
-
- klm_stat KLM_CANCEL (struct klm_lockargs) = 3;
- /* klm_granted=> the cancel request fails due to lock is already granted */
- /* klm_denied=> the cancel request successfully aborts
-lock request */
-
- klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4;
- } = 1;
-} = 100020;
-
-const LM_MAXSTRLEN = 1024;
-
-/*
- * lock manager status returns
- */
-enum klm_stats {
- klm_granted = 0, /* lock is granted */
- klm_denied = 1, /* lock is denied */
- klm_denied_nolocks = 2, /* no lock entry available */
- klm_working = 3 /* lock is being processed */
-};
-
-/*
- * lock manager lock identifier
- */
-struct klm_lock {
- string server_name<LM_MAXSTRLEN>;
- netobj fh; /* a counted file handle */
- int pid; /* holder of the lock */
- unsigned l_offset; /* beginning offset of the lock */
- unsigned l_len; /* byte length of the lock;
- * zero means through end of file */
-};
-
-/*
- * lock holder identifier
- */
-struct klm_holder {
- bool exclusive; /* FALSE if shared lock */
- int svid; /* holder of the lock (pid) */
- unsigned l_offset; /* beginning offset of the lock */
- unsigned l_len; /* byte length of the lock;
- * zero means through end of file */
-};
-
-/*
- * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL
- */
-struct klm_stat {
- klm_stats stat;
-};
-
-/*
- * reply to a KLM_TEST call
- */
-union klm_testrply switch (klm_stats stat) {
- case klm_denied:
- struct klm_holder holder;
- default: /* All other cases return no arguments */
- void;
-};
-
-
-/*
- * arguments to KLM_LOCK
- */
-struct klm_lockargs {
- bool block;
- bool exclusive;
- struct klm_lock alock;
-};
-
-/*
- * arguments to KLM_TEST
- */
-struct klm_testargs {
- bool exclusive;
- struct klm_lock alock;
-};
-
-/*
- * arguments to KLM_UNLOCK
- */
-struct klm_unlockargs {
- struct klm_lock alock;
-};
diff --git a/lib/librpc/rpcsvc/mount.x b/lib/librpc/rpcsvc/mount.x
deleted file mode 100644
index 7e0d7f3..0000000
--- a/lib/librpc/rpcsvc/mount.x
+++ /dev/null
@@ -1,161 +0,0 @@
-/* @(#)mount.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Protocol description for the mount program
- */
-
-
-const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */
-const MNTNAMLEN = 255; /* maximum bytes in a name argument */
-const FHSIZE = 32; /* size in bytes of a file handle */
-
-/*
- * The fhandle is the file handle that the server passes to the client.
- * All file operations are done using the file handles to refer to a file
- * or a directory. The file handle can contain whatever information the
- * server needs to distinguish an individual file.
- */
-typedef opaque fhandle[FHSIZE];
-
-/*
- * If a status of zero is returned, the call completed successfully, and
- * a file handle for the directory follows. A non-zero status indicates
- * some sort of error. The status corresponds with UNIX error numbers.
- */
-union fhstatus switch (unsigned fhs_status) {
-case 0:
- fhandle fhs_fhandle;
-default:
- void;
-};
-
-/*
- * The type dirpath is the pathname of a directory
- */
-typedef string dirpath<MNTPATHLEN>;
-
-/*
- * The type name is used for arbitrary names (hostnames, groupnames)
- */
-typedef string name<MNTNAMLEN>;
-
-/*
- * A list of who has what mounted
- */
-typedef struct mountbody *mountlist;
-struct mountbody {
- name ml_hostname;
- dirpath ml_directory;
- mountlist ml_next;
-};
-
-/*
- * A list of netgroups
- */
-typedef struct groupnode *groups;
-struct groupnode {
- name gr_name;
- groups gr_next;
-};
-
-/*
- * A list of what is exported and to whom
- */
-typedef struct exportnode *exports;
-struct exportnode {
- dirpath ex_dir;
- groups ex_groups;
- exports ex_next;
-};
-
-program MOUNTPROG {
- /*
- * Version one of the mount protocol communicates with version two
- * of the NFS protocol. The only connecting point is the fhandle
- * structure, which is the same for both protocols.
- */
- version MOUNTVERS {
- /*
- * Does no work. It is made available in all RPC services
- * to allow server reponse testing and timing
- */
- void
- MOUNTPROC_NULL(void) = 0;
-
- /*
- * If fhs_status is 0, then fhs_fhandle contains the
- * file handle for the directory. This file handle may
- * be used in the NFS protocol. This procedure also adds
- * a new entry to the mount list for this client mounting
- * the directory.
- * Unix authentication required.
- */
- fhstatus
- MOUNTPROC_MNT(dirpath) = 1;
-
- /*
- * Returns the list of remotely mounted filesystems. The
- * mountlist contains one entry for each hostname and
- * directory pair.
- */
- mountlist
- MOUNTPROC_DUMP(void) = 2;
-
- /*
- * Removes the mount list entry for the directory
- * Unix authentication required.
- */
- void
- MOUNTPROC_UMNT(dirpath) = 3;
-
- /*
- * Removes all of the mount list entries for this client
- * Unix authentication required.
- */
- void
- MOUNTPROC_UMNTALL(void) = 4;
-
- /*
- * Returns a list of all the exported filesystems, and which
- * machines are allowed to import it.
- */
- exports
- MOUNTPROC_EXPORT(void) = 5;
-
- /*
- * Identical to MOUNTPROC_EXPORT above
- */
- exports
- MOUNTPROC_EXPORTALL(void) = 6;
- } = 1;
-} = 100005;
diff --git a/lib/librpc/rpcsvc/nfs_prot.x b/lib/librpc/rpcsvc/nfs_prot.x
deleted file mode 100644
index 7633e5a..0000000
--- a/lib/librpc/rpcsvc/nfs_prot.x
+++ /dev/null
@@ -1,355 +0,0 @@
-/* @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * nfs_prot.x 1.2 87/10/12
- * Copyright 1987 Sun Microsystems, Inc.
- */
-const NFS_PORT = 2049;
-const NFS_MAXDATA = 8192;
-const NFS_MAXPATHLEN = 1024;
-const NFS_MAXNAMLEN = 255;
-const NFS_FHSIZE = 32;
-const NFS_COOKIESIZE = 4;
-const NFS_FIFO_DEV = -1; /* size kludge for named pipes */
-
-/*
- * File types
- */
-const NFSMODE_FMT = 0170000; /* type of file */
-const NFSMODE_DIR = 0040000; /* directory */
-const NFSMODE_CHR = 0020000; /* character special */
-const NFSMODE_BLK = 0060000; /* block special */
-const NFSMODE_REG = 0100000; /* regular */
-const NFSMODE_LNK = 0120000; /* symbolic link */
-const NFSMODE_SOCK = 0140000; /* socket */
-const NFSMODE_FIFO = 0010000; /* fifo */
-
-/*
- * Error status
- */
-enum nfsstat {
- NFS_OK= 0, /* no error */
- NFSERR_PERM=1, /* Not owner */
- NFSERR_NOENT=2, /* No such file or directory */
- NFSERR_IO=5, /* I/O error */
- NFSERR_NXIO=6, /* No such device or address */
- NFSERR_ACCES=13, /* Permission denied */
- NFSERR_EXIST=17, /* File exists */
- NFSERR_NODEV=19, /* No such device */
- NFSERR_NOTDIR=20, /* Not a directory*/
- NFSERR_ISDIR=21, /* Is a directory */
- NFSERR_FBIG=27, /* File too large */
- NFSERR_NOSPC=28, /* No space left on device */
- NFSERR_ROFS=30, /* Read-only file system */
- NFSERR_NAMETOOLONG=63, /* File name too long */
- NFSERR_NOTEMPTY=66, /* Directory not empty */
- NFSERR_DQUOT=69, /* Disc quota exceeded */
- NFSERR_STALE=70, /* Stale NFS file handle */
- NFSERR_WFLUSH=99 /* write cache flushed */
-};
-
-/*
- * File types
- */
-enum ftype {
- NFNON = 0, /* non-file */
- NFREG = 1, /* regular file */
- NFDIR = 2, /* directory */
- NFBLK = 3, /* block special */
- NFCHR = 4, /* character special */
- NFLNK = 5, /* symbolic link */
- NFSOCK = 6, /* unix domain sockets */
- NFBAD = 7, /* unused */
- NFFIFO = 8 /* named pipe */
-};
-
-/*
- * File access handle
- */
-struct nfs_fh {
- opaque data[NFS_FHSIZE];
-};
-
-/*
- * Timeval
- */
-struct nfstime {
- unsigned seconds;
- unsigned useconds;
-};
-
-
-/*
- * File attributes
- */
-struct fattr {
- ftype type; /* file type */
- unsigned mode; /* protection mode bits */
- unsigned nlink; /* # hard links */
- unsigned uid; /* owner user id */
- unsigned gid; /* owner group id */
- unsigned size; /* file size in bytes */
- unsigned blocksize; /* prefered block size */
- unsigned rdev; /* special device # */
- unsigned blocks; /* Kb of disk used by file */
- unsigned fsid; /* device # */
- unsigned fileid; /* inode # */
- nfstime atime; /* time of last access */
- nfstime mtime; /* time of last modification */
- nfstime ctime; /* time of last change */
-};
-
-/*
- * File attributes which can be set
- */
-struct sattr {
- unsigned mode; /* protection mode bits */
- unsigned uid; /* owner user id */
- unsigned gid; /* owner group id */
- unsigned size; /* file size in bytes */
- nfstime atime; /* time of last access */
- nfstime mtime; /* time of last modification */
-};
-
-
-typedef string filename<NFS_MAXNAMLEN>;
-typedef string nfspath<NFS_MAXPATHLEN>;
-
-/*
- * Reply status with file attributes
- */
-union attrstat switch (nfsstat status) {
-case NFS_OK:
- fattr attributes;
-default:
- void;
-};
-
-struct sattrargs {
- nfs_fh file;
- sattr attributes;
-};
-
-/*
- * Arguments for directory operations
- */
-struct diropargs {
- nfs_fh dir; /* directory file handle */
- filename name; /* name (up to NFS_MAXNAMLEN bytes) */
-};
-
-struct diropokres {
- nfs_fh file;
- fattr attributes;
-};
-
-/*
- * Results from directory operation
- */
-union diropres switch (nfsstat status) {
-case NFS_OK:
- diropokres diropres;
-default:
- void;
-};
-
-union readlinkres switch (nfsstat status) {
-case NFS_OK:
- nfspath data;
-default:
- void;
-};
-
-/*
- * Arguments to remote read
- */
-struct readargs {
- nfs_fh file; /* handle for file */
- unsigned offset; /* byte offset in file */
- unsigned count; /* immediate read count */
- unsigned totalcount; /* total read count (from this offset)*/
-};
-
-/*
- * Status OK portion of remote read reply
- */
-struct readokres {
- fattr attributes; /* attributes, need for pagin*/
- opaque data<NFS_MAXDATA>;
-};
-
-union readres switch (nfsstat status) {
-case NFS_OK:
- readokres reply;
-default:
- void;
-};
-
-/*
- * Arguments to remote write
- */
-struct writeargs {
- nfs_fh file; /* handle for file */
- unsigned beginoffset; /* beginning byte offset in file */
- unsigned offset; /* current byte offset in file */
- unsigned totalcount; /* total write count (to this offset)*/
- opaque data<NFS_MAXDATA>;
-};
-
-struct createargs {
- diropargs where;
- sattr attributes;
-};
-
-struct renameargs {
- diropargs from;
- diropargs to;
-};
-
-struct linkargs {
- nfs_fh from;
- diropargs to;
-};
-
-struct symlinkargs {
- diropargs from;
- nfspath to;
- sattr attributes;
-};
-
-
-typedef opaque nfscookie[NFS_COOKIESIZE];
-
-/*
- * Arguments to readdir
- */
-struct readdirargs {
- nfs_fh dir; /* directory handle */
- nfscookie cookie;
- unsigned count; /* number of directory bytes to read */
-};
-
-struct entry {
- unsigned fileid;
- filename name;
- nfscookie cookie;
- entry *nextentry;
-};
-
-struct dirlist {
- entry *entries;
- bool eof;
-};
-
-union readdirres switch (nfsstat status) {
-case NFS_OK:
- dirlist reply;
-default:
- void;
-};
-
-struct statfsokres {
- unsigned tsize; /* preferred transfer size in bytes */
- unsigned bsize; /* fundamental file system block size */
- unsigned blocks; /* total blocks in file system */
- unsigned bfree; /* free blocks in fs */
- unsigned bavail; /* free blocks avail to non-superuser */
-};
-
-union statfsres switch (nfsstat status) {
-case NFS_OK:
- statfsokres reply;
-default:
- void;
-};
-
-/*
- * Remote file service routines
- */
-program NFS_PROGRAM {
- version NFS_VERSION {
- void
- NFSPROC_NULL(void) = 0;
-
- attrstat
- NFSPROC_GETATTR(nfs_fh) = 1;
-
- attrstat
- NFSPROC_SETATTR(sattrargs) = 2;
-
- void
- NFSPROC_ROOT(void) = 3;
-
- diropres
- NFSPROC_LOOKUP(diropargs) = 4;
-
- readlinkres
- NFSPROC_READLINK(nfs_fh) = 5;
-
- readres
- NFSPROC_READ(readargs) = 6;
-
- void
- NFSPROC_WRITECACHE(void) = 7;
-
- attrstat
- NFSPROC_WRITE(writeargs) = 8;
-
- diropres
- NFSPROC_CREATE(createargs) = 9;
-
- nfsstat
- NFSPROC_REMOVE(diropargs) = 10;
-
- nfsstat
- NFSPROC_RENAME(renameargs) = 11;
-
- nfsstat
- NFSPROC_LINK(linkargs) = 12;
-
- nfsstat
- NFSPROC_SYMLINK(symlinkargs) = 13;
-
- diropres
- NFSPROC_MKDIR(createargs) = 14;
-
- nfsstat
- NFSPROC_RMDIR(diropargs) = 15;
-
- readdirres
- NFSPROC_READDIR(readdirargs) = 16;
-
- statfsres
- NFSPROC_STATFS(nfs_fh) = 17;
- } = 2;
-} = 100003;
-
diff --git a/lib/librpc/rpcsvc/nlm_prot.x b/lib/librpc/rpcsvc/nlm_prot.x
deleted file mode 100644
index e60c931..0000000
--- a/lib/librpc/rpcsvc/nlm_prot.x
+++ /dev/null
@@ -1,179 +0,0 @@
-/* @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro */
-
-/*
- * Network lock manager protocol definition
- * Copyright (C) 1986 Sun Microsystems, Inc.
- *
- * protocol used between local lock manager and remote lock manager
- */
-
-#ifdef RPC_HDR
-%#define LM_MAXSTRLEN 1024
-%#define MAXNAMELEN LM_MAXSTRLEN+1
-#endif
-
-/*
- * status of a call to the lock manager
- */
-enum nlm_stats {
- nlm_granted = 0,
- nlm_denied = 1,
- nlm_denied_nolocks = 2,
- nlm_blocked = 3,
- nlm_denied_grace_period = 4
-};
-
-struct nlm_holder {
- bool exclusive;
- int svid;
- netobj oh;
- unsigned l_offset;
- unsigned l_len;
-};
-
-union nlm_testrply switch (nlm_stats stat) {
- case nlm_denied:
- struct nlm_holder holder;
- default:
- void;
-};
-
-struct nlm_stat {
- nlm_stats stat;
-};
-
-struct nlm_res {
- netobj cookie;
- nlm_stat stat;
-};
-
-struct nlm_testres {
- netobj cookie;
- nlm_testrply stat;
-};
-
-struct nlm_lock {
- string caller_name<LM_MAXSTRLEN>;
- netobj fh; /* identify a file */
- netobj oh; /* identify owner of a lock */
- int svid; /* generated from pid for svid */
- unsigned l_offset;
- unsigned l_len;
-};
-
-struct nlm_lockargs {
- netobj cookie;
- bool block;
- bool exclusive;
- struct nlm_lock alock;
- bool reclaim; /* used for recovering locks */
- int state; /* specify local status monitor state */
-};
-
-struct nlm_cancargs {
- netobj cookie;
- bool block;
- bool exclusive;
- struct nlm_lock alock;
-};
-
-struct nlm_testargs {
- netobj cookie;
- bool exclusive;
- struct nlm_lock alock;
-};
-
-struct nlm_unlockargs {
- netobj cookie;
- struct nlm_lock alock;
-};
-
-
-#ifdef RPC_HDR
-%/*
-% * The following enums are actually bit encoded for efficient
-% * boolean algebra.... DON'T change them.....
-% */
-#endif
-enum fsh_mode {
- fsm_DN = 0, /* deny none */
- fsm_DR = 1, /* deny read */
- fsm_DW = 2, /* deny write */
- fsm_DRW = 3 /* deny read/write */
-};
-
-enum fsh_access {
- fsa_NONE = 0, /* for completeness */
- fsa_R = 1, /* read only */
- fsa_W = 2, /* write only */
- fsa_RW = 3 /* read/write */
-};
-
-struct nlm_share {
- string caller_name<LM_MAXSTRLEN>;
- netobj fh;
- netobj oh;
- fsh_mode mode;
- fsh_access access;
-};
-
-struct nlm_shareargs {
- netobj cookie;
- nlm_share share;
- bool reclaim;
-};
-
-struct nlm_shareres {
- netobj cookie;
- nlm_stats stat;
- int sequence;
-};
-
-struct nlm_notify {
- string name<MAXNAMELEN>;
- long state;
-};
-
-/*
- * Over-the-wire protocol used between the network lock managers
- */
-
-program NLM_PROG {
- version NLM_VERS {
-
- nlm_testres NLM_TEST(struct nlm_testargs) = 1;
-
- nlm_res NLM_LOCK(struct nlm_lockargs) = 2;
-
- nlm_res NLM_CANCEL(struct nlm_cancargs) = 3;
- nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4;
-
- /*
- * remote lock manager call-back to grant lock
- */
- nlm_res NLM_GRANTED(struct nlm_testargs)= 5;
- /*
- * message passing style of requesting lock
- */
- void NLM_TEST_MSG(struct nlm_testargs) = 6;
- void NLM_LOCK_MSG(struct nlm_lockargs) = 7;
- void NLM_CANCEL_MSG(struct nlm_cancargs) =8;
- void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
- void NLM_GRANTED_MSG(struct nlm_testargs) = 10;
- void NLM_TEST_RES(nlm_testres) = 11;
- void NLM_LOCK_RES(nlm_res) = 12;
- void NLM_CANCEL_RES(nlm_res) = 13;
- void NLM_UNLOCK_RES(nlm_res) = 14;
- void NLM_GRANTED_RES(nlm_res) = 15;
- } = 1;
-
- version NLM_VERSX {
- nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
- nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
- nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
- void NLM_FREE_ALL(nlm_notify) = 23;
- } = 3;
-
-} = 100021;
-
diff --git a/lib/librpc/rpcsvc/rex.x b/lib/librpc/rpcsvc/rex.x
deleted file mode 100644
index 6063fdd..0000000
--- a/lib/librpc/rpcsvc/rex.x
+++ /dev/null
@@ -1,229 +0,0 @@
-/* @(#)rex.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Remote execution (rex) protocol specification
- */
-
-const STRINGSIZE = 1024;
-typedef string rexstring<1024>;
-
-/*
- * values to pass to REXPROC_SIGNAL
- */
-const SIGINT = 2; /* interrupt */
-
-/*
- * Values for rst_flags, below
- */
-const REX_INTERACTIVE = 1; /* interactive mode */
-
-struct rex_start {
- rexstring rst_cmd<>; /* list of command and args */
- rexstring rst_host; /* working directory host name */
- rexstring rst_fsname; /* working directory file system name */
- rexstring rst_dirwithin;/* working directory within file system */
- rexstring rst_env<>; /* list of environment */
- unsigned int rst_port0; /* port for stdin */
- unsigned int rst_port1; /* port for stdout */
- unsigned int rst_port2; /* port for stderr */
- unsigned int rst_flags; /* options - see const above */
-};
-
-struct rex_result {
- int rlt_stat; /* integer status code */
- rexstring rlt_message; /* string message for human consumption */
-};
-
-
-struct sgttyb {
- unsigned four; /* always equals 4 */
- opaque chars[4];
- /* chars[0] == input speed */
- /* chars[1] == output speed */
- /* chars[2] == kill character */
- /* chars[3] == erase character */
- unsigned flags;
-};
-/* values for speeds above (baud rates) */
-const B0 = 0;
-const B50 = 1;
-const B75 = 2;
-const B110 = 3;
-const B134 = 4;
-const B150 = 5;
-const B200 = 6;
-const B300 = 7;
-const B600 = 8;
-const B1200 = 9;
-const B1800 = 10;
-const B2400 = 11;
-const B4800 = 12;
-const B9600 = 13;
-const B19200 = 14;
-const B38400 = 15;
-
-/* values for flags above */
-const TANDEM = 0x00000001; /* send stopc on out q full */
-const CBREAK = 0x00000002; /* half-cooked mode */
-const LCASE = 0x00000004; /* simulate lower case */
-const ECHO = 0x00000008; /* echo input */
-const CRMOD = 0x00000010; /* map \r to \r\n on output */
-const RAW = 0x00000020; /* no i/o processing */
-const ODDP = 0x00000040; /* get/send odd parity */
-const EVENP = 0x00000080; /* get/send even parity */
-const ANYP = 0x000000c0; /* get any parity/send none */
-const NLDELAY = 0x00000300; /* \n delay */
-const NL0 = 0x00000000;
-const NL1 = 0x00000100; /* tty 37 */
-const NL2 = 0x00000200; /* vt05 */
-const NL3 = 0x00000300;
-const TBDELAY = 0x00000c00; /* horizontal tab delay */
-const TAB0 = 0x00000000;
-const TAB1 = 0x00000400; /* tty 37 */
-const TAB2 = 0x00000800;
-const XTABS = 0x00000c00; /* expand tabs on output */
-const CRDELAY = 0x00003000; /* \r delay */
-const CR0 = 0x00000000;
-const CR1 = 0x00001000; /* tn 300 */
-const CR2 = 0x00002000; /* tty 37 */
-const CR3 = 0x00003000; /* concept 100 */
-const VTDELAY = 0x00004000; /* vertical tab delay */
-const FF0 = 0x00000000;
-const FF1 = 0x00004000; /* tty 37 */
-const BSDELAY = 0x00008000; /* \b delay */
-const BS0 = 0x00000000;
-const BS1 = 0x00008000;
-const CRTBS = 0x00010000; /* do backspacing for crt */
-const PRTERA = 0x00020000; /* \ ... / erase */
-const CRTERA = 0x00040000; /* " \b " to wipe out char */
-const TILDE = 0x00080000; /* hazeltine tilde kludge */
-const MDMBUF = 0x00100000; /* start/stop output on carrier intr */
-const LITOUT = 0x00200000; /* literal output */
-const TOSTOP = 0x00400000; /* SIGTTOU on background output */
-const FLUSHO = 0x00800000; /* flush output to terminal */
-const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
-const L001000 = 0x02000000;
-const CRTKIL = 0x04000000; /* kill line with " \b " */
-const PASS8 = 0x08000000;
-const CTLECH = 0x10000000; /* echo control chars as ^X */
-const PENDIN = 0x20000000; /* tp->t_rawq needs reread */
-const DECCTQ = 0x40000000; /* only ^Q starts after ^S */
-const NOFLSH = 0x80000000; /* no output flush on signal */
-
-struct tchars {
- unsigned six; /* always equals 6 */
- opaque chars[6];
- /* chars[0] == interrupt char */
- /* chars[1] == quit char */
- /* chars[2] == start output char */
- /* chars[3] == stop output char */
- /* chars[4] == end-of-file char */
- /* chars[5] == input delimeter (like nl) */
-};
-
-struct ltchars {
- unsigned six; /* always equals 6 */
- opaque chars[6];
- /* chars[0] == stop process signal */
- /* chars[1] == delayed stop process signal */
- /* chars[2] == reprint line */
- /* chars[3] == flush output */
- /* chars[4] == word erase */
- /* chars[5] == literal next character */
- unsigned mode;
-};
-
-struct rex_ttysize {
- int ts_lines;
- int ts_cols;
-};
-
-struct rex_ttymode {
- sgttyb basic; /* standard unix tty flags */
- tchars more; /* interrupt, kill characters, etc. */
- ltchars yetmore; /* special Berkeley characters */
- unsigned andmore; /* and Berkeley modes */
-};
-
-/* values for andmore above */
-const LCRTBS = 0x0001; /* do backspacing for crt */
-const LPRTERA = 0x0002; /* \ ... / erase */
-const LCRTERA = 0x0004; /* " \b " to wipe out char */
-const LTILDE = 0x0008; /* hazeltine tilde kludge */
-const LMDMBUF = 0x0010; /* start/stop output on carrier intr */
-const LLITOUT = 0x0020; /* literal output */
-const LTOSTOP = 0x0040; /* SIGTTOU on background output */
-const LFLUSHO = 0x0080; /* flush output to terminal */
-const LNOHANG = 0x0100; /* no SIGHUP on carrier drop */
-const LL001000 = 0x0200;
-const LCRTKIL = 0x0400; /* kill line with " \b " */
-const LPASS8 = 0x0800;
-const LCTLECH = 0x1000; /* echo control chars as ^X */
-const LPENDIN = 0x2000; /* needs reread */
-const LDECCTQ = 0x4000; /* only ^Q starts after ^S */
-const LNOFLSH = 0x8000; /* no output flush on signal */
-
-program REXPROG {
- version REXVERS {
-
- /*
- * Start remote execution
- */
- rex_result
- REXPROC_START(rex_start) = 1;
-
- /*
- * Wait for remote execution to terminate
- */
- rex_result
- REXPROC_WAIT(void) = 2;
-
- /*
- * Send tty modes
- */
- void
- REXPROC_MODES(rex_ttymode) = 3;
-
- /*
- * Send window size change
- */
- void
- REXPROC_WINCH(rex_ttysize) = 4;
-
- /*
- * Send other signal
- */
- void
- REXPROC_SIGNAL(int) = 5;
- } = 1;
-} = 100017;
diff --git a/lib/librpc/rpcsvc/rnusers.x b/lib/librpc/rpcsvc/rnusers.x
deleted file mode 100644
index 257df1e..0000000
--- a/lib/librpc/rpcsvc/rnusers.x
+++ /dev/null
@@ -1,86 +0,0 @@
-/* @(#)rnusers.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Find out about remote users
- */
-
-const MAXUSERS = 100;
-const MAXUTLEN = 256;
-
-struct utmp {
- string ut_line<MAXUTLEN>;
- string ut_name<MAXUTLEN>;
- string ut_host<MAXUTLEN>;
- int ut_time;
-};
-
-
-struct utmpidle {
- utmp ui_utmp;
- unsigned int ui_idle;
-};
-
-typedef utmp utmparr<MAXUSERS>;
-
-typedef utmpidle utmpidlearr<MAXUSERS>;
-
-program RUSERSPROG {
- /*
- * Includes idle information
- */
- version RUSERSVERS_IDLE {
- int
- RUSERSPROC_NUM(void) = 1;
-
- utmpidlearr
- RUSERSPROC_NAMES(void) = 2;
-
- utmpidlearr
- RUSERSPROC_ALLNAMES(void) = 3;
- } = 1;
-
- /*
- * Old version does not include idle information
- */
- version RUSERSVERS_ORIG {
- int
- RUSERSPROC_NUM(void) = 1;
-
- utmparr
- RUSERSPROC_NAMES(void) = 2;
-
- utmparr
- RUSERSPROC_ALLNAMES(void) = 3;
- } = 2;
-} = 100002;
-
diff --git a/lib/librpc/rpcsvc/rquota.x b/lib/librpc/rpcsvc/rquota.x
deleted file mode 100644
index 62888f6..0000000
--- a/lib/librpc/rpcsvc/rquota.x
+++ /dev/null
@@ -1,61 +0,0 @@
-/* @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */
-
-/*
- * Remote quota protocol
- * Requires unix authentication
- */
-
-const RQ_PATHLEN = 1024;
-
-struct getquota_args {
- string gqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */
- int gqa_uid; /* inquire about quota for uid */
-};
-
-/*
- * remote quota structure
- */
-struct rquota {
- int rq_bsize; /* block size for block counts */
- bool rq_active; /* indicates whether quota is active */
- unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */
- unsigned int rq_bsoftlimit; /* preferred limit on disk blks */
- unsigned int rq_curblocks; /* current block count */
- unsigned int rq_fhardlimit; /* absolute limit on allocated files */
- unsigned int rq_fsoftlimit; /* preferred file limit */
- unsigned int rq_curfiles; /* current # allocated files */
- unsigned int rq_btimeleft; /* time left for excessive disk use */
- unsigned int rq_ftimeleft; /* time left for excessive files */
-};
-
-enum gqr_status {
- Q_OK = 1, /* quota returned */
- Q_NOQUOTA = 2, /* noquota for uid */
- Q_EPERM = 3 /* no permission to access quota */
-};
-
-union getquota_rslt switch (gqr_status status) {
-case Q_OK:
- rquota gqr_rquota; /* valid if status == Q_OK */
-case Q_NOQUOTA:
- void;
-case Q_EPERM:
- void;
-};
-
-program RQUOTAPROG {
- version RQUOTAVERS {
- /*
- * Get all quotas
- */
- getquota_rslt
- RQUOTAPROC_GETQUOTA(getquota_args) = 1;
-
- /*
- * Get active quotas only
- */
- getquota_rslt
- RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
- } = 1;
-} = 100011;
diff --git a/lib/librpc/rpcsvc/rstat.c b/lib/librpc/rpcsvc/rstat.c
deleted file mode 100644
index fe83ae5..0000000
--- a/lib/librpc/rpcsvc/rstat.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* @(#)rstat.c 2.3 88/11/30 4.0 RPCSRC */
-/*
- * Simple program that prints the status of a remote host, in a format
- * similar to that used by the 'w' command, using the rstat.x service.
- */
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <rpc/rpc.h> /* include <sys/time.h> */
-#include "rstat.h"
-
-main(argc, argv)
-int argc;
-char **argv;
-{
-
- char *host;
- CLIENT *rstat_clnt;
- statstime *host_stat;
- struct tm *tmp_time;
- struct tm host_time;
- struct tm host_uptime;
- char days_buf[16];
- char hours_buf[16];
-
- if (argc != 2)
- {
- fprintf(stderr, "usage: %s \"host\"\n", argv[0]);
- exit(1);
- }
-
- host = argv[1];
-
- /* client handle to rstat */
- rstat_clnt = clnt_create(host, RSTATPROG, RSTATVERS_TIME, "udp");
- if (rstat_clnt == NULL)
- {
- clnt_pcreateerror(argv[0]);
- exit(1);
- }
-
- host_stat = rstatproc_stats_3(NULL, rstat_clnt);
- if (host_stat == NULL)
- {
- clnt_perror(rstat_clnt, argv[0]);
- exit(1);
- }
-
- tmp_time = localtime(&host_stat->curtime.tv_sec);
- host_time = *tmp_time;
-
- host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
-
- tmp_time = gmtime(&host_stat->curtime.tv_sec);
- host_uptime = *tmp_time;
-
- if (host_uptime.tm_yday != 0)
- sprintf(days_buf, "%d day%s, ", host_uptime.tm_yday,
- (host_uptime.tm_yday > 1) ? "s" : "");
- else
- days_buf[0] = '\0';
-
- if (host_uptime.tm_hour != 0)
- sprintf(hours_buf, "%2d:%02d,",
- host_uptime.tm_hour, host_uptime.tm_min);
- else
- if (host_uptime.tm_min != 0)
- sprintf(hours_buf, "%2d mins,", host_uptime.tm_min);
- else
- hours_buf[0] = '\0';
-
- printf(" %2d:%02d%cm up %s%s load average: %.2f %.2f %.2f\n",
- (host_time.tm_hour > 12) ? host_time.tm_hour - 12
- : host_time.tm_hour,
- host_time.tm_min,
- (host_time.tm_hour >= 12) ? 'p'
- : 'a',
- days_buf,
- hours_buf,
- (double)host_stat->avenrun[0]/FSCALE,
- (double)host_stat->avenrun[1]/FSCALE,
- (double)host_stat->avenrun[2]/FSCALE);
-
- exit(0);
-}
diff --git a/lib/librpc/rpcsvc/rstat.x b/lib/librpc/rpcsvc/rstat.x
deleted file mode 100644
index 6367c43..0000000
--- a/lib/librpc/rpcsvc/rstat.x
+++ /dev/null
@@ -1,145 +0,0 @@
-/* @(#)rstat.x 2.2 88/08/01 4.0 RPCSRC */
-/* @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Gather statistics on remote machines
- */
-
-#ifdef RPC_HDR
-
-%#ifndef FSCALE
-%/*
-% * Scale factor for scaled integers used to count load averages.
-% */
-%#define FSHIFT 8 /* bits to right of fixed binary point */
-%#define FSCALE (1<<FSHIFT)
-%
-%#endif /* ndef FSCALE */
-
-#endif /* def RPC_HDR */
-
-const CPUSTATES = 4;
-const DK_NDRIVE = 4;
-
-/*
- * GMT since 0:00, January 1, 1970
- */
-struct rstat_timeval {
- unsigned int tv_sec; /* seconds */
- unsigned int tv_usec; /* and microseconds */
-};
-
-struct statstime { /* RSTATVERS_TIME */
- int cp_time[CPUSTATES];
- int dk_xfer[DK_NDRIVE];
- unsigned int v_pgpgin; /* these are cumulative sum */
- unsigned int v_pgpgout;
- unsigned int v_pswpin;
- unsigned int v_pswpout;
- unsigned int v_intr;
- int if_ipackets;
- int if_ierrors;
- int if_oerrors;
- int if_collisions;
- unsigned int v_swtch;
- int avenrun[3]; /* scaled by FSCALE */
- rstat_timeval boottime;
- rstat_timeval curtime;
- int if_opackets;
-};
-
-struct statsswtch { /* RSTATVERS_SWTCH */
- int cp_time[CPUSTATES];
- int dk_xfer[DK_NDRIVE];
- unsigned int v_pgpgin; /* these are cumulative sum */
- unsigned int v_pgpgout;
- unsigned int v_pswpin;
- unsigned int v_pswpout;
- unsigned int v_intr;
- int if_ipackets;
- int if_ierrors;
- int if_oerrors;
- int if_collisions;
- unsigned int v_swtch;
- unsigned int avenrun[3];/* scaled by FSCALE */
- rstat_timeval boottime;
- int if_opackets;
-};
-
-struct stats { /* RSTATVERS_ORIG */
- int cp_time[CPUSTATES];
- int dk_xfer[DK_NDRIVE];
- unsigned int v_pgpgin; /* these are cumulative sum */
- unsigned int v_pgpgout;
- unsigned int v_pswpin;
- unsigned int v_pswpout;
- unsigned int v_intr;
- int if_ipackets;
- int if_ierrors;
- int if_oerrors;
- int if_collisions;
- int if_opackets;
-};
-
-
-program RSTATPROG {
- /*
- * Newest version includes current time and context switching info
- */
- version RSTATVERS_TIME {
- statstime
- RSTATPROC_STATS(void) = 1;
-
- unsigned int
- RSTATPROC_HAVEDISK(void) = 2;
- } = 3;
- /*
- * Does not have current time
- */
- version RSTATVERS_SWTCH {
- statsswtch
- RSTATPROC_STATS(void) = 1;
-
- unsigned int
- RSTATPROC_HAVEDISK(void) = 2;
- } = 2;
- /*
- * Old version has no info about current time or context switching
- */
- version RSTATVERS_ORIG {
- stats
- RSTATPROC_STATS(void) = 1;
-
- unsigned int
- RSTATPROC_HAVEDISK(void) = 2;
- } = 1;
-} = 100001;
diff --git a/lib/librpc/rpcsvc/rstat_proc.c b/lib/librpc/rpcsvc/rstat_proc.c
deleted file mode 100644
index 635120c..0000000
--- a/lib/librpc/rpcsvc/rstat_proc.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC */
-#ifndef lint
-static char sccsid[] = "@(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * Copyright (c) 1984 by Sun Microsystems, Inc.
- */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * rstat service: built with rstat.x and derived from rpc.rstatd.c
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <nlist.h>
-#include <sys/dk.h>
-#include <sys/errno.h>
-#include <sys/vmmeter.h>
-#include <net/if.h>
-#include "rstat.h"
-
-struct nlist nl[] = {
-#define X_CPTIME 0
- { "_cp_time" },
-#define X_SUM 1
- { "_sum" },
-#define X_IFNET 2
- { "_ifnet" },
-#define X_DKXFER 3
- { "_dk_xfer" },
-#define X_BOOTTIME 4
- { "_boottime" },
-#define X_AVENRUN 5
- { "_avenrun" },
-#define X_HZ 6
- { "_hz" },
- "",
-};
-int kmem;
-int firstifnet, numintfs; /* chain of ethernet interfaces */
-int stats_service();
-
-/*
- * Define EXIT_WHEN_IDLE if you are able to have this program invoked
- * automatically on demand (as from inetd). When defined, the service
- * will terminated after being idle for 20 seconds.
- */
-int sincelastreq = 0; /* number of alarms since last request */
-#ifdef EXIT_WHEN_IDLE
-#define CLOSEDOWN 20 /* how long to wait before exiting */
-#endif /* def EXIT_WHEN_IDLE */
-
-union {
- struct stats s1;
- struct statsswtch s2;
- struct statstime s3;
-} stats_all;
-
-int updatestat();
-static stat_is_init = 0;
-extern int errno;
-
-#ifndef FSCALE
-#define FSCALE (1 << 8)
-#endif
-
-stat_init()
-{
- stat_is_init = 1;
- setup();
- updatestat();
- alarm(1);
- signal(SIGALRM, updatestat);
- sleep(1); /* allow for one wake-up */
-}
-
-statstime *
-rstatproc_stats_3()
-{
- if (! stat_is_init)
- stat_init();
- sincelastreq = 0;
- return(&stats_all.s3);
-}
-
-statsswtch *
-rstatproc_stats_2()
-{
- if (! stat_is_init)
- stat_init();
- sincelastreq = 0;
- return(&stats_all.s2);
-}
-
-stats *
-rstatproc_stats_1()
-{
- if (! stat_is_init)
- stat_init();
- sincelastreq = 0;
- return(&stats_all.s1);
-}
-
-u_int *
-rstatproc_havedisk_3()
-{
- static u_int have;
-
- if (! stat_is_init)
- stat_init();
- sincelastreq = 0;
- have = havedisk();
- return(&have);
-}
-
-u_int *
-rstatproc_havedisk_2()
-{
- return(rstatproc_havedisk_3());
-}
-
-u_int *
-rstatproc_havedisk_1()
-{
- return(rstatproc_havedisk_3());
-}
-
-updatestat()
-{
- int off, i, hz;
- struct vmmeter sum;
- struct ifnet ifnet;
- double avrun[3];
- struct timeval tm, btm;
-
-#ifdef DEBUG
- fprintf(stderr, "entering updatestat\n");
-#endif
-#ifdef EXIT_WHEN_IDLE
- if (sincelastreq >= CLOSEDOWN) {
-#ifdef DEBUG
- fprintf(stderr, "about to closedown\n");
-#endif
- exit(0);
- }
- sincelastreq++;
-#endif /* def EXIT_WHEN_IDLE */
- if (lseek(kmem, (long)nl[X_HZ].n_value, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)&hz, sizeof hz) != sizeof hz) {
- fprintf(stderr, "rstat: can't read hz from kmem\n");
- exit(1);
- }
- if (lseek(kmem, (long)nl[X_CPTIME].n_value, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)stats_all.s1.cp_time, sizeof (stats_all.s1.cp_time))
- != sizeof (stats_all.s1.cp_time)) {
- fprintf(stderr, "rstat: can't read cp_time from kmem\n");
- exit(1);
- }
- if (lseek(kmem, (long)nl[X_AVENRUN].n_value, 0) ==-1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
-#ifdef vax
- if (read(kmem, (char *)avrun, sizeof (avrun)) != sizeof (avrun)) {
- fprintf(stderr, "rstat: can't read avenrun from kmem\n");
- exit(1);
- }
- stats_all.s2.avenrun[0] = avrun[0] * FSCALE;
- stats_all.s2.avenrun[1] = avrun[1] * FSCALE;
- stats_all.s2.avenrun[2] = avrun[2] * FSCALE;
-#endif
- if (lseek(kmem, (long)nl[X_BOOTTIME].n_value, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)&btm, sizeof (stats_all.s2.boottime))
- != sizeof (stats_all.s2.boottime)) {
- fprintf(stderr, "rstat: can't read boottime from kmem\n");
- exit(1);
- }
- stats_all.s2.boottime.tv_sec = btm.tv_sec;
- stats_all.s2.boottime.tv_usec = btm.tv_usec;
-
-
-#ifdef DEBUG
- fprintf(stderr, "%d %d %d %d\n", stats_all.s1.cp_time[0],
- stats_all.s1.cp_time[1], stats_all.s1.cp_time[2], stats_all.s1.cp_time[3]);
-#endif
-
- if (lseek(kmem, (long)nl[X_SUM].n_value, 0) ==-1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)&sum, sizeof sum) != sizeof sum) {
- fprintf(stderr, "rstat: can't read sum from kmem\n");
- exit(1);
- }
- stats_all.s1.v_pgpgin = sum.v_pgpgin;
- stats_all.s1.v_pgpgout = sum.v_pgpgout;
- stats_all.s1.v_pswpin = sum.v_pswpin;
- stats_all.s1.v_pswpout = sum.v_pswpout;
- stats_all.s1.v_intr = sum.v_intr;
- gettimeofday(&tm, (struct timezone *) 0);
- stats_all.s1.v_intr -= hz*(tm.tv_sec - btm.tv_sec) +
- hz*(tm.tv_usec - btm.tv_usec)/1000000;
- stats_all.s2.v_swtch = sum.v_swtch;
-
- if (lseek(kmem, (long)nl[X_DKXFER].n_value, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)stats_all.s1.dk_xfer, sizeof (stats_all.s1.dk_xfer))
- != sizeof (stats_all.s1.dk_xfer)) {
- fprintf(stderr, "rstat: can't read dk_xfer from kmem\n");
- exit(1);
- }
-
- stats_all.s1.if_ipackets = 0;
- stats_all.s1.if_opackets = 0;
- stats_all.s1.if_ierrors = 0;
- stats_all.s1.if_oerrors = 0;
- stats_all.s1.if_collisions = 0;
- for (off = firstifnet, i = 0; off && i < numintfs; i++) {
- if (lseek(kmem, (long)off, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)&ifnet, sizeof ifnet) != sizeof ifnet) {
- fprintf(stderr, "rstat: can't read ifnet from kmem\n");
- exit(1);
- }
- stats_all.s1.if_ipackets += ifnet.if_ipackets;
- stats_all.s1.if_opackets += ifnet.if_opackets;
- stats_all.s1.if_ierrors += ifnet.if_ierrors;
- stats_all.s1.if_oerrors += ifnet.if_oerrors;
- stats_all.s1.if_collisions += ifnet.if_collisions;
- off = (int) ifnet.if_next;
- }
- gettimeofday((struct timeval *)&stats_all.s3.curtime,
- (struct timezone *) 0);
- alarm(1);
-}
-
-static
-setup()
-{
- struct ifnet ifnet;
- int off;
-
- nlist("/vmunix", nl);
- if (nl[0].n_value == 0) {
- fprintf(stderr, "rstat: Variables missing from namelist\n");
- exit (1);
- }
- if ((kmem = open("/dev/kmem", 0)) < 0) {
- fprintf(stderr, "rstat: can't open kmem\n");
- exit(1);
- }
-
- off = nl[X_IFNET].n_value;
- if (lseek(kmem, (long)off, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)&firstifnet, sizeof(int)) != sizeof (int)) {
- fprintf(stderr, "rstat: can't read firstifnet from kmem\n");
- exit(1);
- }
- numintfs = 0;
- for (off = firstifnet; off;) {
- if (lseek(kmem, (long)off, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)&ifnet, sizeof ifnet) != sizeof ifnet) {
- fprintf(stderr, "rstat: can't read ifnet from kmem\n");
- exit(1);
- }
- numintfs++;
- off = (int) ifnet.if_next;
- }
-}
-
-/*
- * returns true if have a disk
- */
-static
-havedisk()
-{
- int i, cnt;
- long xfer[DK_NDRIVE];
-
- nlist("/vmunix", nl);
- if (nl[X_DKXFER].n_value == 0) {
- fprintf(stderr, "rstat: Variables missing from namelist\n");
- exit (1);
- }
- if ((kmem = open("/dev/kmem", 0)) < 0) {
- fprintf(stderr, "rstat: can't open kmem\n");
- exit(1);
- }
- if (lseek(kmem, (long)nl[X_DKXFER].n_value, 0) == -1) {
- fprintf(stderr, "rstat: can't seek in kmem\n");
- exit(1);
- }
- if (read(kmem, (char *)xfer, sizeof xfer)!= sizeof xfer) {
- fprintf(stderr, "rstat: can't read kmem\n");
- exit(1);
- }
- cnt = 0;
- for (i=0; i < DK_NDRIVE; i++)
- cnt += xfer[i];
- return (cnt != 0);
-}
diff --git a/lib/librpc/rpcsvc/sm_inter.x b/lib/librpc/rpcsvc/sm_inter.x
deleted file mode 100644
index 2817ebf..0000000
--- a/lib/librpc/rpcsvc/sm_inter.x
+++ /dev/null
@@ -1,116 +0,0 @@
-/* @(#)sm_inter.x 2.2 88/08/01 4.0 RPCSRC */
-/* @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Status monitor protocol specification
- * Copyright (C) 1986 Sun Microsystems, Inc.
- *
- */
-
-
-program SM_PROG {
- version SM_VERS {
- /* res_stat = stat_succ if status monitor agrees to monitor */
- /* res_stat = stat_fail if status monitor cannot monitor */
- /* if res_stat == stat_succ, state = state number of site sm_name */
- struct sm_stat_res SM_STAT(struct sm_name) = 1;
-
- /* res_stat = stat_succ if status monitor agrees to monitor */
- /* res_stat = stat_fail if status monitor cannot monitor */
- /* stat consists of state number of local site */
- struct sm_stat_res SM_MON(struct mon) = 2;
-
- /* stat consists of state number of local site */
- struct sm_stat SM_UNMON(struct mon_id) = 3;
-
- /* stat consists of state number of local site */
- struct sm_stat SM_UNMON_ALL(struct my_id) = 4;
-
- void SM_SIMU_CRASH(void) = 5;
-
- } = 1;
-} = 100024;
-
-const SM_MAXSTRLEN = 1024;
-
-struct sm_name {
- string mon_name<SM_MAXSTRLEN>;
-};
-
-struct my_id {
- string my_name<SM_MAXSTRLEN>; /* name of the site iniates the monitoring request*/
- int my_prog; /* rpc program # of the requesting process */
- int my_vers; /* rpc version # of the requesting process */
- int my_proc; /* rpc procedure # of the requesting process */
-};
-
-struct mon_id {
- string mon_name<SM_MAXSTRLEN>; /* name of the site to be monitored */
- struct my_id my_id;
-};
-
-
-struct mon{
- struct mon_id mon_id;
- opaque priv[16]; /* private information to store at monitor for requesting process */
-};
-
-
-/*
- * state # of status monitor monitonically increases each time
- * status of the site changes:
- * an even number (>= 0) indicates the site is down and
- * an odd number (> 0) indicates the site is up;
- */
-struct sm_stat {
- int state; /* state # of status monitor */
-};
-
-enum res {
- stat_succ = 0, /* status monitor agrees to monitor */
- stat_fail = 1 /* status monitor cannot monitor */
-};
-
-struct sm_stat_res {
- res res_stat;
- int state;
-};
-
-/*
- * structure of the status message sent back by the status monitor
- * when monitor site status changes
- */
-struct status {
- string mon_name<SM_MAXSTRLEN>;
- int state;
- opaque priv[16]; /* stored private information */
-};
diff --git a/lib/librpc/rpcsvc/spray.x b/lib/librpc/rpcsvc/spray.x
deleted file mode 100644
index b242f0a..0000000
--- a/lib/librpc/rpcsvc/spray.x
+++ /dev/null
@@ -1,84 +0,0 @@
-/* @(#)spray.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Spray a server with packets
- * Useful for testing flakiness of network interfaces
- */
-
-const SPRAYMAX = 8845; /* max amount can spray */
-
-/*
- * GMT since 0:00, 1 January 1970
- */
-struct spraytimeval {
- unsigned int sec;
- unsigned int usec;
-};
-
-/*
- * spray statistics
- */
-struct spraycumul {
- unsigned int counter;
- spraytimeval clock;
-};
-
-/*
- * spray data
- */
-typedef opaque sprayarr<SPRAYMAX>;
-
-program SPRAYPROG {
- version SPRAYVERS {
- /*
- * Just throw away the data and increment the counter
- * This call never returns, so the client should always
- * time it out.
- */
- void
- SPRAYPROC_SPRAY(sprayarr) = 1;
-
- /*
- * Get the value of the counter and elapsed time since
- * last CLEAR.
- */
- spraycumul
- SPRAYPROC_GET(void) = 2;
-
- /*
- * Clear the counter and reset the elapsed time
- */
- void
- SPRAYPROC_CLEAR(void) = 3;
- } = 1;
-} = 100012;
diff --git a/lib/librpc/rpcsvc/yp.x b/lib/librpc/rpcsvc/yp.x
deleted file mode 100644
index 8fe70a2..0000000
--- a/lib/librpc/rpcsvc/yp.x
+++ /dev/null
@@ -1,291 +0,0 @@
-/* @(#)yp.x 2.1 88/08/01 4.0 RPCSRC */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Protocol description file for the Yellow Pages Service
- */
-
-const YPMAXRECORD = 1024;
-const YPMAXDOMAIN = 64;
-const YPMAXMAP = 64;
-const YPMAXPEER = 64;
-
-
-enum ypstat {
- YP_TRUE = 1,
- YP_NOMORE = 2,
- YP_FALSE = 0,
- YP_NOMAP = -1,
- YP_NODOM = -2,
- YP_NOKEY = -3,
- YP_BADOP = -4,
- YP_BADDB = -5,
- YP_YPERR = -6,
- YP_BADARGS = -7,
- YP_VERS = -8
-};
-
-
-enum ypxfrstat {
- YPXFR_SUCC = 1,
- YPXFR_AGE = 2,
- YPXFR_NOMAP = -1,
- YPXFR_NODOM = -2,
- YPXFR_RSRC = -3,
- YPXFR_RPC = -4,
- YPXFR_MADDR = -5,
- YPXFR_YPERR = -6,
- YPXFR_BADARGS = -7,
- YPXFR_DBM = -8,
- YPXFR_FILE = -9,
- YPXFR_SKEW = -10,
- YPXFR_CLEAR = -11,
- YPXFR_FORCE = -12,
- YPXFR_XFRERR = -13,
- YPXFR_REFUSED = -14
-};
-
-
-typedef string domainname<YPMAXDOMAIN>;
-typedef string mapname<YPMAXMAP>;
-typedef string peername<YPMAXPEER>;
-typedef opaque keydat<YPMAXRECORD>;
-typedef opaque valdat<YPMAXRECORD>;
-
-
-struct ypmap_parms {
- domainname domain;
- mapname map;
- unsigned int ordernum;
- peername peer;
-};
-
-struct ypreq_key {
- domainname domain;
- mapname map;
- keydat key;
-};
-
-struct ypreq_nokey {
- domainname domain;
- mapname map;
-};
-
-struct ypreq_xfr {
- ypmap_parms map_parms;
- unsigned int transid;
- unsigned int prog;
- unsigned int port;
-};
-
-
-struct ypresp_val {
- ypstat stat;
- valdat val;
-};
-
-struct ypresp_key_val {
- ypstat stat;
- keydat key;
- valdat val;
-};
-
-
-struct ypresp_master {
- ypstat stat;
- peername peer;
-};
-
-struct ypresp_order {
- ypstat stat;
- unsigned int ordernum;
-};
-
-union ypresp_all switch (bool more) {
-case TRUE:
- ypresp_key_val val;
-case FALSE:
- void;
-};
-
-struct ypresp_xfr {
- unsigned int transid;
- ypxfrstat xfrstat;
-};
-
-struct ypmaplist {
- mapname map;
- ypmaplist *next;
-};
-
-struct ypresp_maplist {
- ypstat stat;
- ypmaplist *maps;
-};
-
-enum yppush_status {
- YPPUSH_SUCC = 1, /* Success */
- YPPUSH_AGE = 2, /* Master's version not newer */
- YPPUSH_NOMAP = -1, /* Can't find server for map */
- YPPUSH_NODOM = -2, /* Domain not supported */
- YPPUSH_RSRC = -3, /* Local resource alloc failure */
- YPPUSH_RPC = -4, /* RPC failure talking to server */
- YPPUSH_MADDR = -5, /* Can't get master address */
- YPPUSH_YPERR = -6, /* YP server/map db error */
- YPPUSH_BADARGS = -7, /* Request arguments bad */
- YPPUSH_DBM = -8, /* Local dbm operation failed */
- YPPUSH_FILE = -9, /* Local file I/O operation failed */
- YPPUSH_SKEW = -10, /* Map version skew during transfer */
- YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */
- YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */
- YPPUSH_XFRERR = -13, /* ypxfr error */
- YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */
-};
-
-struct yppushresp_xfr {
- unsigned transid;
- yppush_status status;
-};
-
-/*
- * Response structure and overall result status codes. Success and failure
- * represent two separate response message types.
- */
-
-enum ypbind_resptype {
- YPBIND_SUCC_VAL = 1,
- YPBIND_FAIL_VAL = 2
-};
-
-struct ypbind_binding {
- opaque ypbind_binding_addr[4]; /* In network order */
- opaque ypbind_binding_port[2]; /* In network order */
-};
-
-union ypbind_resp switch (ypbind_resptype ypbind_status) {
-case YPBIND_FAIL_VAL:
- unsigned ypbind_error;
-case YPBIND_SUCC_VAL:
- ypbind_binding ypbind_bindinfo;
-};
-
-/* Detailed failure reason codes for response field ypbind_error*/
-
-const YPBIND_ERR_ERR = 1; /* Internal error */
-const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */
-const YPBIND_ERR_RESC = 3; /* System resource allocation failure */
-
-
-/*
- * Request data structure for ypbind "Set domain" procedure.
- */
-struct ypbind_setdom {
- domainname ypsetdom_domain;
- ypbind_binding ypsetdom_binding;
- unsigned ypsetdom_vers;
-};
-
-
-/*
- * YP access protocol
- */
-program YPPROG {
- version YPVERS {
- void
- YPPROC_NULL(void) = 0;
-
- bool
- YPPROC_DOMAIN(domainname) = 1;
-
- bool
- YPPROC_DOMAIN_NONACK(domainname) = 2;
-
- ypresp_val
- YPPROC_MATCH(ypreq_key) = 3;
-
- ypresp_key_val
- YPPROC_FIRST(ypreq_key) = 4;
-
- ypresp_key_val
- YPPROC_NEXT(ypreq_key) = 5;
-
- ypresp_xfr
- YPPROC_XFR(ypreq_xfr) = 6;
-
- void
- YPPROC_CLEAR(void) = 7;
-
- ypresp_all
- YPPROC_ALL(ypreq_nokey) = 8;
-
- ypresp_master
- YPPROC_MASTER(ypreq_nokey) = 9;
-
- ypresp_order
- YPPROC_ORDER(ypreq_nokey) = 10;
-
- ypresp_maplist
- YPPROC_MAPLIST(domainname) = 11;
- } = 2;
-} = 100004;
-
-
-/*
- * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
- */
-program YPPUSH_XFRRESPPROG {
- version YPPUSH_XFRRESPVERS {
- void
- YPPUSHPROC_NULL(void) = 0;
-
- yppushresp_xfr
- YPPUSHPROC_XFRRESP(void) = 1;
- } = 1;
-} = 0x40000000; /* transient: could be anything up to 0x5fffffff */
-
-
-/*
- * YP binding protocol
- */
-program YPBINDPROG {
- version YPBINDVERS {
- void
- YPBINDPROC_NULL(void) = 0;
-
- ypbind_resp
- YPBINDPROC_DOMAIN(domainname) = 1;
-
- void
- YPBINDPROC_SETDOM(ypbind_setdom) = 2;
- } = 2;
-} = 100007;
-
-
diff --git a/lib/librpc/rpcsvc/yppasswd.x b/lib/librpc/rpcsvc/yppasswd.x
deleted file mode 100644
index ad349ad..0000000
--- a/lib/librpc/rpcsvc/yppasswd.x
+++ /dev/null
@@ -1,63 +0,0 @@
-/* @(#)yppasswd.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)yppasswd.x 1.1 87/04/13 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * YP password update protocol
- * Requires unix authentication
- */
-program YPPASSWDPROG {
- version YPPASSWDVERS {
- /*
- * Update my passwd entry
- */
- int
- YPPASSWDPROC_UPDATE(yppasswd) = 1;
- } = 1;
-} = 100009;
-
-
-struct passwd {
- string pw_name<>; /* username */
- string pw_passwd<>; /* encrypted password */
- int pw_uid; /* user id */
- int pw_gid; /* group id */
- string pw_gecos<>; /* in real life name */
- string pw_dir<>; /* home directory */
- string pw_shell<>; /* default shell */
-};
-
-struct yppasswd {
- string oldpass<>; /* unencrypted old password */
- passwd newpw; /* new passwd entry */
-};
-
-
diff --git a/lib/librpc/secure_rpc/README b/lib/librpc/secure_rpc/README
deleted file mode 100644
index b8a860e..0000000
--- a/lib/librpc/secure_rpc/README
+++ /dev/null
@@ -1,92 +0,0 @@
-Export restriction prohibit us from including DES encryption routines in RPCSRC
-4.0. The main RPCSRC 4.0 hierarchy does not include DES Authentication,
-however this directory contains the documentation and code used to build secure
-rpc. THIS DISTRIBUTION OF SECURE RPC NEEDS EXTENSIVE WORK BEFORE IT CAN BE
-USED. PLEASE READ THE PORTING GUIDLINES BELOW.
-
-HIERARCHY
-
-bin/
-
- This directory contains chkey and keylogin. These are user programs
- used to establish the credentials of an RPC user.
-
-demo/
- The 'whoami' service is found here. It can be used to test secure RPC.
- rpcgen is used to build the client and server.
-
-des/
-
- des_crypt.h defines the interfaces to cbc_crypt() and ecb_crypt(),
- the DES routines used by DES Authentication.
- des.h defines the desparams structure that is used internally by
- these routines. Secure RPC expects it to be installed in
- /usr/include/sys.
- des_crypt.c defines the cbc_crypt() and ecb_crypt() routines. These
- eventually call the routine _des_crypt(), which is *not* provided.
- des_soft.c contains the des_setparity() routine.
-
-doc/
-
- The document "nfs.secure.ms" is found here. It describes Secure
- RPC and Secure NFS.
-
-keyserv/
-
- This is an RPC based program that stores the private keys for
- users that are using secure RPC.
-
-man/
-
- Manual pages for the programs and library routines are found here.
-
-rpc/
-
- The routines in this directory should be integrated with the
- default rpc directory to make a single RPC library. The Makefile
- found in this directory replaces the one in ../rpc. Note: the file
- svc_auth.c in this directory replaces the one in ../rpc. Also, the
- file ../rpc/rpc.h should be edited to include the file <rpc/des_auth.h>
- (it presently is commented out).
-
-PORTING GUIDELINES
-
-You will need to provide a DES encryption routine. man/des_crypt.3 describes
-the interface to ecb_crypt() and cbc_crypt() (secure RPC uses both modes). The
-des/ directory has the "front-end" for these routines in the des_crypt.c file.
-
-Since public key authentication systems require a network global data lookup
-facility, this implementation uses Sun's Yellow Pages. If your site does not
-have Yellow Pages, you will have to modify the routines in rpc/publickey.c and
-bin/chkey.c. One possible approach is to replace the YP calls with code to
-read the file /etc/publickey; this file would presumably be shared by all
-secure RPC sites via NFS or some equivalent file sharing facility. If you wish
-to implement YP yourself, the RPCL (.x) protocol description file can be found
-in ../rpcsvc/yp.x.
-
-The routines in rpc/ and keyserv/ assume that the file des/des_crypt.h
-is installed in /usr/include (they include <des_crypt.h>). The file
-des/des_crypt.c assumes that des.h is installed in /usr/include/sys (it
-include <sys/des.h>). The des/ directory does not have a Makefile that
-would install these header files, so you will either have to do this
-by hand, or modify the routines to include the header files in a way suitable
-for your site.
-
-While the programs in bin/ and keyserv/ can be built in place (assuming
-the header files they include and the RPC library are available), the files
-in rpc/ must be moved into ../rpc/, the main RPC library. The Makefile and
-svc_auth.c found in rpc/ will replace those found in ../rpc/. You must also
-edit ../rpc/rpc.h to include <rpc/des_auth.h>.
-
-OPERATION
-
-Please read the documentation and manual pages for information on how to
-administer secure RPC.
-
-In the demo/ directory you'll find the 'whoami' service. This service uses DES
-Authentication, and can be used to check out secure RPC. The client program,
-'rme' takes a host as an argument. This host must be running the keyserv
-daemon and the 'whoami_svc' server. The service returns the identity of the
-client-user as known to the system on which the server is running. This
-information is only returned, however, if the client request has proper DES
-credentials.
diff --git a/lib/librpc/secure_rpc/bin/Makefile b/lib/librpc/secure_rpc/bin/Makefile
deleted file mode 100644
index 9d08018..0000000
--- a/lib/librpc/secure_rpc/bin/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/10 4.0 RPCSRC
-#
-DESTDIR=
-CFLAGS= -O
-RPCLIB= -lrpclib
-
-# C programs that live in the current directory and need explicit make lines.
-# (make depend has special rules for these files)
-#
-NSTD= chkey keylogin
-
-all: ${NSTD}
-
-chkey: chkey.c
- ${CC} ${CFLAGS} -o chkey chkey.c -lrpcsvc -lmp ${RPCLIB}
-
-keylogin: keylogin.c
- ${CC} ${CFLAGS} -o keylogin keylogin.c -lrpcsvc ${RPCLIB}
-
-install:
- -for i in ${NSTD}; do \
- (install -s $$i ${DESTDIR}/usr/bin/$$i); done
-
-clean:
- rm -f a.out core *.s *.o
- rm -f ${NSTD}
-
-depend:
- for i in ${NSTD}; do \
- cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \
- awk ' { if ($$1 != prev) \
- { if (rec != "") print rec; rec = $$0; prev = $$1; } \
- else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
- else rec = rec " " $$2 } } \
- END { print rec } ' >> makedep; done
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile
-
-# Files listed in ${NSTD} have explicit make lines given below.
-
-# DO NOT DELETE THIS LINE -- make depend uses it
-
diff --git a/lib/librpc/secure_rpc/bin/chkey.c b/lib/librpc/secure_rpc/bin/chkey.c
deleted file mode 100644
index eefb34e..0000000
--- a/lib/librpc/secure_rpc/bin/chkey.c
+++ /dev/null
@@ -1,302 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)chkey.c 2.3 88/08/15 4.0 RPCSRC";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * Command to change one's public key in the public key database
- */
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-#include <rpcsvc/ypclnt.h>
-#include <sys/file.h>
-#include <pwd.h>
-#include <mp.h>
-
-extern char *getpass();
-extern char *index();
-extern char *crypt();
-extern char *sprintf();
-extern long random();
-
-static char PKMAP[] = "publickey.byname";
-static char *domain;
-struct passwd *ypgetpwuid();
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- char name[MAXNETNAMELEN+1];
- char public[HEXKEYBYTES + 1];
- char secret[HEXKEYBYTES + 1];
- char crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
- char crypt2[HEXKEYBYTES + KEYCHECKSUMSIZE + 1];
- int status;
- char *pass;
- struct passwd *pw;
- char *master;
- int euid;
- int fd;
- int force;
- char *self;
-
- self = argv[0];
- force = 0;
- for (argc--, argv++; argc > 0 && **argv == '-'; argc--, argv++) {
- if (argv[0][2] != 0) {
- usage(self);
- }
- switch (argv[0][1]) {
- case 'f':
- force = 1;
- break;
- default:
- usage(self);
- }
- }
- if (argc != 0) {
- usage(self);
- }
-
- (void)yp_get_default_domain(&domain);
- if (yp_master(domain, PKMAP, &master) != 0) {
- (void)fprintf(stderr,
- "can't find master of publickey database\n");
- exit(1);
- }
-
- getnetname(name);
- (void)printf("Generating new key for %s.\n", name);
-
- euid = geteuid();
- if (euid != 0) {
- pw = ypgetpwuid(euid);
- if (pw == NULL) {
- (void)fprintf(stderr,
- "No yp password found: can't change key.\n");
- exit(1);
- }
- } else {
- pw = getpwuid(0);
- if (pw == NULL) {
- (void)fprintf(stderr,
- "No password found: can't change key.\n");
- exit(1);
- }
- }
- pass = getpass("Password:");
- if (!force) {
- if (strcmp(crypt(pass, pw->pw_passwd), pw->pw_passwd) != 0) {
- (void)fprintf(stderr, "Invalid password.\n");
- exit(1);
- }
- }
-
- genkeys(public, secret, pass);
-
- bcopy(secret, crypt1, HEXKEYBYTES);
- bcopy(secret, crypt1 + HEXKEYBYTES, KEYCHECKSUMSIZE);
- crypt1[HEXKEYBYTES + KEYCHECKSUMSIZE] = 0;
- xencrypt(crypt1, pass);
-
- if (force) {
- bcopy(crypt1, crypt2, HEXKEYBYTES + KEYCHECKSUMSIZE + 1);
- xdecrypt(crypt2, getpass("Retype password:"));
- if (bcmp(crypt2, crypt2 + HEXKEYBYTES, KEYCHECKSUMSIZE) != 0 ||
- bcmp(crypt2, secret, HEXKEYBYTES) != 0) {
- (void)fprintf(stderr, "Password incorrect.\n");
- exit(1);
- }
- }
-
- (void)printf("Sending key change request to %s...\n", master);
- status = setpublicmap(name, public, crypt1);
- if (status != 0) {
- (void)printf("%s: unable to update yp database (%u): %s\n",
- self, status, yperr_string(status));
- (void)printf("Perhaps %s is down?\n", master);
- exit(1);
- }
- (void)printf("Done.\n");
-
- if (key_setsecret(secret) < 0) {
- (void)printf("Unable to login with new secret key.\n");
- exit(1);
- }
-}
-
-usage(name)
- char *name;
-{
- (void)fprintf(stderr, "usage: %s [-f]\n", name);
- exit(1);
-}
-
-
-/*
- * Generate a seed
- */
-getseed(seed, seedsize, pass)
- char *seed;
- int seedsize;
- unsigned char *pass;
-{
- int i;
- int rseed;
- struct timeval tv;
-
- (void)gettimeofday(&tv, (struct timezone *)NULL);
- rseed = tv.tv_sec + tv.tv_usec;
- for (i = 0; i < 8; i++) {
- rseed ^= (rseed << 8) | pass[i];
- }
- srandom(rseed);
-
- for (i = 0; i < seedsize; i++) {
- seed[i] = (random() & 0xff) ^ pass[i % 8];
- }
-}
-
-
-/*
- * Generate a random public/secret key pair
- */
-genkeys(public, secret, pass)
- char *public;
- char *secret;
- char *pass;
-{
- int i;
-
-#define BASEBITS (8*sizeof(short) - 1)
-#define BASE (1 << BASEBITS)
-
- MINT *pk = itom(0);
- MINT *sk = itom(0);
- MINT *tmp;
- MINT *base = itom(BASE);
- MINT *root = itom(PROOT);
- MINT *modulus = xtom(HEXMODULUS);
- short r;
- unsigned short seed[KEYSIZE/BASEBITS + 1];
- char *xkey;
-
- getseed((char *)seed, sizeof(seed), (unsigned char *)pass);
- for (i = 0; i < KEYSIZE/BASEBITS + 1; i++) {
- r = seed[i] % BASE;
- tmp = itom(r);
- mult(sk, base, sk);
- madd(sk, tmp, sk);
- mfree(tmp);
- }
- tmp = itom(0);
- mdiv(sk, modulus, tmp, sk);
- mfree(tmp);
- pow(root, sk, modulus, pk);
- xkey = mtox(sk);
- adjust(secret, xkey);
- xkey = mtox(pk);
- adjust(public, xkey);
- mfree(sk);
- mfree(base);
- mfree(pk);
- mfree(root);
- mfree(modulus);
-}
-
-/*
- * Adjust the input key so that it is 0-filled on the left
- */
-adjust(keyout, keyin)
- char keyout[HEXKEYBYTES+1];
- char *keyin;
-{
- char *p;
- char *s;
-
- for (p = keyin; *p; p++)
- ;
- for (s = keyout + HEXKEYBYTES; p >= keyin; p--, s--) {
- *s = *p;
- }
- while (s >= keyout) {
- *s-- = '0';
- }
-}
-
-/*
- * Set the entry in the public key map
- */
-setpublicmap(name, public, secret)
- char *name;
- char *public;
- char *secret;
-{
- char pkent[1024];
- u_int rslt;
-
- (void)sprintf(pkent,"%s:%s", public, secret);
- rslt = yp_update(domain, PKMAP, YPOP_STORE,
- name, strlen(name), pkent, strlen(pkent));
- return (rslt);
-}
-
-struct passwd *
-ypgetpwuid(uid)
- int uid;
-{
- char uidstr[10];
- char *val;
- int vallen;
- static struct passwd pw;
- char *p;
-
- (void)sprintf(uidstr, "%d", uid);
- if (yp_match(domain, "passwd.byuid", uidstr, strlen(uidstr),
- &val, &vallen) != 0) {
- return (NULL);
- }
- p = index(val, ':');
- if (p == NULL) {
- return (NULL);
- }
- pw.pw_passwd = p + 1;
- p = index(pw.pw_passwd, ':');
- if (p == NULL) {
- return (NULL);
- }
- *p = 0;
- return (&pw);
-}
diff --git a/lib/librpc/secure_rpc/bin/keylogin.c b/lib/librpc/secure_rpc/bin/keylogin.c
deleted file mode 100644
index 0643f07..0000000
--- a/lib/librpc/secure_rpc/bin/keylogin.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)keylogin.c 2.2 88/08/10 4.0 RPCSRC";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * Set secret key on local machine
- */
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-
-main(argc,argv)
- int argc;
- char *argv[];
-{
- char fullname[MAXNETNAMELEN + 1];
- char secret[HEXKEYBYTES + 1];
- char *getpass();
-
- getnetname(fullname);
- if (! getsecretkey(fullname, secret, getpass("Password:"))) {
- fprintf(stderr, "Can't find %s's secret key\n", fullname);
- exit(1);
- }
- if (secret[0] == 0) {
- fprintf(stderr, "Password incorrect for %s\n", fullname);
- exit(1);
- }
- if (key_setsecret(secret) < 0) {
- fprintf(stderr, "Could not set %s's secret key\n", fullname);
- fprintf(stderr, "Maybe the keyserver is down?\n");
- exit(1);
- }
- exit(0);
-}
diff --git a/lib/librpc/secure_rpc/demo/Makefile b/lib/librpc/secure_rpc/demo/Makefile
deleted file mode 100644
index f1e62a7..0000000
--- a/lib/librpc/secure_rpc/demo/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# @(#)Makefile 2.2 88/08/15 4.0 RPCSRC
-#
-BIN = whoami_svc rme
-GEN = whoami_clnt.c whoami_svc.c whoami_xdr.c whoami.h
-LIB = -lrpclib
-#use this line on SunOS or NFSSRC-based systems.
-#LIB = -lrpcsvc
-RPCCOM = rpcgen
-
-all: $(BIN)
-
-$(GEN): whoami.x
- $(RPCCOM) whoami.x
-
-whoami_svc: whoami_proc.o whoami_svc.o whoami_xdr.o
- $(CC) -o $@ whoami_proc.o whoami_svc.o whoami_xdr.o $(LIB)
-
-rme: rme.o whoami_clnt.o whoami_xdr.o
- $(CC) -o $@ rme.o whoami_clnt.o whoami_xdr.o $(LIB)
-
-rme.o: rme.c whoami.h
-
-whoami_proc.o: whoami_proc.c whoami.h
-
-clean cleanup:
- rm -f $(GEN) *.o $(BIN)
-
diff --git a/lib/librpc/secure_rpc/demo/rme.c b/lib/librpc/secure_rpc/demo/rme.c
deleted file mode 100644
index 773eafa..0000000
--- a/lib/librpc/secure_rpc/demo/rme.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rme.c 2.3 88/09/09 4.0 RPCSRC";
-#endif
-/*
- * rme.c: secure identity verifier and reporter: client side
- */
-#include <rpc/rpc.h>
-#include <stdio.h>
-#include "whoami.h"
-
-/*
- * Before running this program, the user must have a key in the publickey
- * database, and must have logged in with a password (or used keylogin).
- * The user's machine and the server's machine must both be running keyserv.
- */
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- CLIENT *cl;
- char *server;
- remote_identity *remote_me;
- name *servername;
- void *nullp;
-
- if (argc != 2) {
- fprintf(stderr, "usage: %s host\n", argv[0]);
- exit(1);
- }
-
- /*
- * Remember what our command line argument refers to
- */
- server = argv[1];
-
- /*
- * Create client "handle" used for calling WHOAMI on the
- * server designated on the command line. We tell the rpc package
- * to use the "udp" protocol when contacting the server.
- */
- cl = clnt_create(server, WHOAMI, WHOAMI_V1, "udp");
- if (cl == NULL) {
- /*
- * Couldn't establish connection with server.
- * Print error message and die.
- */
- clnt_pcreateerror(server);
- exit(1);
- }
- /*
- * Get network identifier for server machine.
- */
- servername = whoami_whoru_1(nullp, cl);
- if (servername == NULL)
- {
- fprintf(stderr, "Trouble communicating with %s\n",
- clnt_sperror(cl, server));
- exit(1);
- }
- else if (*servername[0] == '\0')
- {
- fprintf(stderr, "Could not determine netname of WHOAMI server.\n");
- exit(1);
- }
- printf("Server's netname is: %s\n", *servername);
-
- /*
- * A wide window and no synchronization is used. Client and server
- * clock must be with five minutes of each other.
- */
- if ((cl->cl_auth = authdes_create(*servername, 300, NULL, NULL)) == NULL)
- {
- fprintf(stderr, "Could not establish DES credentials of netname %s\n",
- servername);
- exit(1);
- }
-
- /*
- * Find out who I am, in the server's point of view.
- */
- remote_me = whoami_iask_1(nullp, cl);
- if (remote_me == NULL)
- {
- fprintf(stderr, "Trouble getting my identity from %s\n",
- clnt_sperror(cl, server));
- exit(1);
- }
- /*
- * Print out my identity.
- */
- printf("My remote user name: %s\n", remote_me->remote_username);
- printf("My remote real name: %s\n", remote_me->remote_realname);
-
- exit(0);
-}
diff --git a/lib/librpc/secure_rpc/demo/whoami.x b/lib/librpc/secure_rpc/demo/whoami.x
deleted file mode 100644
index 041cd0a..0000000
--- a/lib/librpc/secure_rpc/demo/whoami.x
+++ /dev/null
@@ -1,33 +0,0 @@
-/* @(#)whoami.x 2.2 88/08/22 4.0 RPCSRC */
-
-const WHOAMI_NGROUPS = 16;
-
-typedef string name<MAXNETNAMELEN>;
-
-struct remote_identity {
- bool authenticated; /* TRUE if the server authenticates us */
- name remote_username; /* login name */
- name remote_realname; /* gcos-field name (long name) */
- int uid;
- int gid;
- int gids<WHOAMI_NGROUPS>;
-};
-
-program WHOAMI {
- version WHOAMI_V1 {
- /*
- * Report on the server's notion of the client's identity.
- * Will respond to AUTH_DES only.
- */
- remote_identity
- WHOAMI_IASK(void) = 1;
- /*
- * Return server's netname. AUTH_NONE is okay.
- * This routine allows this server to be started under any uid,
- * and the client can ask it its netname for use in authdes_create().
- */
- name
- WHOAMI_WHORU(void) = 2;
-
- } = 1;
-} = 80955;
diff --git a/lib/librpc/secure_rpc/demo/whoami_proc.c b/lib/librpc/secure_rpc/demo/whoami_proc.c
deleted file mode 100644
index 231d322..0000000
--- a/lib/librpc/secure_rpc/demo/whoami_proc.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)whoami_proc.c 2.3 89/07/11 4.0 RPCSRC";
-#endif
-/*
- * whoami_proc.c: secure identity verifier and reporter: server proc
- */
-#include <sys/param.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-#include <pwd.h>
-#include "whoami.h"
-
-extern char *strcpy();
-
-/*
- * Report on the server's notion of the client's identity.
- */
-remote_identity *
-whoami_iask_1(nullarg, rqstp)
- void *nullarg;
- struct svc_req *rqstp;
-{
-static remote_identity whoisthem;
-static char username[MAXNETNAMELEN+1];
-static char realname[MAXNETNAMELEN+1]; /* really gecos field */
-static int grouplist[NGROUPS];
- char publickey[HEXKEYBYTES+1];
-
- struct authdes_cred *des_cred;
- struct passwd *pwdent;
-
- switch (rqstp->rq_cred.oa_flavor)
- {
- case AUTH_DES:
- whoisthem.remote_username = username;
- whoisthem.remote_realname = realname;
- whoisthem.gids.gids_val = grouplist;
- des_cred = (struct authdes_cred *) rqstp->rq_clntcred;
- /*
- * Check to see if the netname being used is in the public key
- * database (if not, reject this (potential) imposter).
- */
- if (! getpublickey(des_cred->adc_fullname.name, publickey))
- {
- svcerr_weakauth(rqstp->rq_xprt);
- return(NULL);
- }
- /*
- * Get the info that the client wants.
- */
- if (! netname2user(des_cred->adc_fullname.name, &whoisthem.uid,
- &whoisthem.gid, &whoisthem.gids.gids_len,
- whoisthem.gids.gids_val))
- { /* netname not found */
- whoisthem.authenticated = FALSE;
- strcpy(whoisthem.remote_username, "nobody");
- strcpy(whoisthem.remote_realname, "INTERLOPER!");
- whoisthem.uid = -2;
- whoisthem.gid = -2;
- whoisthem.gids.gids_len = 0;
- return(&whoisthem);
- }
- /* else we found the netname */
- whoisthem.authenticated = TRUE;
- pwdent = getpwuid(whoisthem.uid);
- strcpy(whoisthem.remote_username, pwdent->pw_name);
- strcpy(whoisthem.remote_realname, pwdent->pw_gecos);
- return(&whoisthem);
- break;
- case AUTH_UNIX:
- case AUTH_NULL:
- default:
- svcerr_weakauth(rqstp->rq_xprt);
- return(NULL);
- }
-}
-
-/*
- * Return server's netname. AUTH_NONE is valid.
- * This routine allows this server to be started under any uid,
- * and the client can ask us our netname for use in authdes_create().
- */
-name *
-whoami_whoru_1(nullarg, rqstp)
- void *nullarg;
- struct svc_req *rqstp;
-{
-static name whoru;
-static char servername[MAXNETNAMELEN+1];
-
- whoru = servername;
- getnetname(servername);
-
- return(&whoru);
-}
diff --git a/lib/librpc/secure_rpc/des/des.h b/lib/librpc/secure_rpc/des/des.h
deleted file mode 100644
index c237f23..0000000
--- a/lib/librpc/secure_rpc/des/des.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Generic DES driver interface
- * Keep this file hardware independent!
- * Copyright (c) 1986 by Sun Microsystems, Inc.
- */
-
-#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
-#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
-
-enum desdir { ENCRYPT, DECRYPT };
-enum desmode { CBC, ECB };
-
-/*
- * parameters to ioctl call
- */
-struct desparams {
- u_char des_key[8]; /* key (with low bit parity) */
- enum desdir des_dir; /* direction */
- enum desmode des_mode; /* mode */
- u_char des_ivec[8]; /* input vector */
- unsigned des_len; /* number of bytes to crypt */
- union {
- u_char UDES_data[DES_QUICKLEN];
- u_char *UDES_buf;
- } UDES;
-# define des_data UDES.UDES_data /* direct data here if quick */
-# define des_buf UDES.UDES_buf /* otherwise, pointer to data */
-};
-
-/*
- * Encrypt an arbitrary sized buffer
- */
-#define DESIOCBLOCK _IOWR(d, 6, struct desparams)
-
-/*
- * Encrypt of small amount of data, quickly
- */
-#define DESIOCQUICK _IOWR(d, 7, struct desparams)
-
diff --git a/lib/librpc/secure_rpc/des/des_crypt.c b/lib/librpc/secure_rpc/des/des_crypt.c
deleted file mode 100644
index 57a9e71..0000000
--- a/lib/librpc/secure_rpc/des/des_crypt.c
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * des_crypt.c, DES encryption library routines
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-#include <sys/types.h>
-#include <des_crypt.h>
-#include <sys/des.h>
-
-/*
- * To see if chip is installed
- */
-#define UNOPENED (-2)
-static int g_desfd = UNOPENED;
-
-
-/*
- * Copy 8 bytes
- */
-#define COPY8(src, dst) { \
- register char *a = (char *) dst; \
- register char *b = (char *) src; \
- *a++ = *b++; *a++ = *b++; *a++ = *b++; *a++ = *b++; \
- *a++ = *b++; *a++ = *b++; *a++ = *b++; *a++ = *b++; \
-}
-
-/*
- * Copy multiple of 8 bytes
- */
-#define DESCOPY(src, dst, len) { \
- register char *a = (char *) dst; \
- register char *b = (char *) src; \
- register int i; \
- for (i = (int) len; i > 0; i -= 8) { \
- *a++ = *b++; *a++ = *b++; *a++ = *b++; *a++ = *b++; \
- *a++ = *b++; *a++ = *b++; *a++ = *b++; *a++ = *b++; \
- } \
-}
-
-/*
- * CBC mode encryption
- */
-cbc_crypt(key, buf, len, mode, ivec)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
- char *ivec;
-{
- int err;
- struct desparams dp;
-
- dp.des_mode = CBC;
- COPY8(ivec, dp.des_ivec);
- err = common_crypt(key, buf, len, mode, &dp);
- COPY8(dp.des_ivec, ivec);
- return(err);
-}
-
-
-/*
- * ECB mode encryption
- */
-ecb_crypt(key, buf, len, mode)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
-{
- struct desparams dp;
-
- dp.des_mode = ECB;
- return(common_crypt(key, buf, len, mode, &dp));
-}
-
-
-
-/*
- * Common code to cbc_crypt() & ecb_crypt()
- */
-static
-common_crypt(key, buf, len, mode, desp)
- char *key;
- char *buf;
- register unsigned len;
- unsigned mode;
- register struct desparams *desp;
-{
- register int desdev;
- register int res;
-
- if ((len % 8) != 0 || len > DES_MAXDATA) {
- return(DESERR_BADPARAM);
- }
- desp->des_dir =
- ((mode & DES_DIRMASK) == DES_ENCRYPT) ? ENCRYPT : DECRYPT;
-
- desdev = mode & DES_DEVMASK;
- COPY8(key, desp->des_key);
- /*
- * software
- */
- if (!_des_crypt(buf, len, desp)) {
- return (DESERR_HWERROR);
- }
- return(desdev == DES_SW ? DESERR_NONE : DESERR_NOHWDEVICE);
-}
diff --git a/lib/librpc/secure_rpc/des/des_crypt.h b/lib/librpc/secure_rpc/des/des_crypt.h
deleted file mode 100644
index d21d095..0000000
--- a/lib/librpc/secure_rpc/des/des_crypt.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI
- *
- * des_crypt.h, des library routine interface
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#define DES_MAXDATA 8192 /* max bytes encrypted in one call */
-#define DES_DIRMASK (1 << 0)
-#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */
-#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */
-
-
-#define DES_DEVMASK (1 << 1)
-#define DES_HW (0*DES_DEVMASK) /* Use hardware device */
-#define DES_SW (1*DES_DEVMASK) /* Use software device */
-
-
-#define DESERR_NONE 0 /* succeeded */
-#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
-#define DESERR_HWERROR 2 /* failed, hardware/driver error */
-#define DESERR_BADPARAM 3 /* failed, bad parameter to call */
-
-#define DES_FAILED(err) \
- ((err) > DESERR_NOHWDEVICE)
-
-/*
- * cbc_crypt()
- * ecb_crypt()
- *
- * Encrypt (or decrypt) len bytes of a buffer buf.
- * The length must be a multiple of eight.
- * The key should have odd parity in the low bit of each byte.
- * ivec is the input vector, and is updated to the new one (cbc only).
- * The mode is created by oring together the appropriate parameters.
- * DESERR_NOHWDEVICE is returned if DES_HW was specified but
- * there was no hardware to do it on (the data will still be
- * encrypted though, in software).
- */
-
-
-/*
- * Cipher Block Chaining mode
- */
-cbc_crypt(/* key, buf, len, mode, ivec */); /*
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
- char *ivec;
-*/
-
-
-/*
- * Electronic Code Book mode
- */
-ecb_crypt(/* key, buf, len, mode */); /*
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
-*/
-
-
-#ifndef KERNEL
-/*
- * Set des parity for a key.
- * DES parity is odd and in the low bit of each byte
- */
-void
-des_setparity(/* key */); /*
- char *key;
-*/
-#endif
diff --git a/lib/librpc/secure_rpc/des/des_soft.c b/lib/librpc/secure_rpc/des/des_soft.c
deleted file mode 100644
index 01dd7f2..0000000
--- a/lib/librpc/secure_rpc/des/des_soft.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)des_soft.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Table giving odd parity in the low bit for ASCII characters
- */
-static char partab[128] = {
- 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x07, 0x07,
- 0x08, 0x08, 0x0b, 0x0b, 0x0d, 0x0d, 0x0e, 0x0e,
- 0x10, 0x10, 0x13, 0x13, 0x15, 0x15, 0x16, 0x16,
- 0x19, 0x19, 0x1a, 0x1a, 0x1c, 0x1c, 0x1f, 0x1f,
- 0x20, 0x20, 0x23, 0x23, 0x25, 0x25, 0x26, 0x26,
- 0x29, 0x29, 0x2a, 0x2a, 0x2c, 0x2c, 0x2f, 0x2f,
- 0x31, 0x31, 0x32, 0x32, 0x34, 0x34, 0x37, 0x37,
- 0x38, 0x38, 0x3b, 0x3b, 0x3d, 0x3d, 0x3e, 0x3e,
- 0x40, 0x40, 0x43, 0x43, 0x45, 0x45, 0x46, 0x46,
- 0x49, 0x49, 0x4a, 0x4a, 0x4c, 0x4c, 0x4f, 0x4f,
- 0x51, 0x51, 0x52, 0x52, 0x54, 0x54, 0x57, 0x57,
- 0x58, 0x58, 0x5b, 0x5b, 0x5d, 0x5d, 0x5e, 0x5e,
- 0x61, 0x61, 0x62, 0x62, 0x64, 0x64, 0x67, 0x67,
- 0x68, 0x68, 0x6b, 0x6b, 0x6d, 0x6d, 0x6e, 0x6e,
- 0x70, 0x70, 0x73, 0x73, 0x75, 0x75, 0x76, 0x76,
- 0x79, 0x79, 0x7a, 0x7a, 0x7c, 0x7c, 0x7f, 0x7f,
-};
-
-/*
- * Add odd parity to low bit of 8 byte key
- */
-void
-des_setparity(p)
- char *p;
-{
- int i;
-
- for (i = 0; i < 8; i++) {
- *p = partab[*p & 0x7f];
- p++;
- }
-}
diff --git a/lib/librpc/secure_rpc/doc/Makefile b/lib/librpc/secure_rpc/doc/Makefile
deleted file mode 100644
index 3cfbe9e..0000000
--- a/lib/librpc/secure_rpc/doc/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# @(#)Makefile 2.1 88/08/10 4.0 RPCSRC
-#
-#
-TROFF= ditroff
-TOPTS= -t
-NROFF= nroff
-NOPTS=
-PIC= pic
-TBL= tbl
-EQN= eqn
-
-SRC= nfs.secure.ms
-
-all default: all.nroff
-
-install: all.nroff
- @echo "Nothing installed."
-
-all.nroff: ${SRC}
- ${TBL} ${SRC} | ${EQN} | ${NROFF} ${NOPTS} -ms >all.nroff
-
-all.troff: ${SRC}
- ${TBL} ${SRC} | ${PIC} | ${EQN} | ${TROFF} ${TOPTS} -ms >all.troff
-
-#
-
-nfs.secure.nroff: nfs.secure.ms
- ${TBL} nfs.secure.ms | ${EQN} | ${NROFF} ${NOPTS} -ms >nfs.secure.nroff
-
-nfs.secure.troff: nfs.secure.ms
- ${TBL} nfs.secure.ms|${PIC}|${EQN}| ${TROFF} ${TOPTS} -ms >nfs.secure.troff
-
-clean:
- rm -f *.nroff *.troff
-
-spell: ${SRC}
- @for i in ${SRC}; do \
- echo $$i; spell $$i | sort | comm -23 - spell.ok > $$i.spell; \
- done
diff --git a/lib/librpc/secure_rpc/doc/nfs.secure.ms b/lib/librpc/secure_rpc/doc/nfs.secure.ms
deleted file mode 100644
index 2476790..0000000
--- a/lib/librpc/secure_rpc/doc/nfs.secure.ms
+++ /dev/null
@@ -1,934 +0,0 @@
-.\" Must use -- pic tbl eqn -- with this one.
-.\"
-.\" @(#)nfs.secure.ms 2.2 88/08/09 4.0 RPCSRC
-.de BT
-.if \\n%=1 .tl ''- % -''
-..
-.ND
-.\" prevent excess underlining in nroff
-.if n .fp 2 R
-.OH 'Secure Networking''Page %'
-.EH 'Page %''Secure Networking'
-.if \\n%=1 .bp
-.EQ
-delim $$
-gsize 11
-.EN
-.SH
-\&Secure Networking
-.nr OF 1
-.IX "security" "of networks" "" "" PAGE START
-.IX "network security" "" "" "" PAGE START
-.IX "NFS security" "" "" "" PAGE START
-.LP
-RPCSRC 4.0 includes an authentication system
-that greatly improves the security of network environments.
-The system is general enough to be used by other
-.UX
-and non-UNIX systems.
-The system uses DES encryption and public key cryptography
-to authenticate both users and machines in the network.
-(DES stands for Data Encryption Standard.)
-.LP
-Public key cryptography is a cipher system that involves two keys:
-one public and the other private.
-The public key is published, while the private key is not;
-the private (or secret) key is used to encrypt and decrypt data.
-Sun's system differs from some other public key cryptography systems
-in that the public and secret keys are used to generate a common key,
-which is used in turn to create a DES key.
-DES is relatively fast,
-and on Sun Workstations,
-optional hardware is available to make it even faster.
-.#
-.NH 0
-\&Administering Secure RPC
-.IX "administering secure RPC"
-.IX "security" "RPC administration"
-.LP
-This section describes what the system administrator must do
-in order to use secure networking.
-.IP 1
-RPCSRC now includes the
-.I /etc/publickey
-.IX "etc/publickey" "" "\&\fI/etc/publickey\fP"
-database, which should contain three fields for each user:
-the user's netname, a public key, and an encrypted secret key.
-The corresponding Yellow Pages map is available to YP clients as
-.I publickey.byname
-but the database should reside only on the YP master. Make sure
-.I /etc/netid
-exists on the YP master server.
-As normally installed, the only user is
-.I nobody .
-This is convenient administratively,
-because users can establish their own public keys using
-.I chkey (1)
-.IX "chkey command" "" "\&\fIchkey\fP command"
-without administrator intervention.
-For even greater security,
-the administrator can establish public keys for everyone using
-.I newkey (8).
-.IX "newkey command" "" "\&\fInewkey\fP command"
-Note that the Yellow Pages take time to propagate a new map,
-so it's a good idea for users to run
-.I chkey ,
-or for the administrator to run
-.I newkey ,
-just before going home for the night.
-.IP 2
-Verify that the
-.I keyserv (8c)
-.IX "keyserv daemon" "" "\&\fIkeyserv\fP daemon"
-daemon was started by
-.I /etc/rc.local
-and is still running.
-This daemon performs public key encryption
-and stores the private key (encrypted, of course) in
-.I /etc/keystore :
-.DS
-% \fBps aux | grep keyserv\fP
-root 1354 0.0 4.1 128 296 p0 I Oct 15 0:13 keyserv
-.DE
-When users log in with
-.I login
-.IX "login command" "" "\&\fIlogin\fP command"
-or remote log in with
-.I rlogin ,
-these programs use the typed password to decrypt the secret key stored in
-.I /etc/publickey .
-This becomes the private key, and gets passed to the
-.I keyserv
-daemon.
-If users don't type a password for
-.I login
-or
-.I rlogin ,
-either because their password field is empty
-or because their machine is in the
-.I hosts\fR.\fPequiv
-.IX "etc/hosts.equiv" "" "\&\fI/etc/hosts.equiv\fP"
-file of the remote host,
-they can still place a private key in
-.I /etc/keystore
-by invoking the
-.I keylogin (1)
-.IX "keylogin command" "" "\&\fIkeylogin\fP command"
-program.
-Administrators should take care not to delete
-.I /etc/keystore
-and
-.I /etc/.rootkey
-(the latter file contains the private key for
-.I root ).
-.IP 3
-When you reinstall, move, or upgrade a machine, save
-.I /etc/keystore
-and
-.I /etc/.rootkey
-along with everything else you normally save.
-.LP
-.LP
-Note that if you
-.I login ,
-.I rlogin ,
-or
-.I telnet
-to another machine, are asked for your password, and type it correctly,
-you've given away access to your own account.
-This is because your secret key is now stored in
-.I /etc/keystore
-on that remote machine.
-This is only a concern if you don't trust the remote machine.
-If this is the case,
-don't ever log in to a remote machine if it asks for your password.
-Instead, use NFS to remote mount the files you're looking for.
-At this point there is no
-.I keylogout
-command, even though there should be.
-.LP
-The remainder of this chapter discusses the theory of secure networking,
-and is useful as a background for both users and administrators.
-.#
-.NH 1
-\&Security Shortcomings of NFS
-.IX "security" "shortcomings of NFS"
-.LP
-Sun's Remote Procedure Call (RPC) mechanism has proved to be a very
-powerful primitive for building network services.
-The most well-known of these services is the Network File System (NFS),
-a service that provides transparent file-sharing
-between heterogeneous machine architectures and operating systems.
-The NFS is not without its shortcomings, however.
-Currently, an NFS server authenticates a file request by authenticating the
-machine making the request, but not the user.
-On NFS-based filesystems, it is a simple matter of running
-.I su
-.IX "su command" "" "\&\fIsu\fP command"
-to impersonate the rightful owner of a file.
-But the security weaknesses of the NFS are nothing new.
-The familiar command
-.I rlogin
-is subject to exactly the same attacks as the NFS
-because it uses the same kind of authentication.
-.LP
-A common solution to network security problems
-is to leave the solution to each application.
-A far better solution is to put authentication at the RPC level.
-The result is a standard authentication system
-that covers all RPC-based applications,
-such as the NFS and the Yellow Pages (a name-lookup service).
-Our system allows the authentication of users as well as machines.
-The advantage of this is that it makes a network environment
-more like the older time-sharing environment.
-Users can log in on any machine,
-just as they could log in on any terminal.
-Their login password is their passport to network security.
-No knowledge of the underlying authentication system is required.
-Our goal was a system that is as secure and easy to use
-as a time-sharing system.
-.LP
-Several remarks are in order. Given
-.I root
-access and a good knowledge of network programming,
-anyone is capable of injecting arbitrary data into the network,
-and picking up any data from the network.
-However, on a local area network, no machine is capable of packet smashing \(en
-capturing packets before they reach their destination, changing the contents,
-then sending packets back on their original course \(en
-because packets reach all machines, including the server, at the same time.
-Packet smashing is possible on a gateway, though,
-so make sure you trust all gateways on the network.
-The most dangerous attacks are those involving the injection of data,
-such as impersonating a user by generating the right packets,
-or recording conversations and replaying them later.
-These attacks affect data integrity.
-Attacks involving passive eavesdropping \(en
-merely listening to network traffic without impersonating anybody \(en
-are not as dangerous, since data integrity had not been compromised.
-Users can protect the privacy of sensitive information
-by encrypting data that goes over the network.
-It's not easy to make sense of network traffic, anyway.
-.#
-.NH 1
-\&RPC Authentication
-.IX "RPC authentication"
-.IX "authentication" "RPC"
-.LP
-RPC is at the core of the new network security system.
-To understand the big picture,
-it's necessary to understand how authentication works in RPC.
-RPC's authentication is open-ended:
-a variety of authentication systems may be plugged into it
-and may coexist on the network.
-Currently, we have two: UNIX and DES.
-UNIX authentication is the older, weaker system;
-DES authentication is the new system discussed in this chapter.
-Two terms are important for any RPC authentication system:
-.I credentials
-and
-.I verifiers .
-Using ID badges as an example, the credential is what identifies a person:
-a name, address, birth date, etc.
-The verifier is the photo attached to the badge:
-you can be sure the badge has not been stolen by checking the photo
-on the badge against the person carrying it.
-In RPC, things are similar.
-The client process sends both a credential and a verifier
-to the server with each RPC request.
-The server sends back only a verifier,
-since the client already knows the server's credentials.
-.#
-.NH 2
-\&UNIX Authentication
-.IX "UNIX authentication"
-.IX "authentication" "UNIX"
-.LP
-UNIX authentication was used by most of Sun's original network services.
-The credentials contain the client's machine-name,
-.I uid ,
-.I gid ,
-and group-access-list.
-The verifier contains \fBnothing\fP!
-There are two problems with this system.
-The glaring problem is the empty verifier,
-which makes it easy to cook up the right credential using
-.I hostname
-.IX "hostname command" "" "\&\fIhostname\fP command"
-and
-.I su .
-.IX "su command" "" "\&\fIsu\fP command"
-If you trust all root users in the network, this is not really a problem.
-But many networks \(en especially at universities \(en are not this secure.
-The NFS tries to combat deficiencies in UNIX authentication
-by checking the source Internet address of
-.I mount
-requests as a verifier of the
-.I hostname
-field, and accepting requests only from privileged Internet ports.
-Still, it is not difficult to circumvent these measures,
-and NFS really has no way to verify the user-ID.
-.LP
-The other problem with UNIX authentication appears in the name UNIX.
-It is unrealistic to assume that all machines on a network
-will be UNIX machines.
-The NFS works with MS-DOS and VMS machines,
-but UNIX authentication breaks down when applied to them.
-For instance, MS-DOS doesn't even have a notion of different user IDs.
-.LP
-Given these shortcomings,
-it is clear what is needed in a new authentication system:
-operating system independent credentials, and secure verifiers.
-This is the essence of DES authentication discussed below.
-.#
-.NH 2
-\&DES Authentication
-.IX "DES authentication"
-.IX "authentication" "DES"
-.LP
-The security of DES authentication is based on
-a sender's ability to encrypt the current time,
-which the receiver can then decrypt and check against its own clock.
-The timestamp is encrypted with DES.
-Two things are necessary for this scheme to work:
-1) the two agents must agree on what the current time is, and
-2) the sender and receiver must be using the same encryption key.
-.LP
-If a network has time synchronization (Berkeley's TEMPO for example),
-then client/server time synchronization is performed automatically.
-However, if this is not available,
-timestamps can be computed using the server's time instead of network time.
-In order to do this, the client asks the server what time it is,
-before starting the RPC session,
-then computes the time difference between its own clock and the server's.
-This difference is used to offset the client's clock when computing timestamps.
-If the client and server clocks get out of sync
-to the point where the server begins rejecting the client's requests,
-the DES authentication system just resynchronizes with the server.
-.LP
-Here's how the client and server arrive at the same encryption key.
-When a client wishes to talk to a server, it generates at random
-a key to be used for encrypting the timestamps (among other things).
-This key is known as the
-.I "conversation key, CK."
-The client encrypts the conversation key using a public key scheme,
-and sends it to the server in its first transaction.
-This key is the only thing that is ever encrypted with public key cryptography.
-The particular scheme used is described further on in this chapter.
-For now, suffice to say that for any two agents A and B,
-there is a DES key $K sub AB$ that only A and B can deduce.
-This key is known as the
-.I "common key,"
-$K sub AB$.
-.EQ
-gsize 10
-.EN
-.ne 1i
-.PS
-.in +.7i
-circlerad=.4
-boxht=.2
-boxwid=1.3
-circle "\s+9A\s-9" "(client)" at 0,1.2
-circle "\s+9B\s-9" "(server)" at 5.1,1.2
-line invis at .5,2 ; box invis "\fBCredential\fP"; line invis;
- box invis "\fBVerifier\fP"
-arrow at .5,1.7; box "$A, K sub AB (CK), CK(win)$"; arrow;
- box "$CK(t sub 1 ), CK(win + 1)$"; arrow
-arrow <- at .5,1.4; line right 1.3; line;
- box "$CK(t sub 1 - 1), ID$"; arrow <-
-arrow at .5,1; box "ID"; arrow;
- box "$CK(t sub 2 )$"; arrow
-arrow <- at .5,.7; line right 1.3; line;
- box "$CK(t sub 2 - 1), ID$"; arrow <-
-arrow at .5,.3; box "ID"; arrow;
- box "$CK(t sub n )$"; arrow
-arrow <- at .5,0; line right 1.3; line;
- box "$CK(t sub n - 1), ID$"; arrow <-
-.PE
-.EQ
-gsize 11
-.EN
-.in -.7i
-.LP
-The figure above illustrates the authentication protocol in more detail,
-describing client A talking to server B.
-A term of the form $K(x)$ means $x$ encrypted with the DES key $K$.
-Examining the figure, you can see that for its first request,
-the client's credential contains three things:
-its name $A$, the conversation key $CK$ encrypted with the common key
-$K sub AB$, and a thing called $win$ (window) encrypted with $CK$.
-What the window says to the server, in effect, is this:
-.LP
-.I
-I will be sending you many credentials in the future,
-but there may be crackers sending them too,
-trying to impersonate me with bogus timestamps.
-When you receive a timestamp, check to see if your current time
-is somewhere between the timestamp and the timestamp plus the window.
-If it's not, please reject the credential.
-.LP
-For secure NFS filesystems, the window currently defaults to 30 minutes.
-The client's verifier in the first request contains the encrypted timestamp
-and an encrypted verifier of the specified window, $win + 1$.
-The reason this exists is the following.
-Suppose somebody wanted to impersonate A by writing a program
-that instead of filling in the encrypted fields of the credential and verifier,
-just stuffs in random bits.
-The server will decrypt CK into some random DES key,
-and use it to decrypt the window and the timestamp.
-These will just end up as random numbers.
-After a few thousand trials, there is a good chance
-that the random window/timestamp pair will pass the authentication system.
-The window verifier makes guessing the right credential much more difficult.
-.LP
-After authenticating the client,
-the server stores four things into a credential table:
-the client's name A, the conversation key $CK$, the window, and the timestamp.
-The reason the server stores the first three things should be clear:
-it needs them for future use.
-The reason for storing the timestamp is to protect against replays.
-The server will only accept timestamps
-that are chronologically greater than the last one seen,
-so any replayed transactions are guaranteed to be rejected.
-The server returns to the client in its verifier an index ID
-into its credential table, plus the client's timestamp minus one,
-encrypted by $CK$.
-The client knows that only the server could have sent such a verifier,
-since only the server knows what timestamp the client sent.
-The reason for subtracting one from it is to insure that it is invalid
-and cannot be reused as a client verifier.
-.LP
-The first transaction is rather complicated,
-but after this things go very smoothly.
-The client just sends its ID and an encrypted timestamp to the server,
-and the server sends back the client's timestamp minus one,
-encrypted by $CK$.
-.#
-.NH 1
-\&Public Key Encryption
-.IX "public key encryption"
-.LP
-The particular public key encryption scheme Sun uses
-is the Diffie-Hellman method.
-The way this algorithm works is to generate a
-.I "secret key"
-$SK sub A$ at random
-and compute a
-.I "public key"
-$PK sub A$ using the following formula
-($PK$ and $SK$ are 192 bit numbers and \(*a is a well-known constant):
-.EQ
-PK sub A ~ = ~ alpha sup {SK sub A}
-.EN
-Public key $PK sub A$ is stored in a public directory,
-but secret key $SK sub A$ is kept private.
-Next, $PK sub B$ is generated from $SK sub B$ in the same manner as above.
-Now common key $K sub AB$ can be derived as follows:
-.EQ
-K sub AB ~ = ~ PK sub B sup {SK sub A} ~ = ~
-( alpha sup {SK sub B} ) sup {SK sub A} ~ = ~
-alpha sup {( SK sub A SK sub B )}
-.EN
-Without knowing the client's secret key,
-the server can calculate the same common key $K sub AB$
-in a different way, as follows:
-.EQ
-K sub AB ~ = ~ PK sub A sup {SK sub B} ~ = ~
-( alpha sup {SK sub A} ) sup {SK sub B} ~ = ~
-alpha sup {( SK sub A SK sub B )}
-.EN
-Notice that nobody else but the server and client can calculate $K sub AB$,
-since doing so requires knowing either one secret key or the other.
-All of this arithmetic is actually computed modulo $M$,
-which is another well-known constant.
-It would seem at first that somebody could guess your secret key
-by taking the logarithm of your public one,
-but $M$ is so large that this is a computationally infeasible task.
-To be secure, $K sub AB$ has too many bits to be used as a DES key,
-so 56 bits are extracted from it to form the DES key.
-.LP
-Both the public and the secret keys
-are stored indexed by netname in the Yellow Pages map
-.I publickey.byname
-the secret key is DES-encrypted with your login password.
-When you log in to a machine, the
-.I login
-program grabs your encrypted secret key,
-decrypts it with your login password,
-and gives it to a secure local keyserver to save
-for use in future RPC transactions.
-Note that ordinary users do not have to be aware of
-their public and secret keys.
-In addition to changing your login password, the
-.I yppasswd
-.IX "yppasswd command" "" "\&\fIyppasswd\fP command"
-program randomly generates a new public/secret key pair as well.
-.LP
-The keyserver
-.I keyserv (8c)
-.IX "keyserv daemon" "" "\&\fIkeyserv\fP daemon"
-is an RPC service local to each machine
-that performs all of the public key operations,
-of which there are only three. They are:
-.DS
-setsecretkey(secretkey)
-encryptsessionkey(servername, des_key)
-decryptsessionkey(clientname, des_key)
-.DE
-.I setsecretkey()
-tells the keyserver to store away your secret key $SK sub A$ for future use;
-it is normally called by
-.I login .
-The client program calls
-.I encryptsessionkey()
-to generate the encrypted conversation key
-that is passed in the first RPC transaction to a server.
-The keyserver looks up
-.I servername 's
-public key and combines it with the client's secret key (set up by a previous
-.I setsecretkey()
-call) to generate the key that encrypts
-.I des_key .
-The server asks the keyserver to decrypt the conversation key by calling
-.I decryptsessionkey().
-Note that implicit in these procedures is the name of caller,
-who must be authenticated in some manner.
-The keyserver cannot use DES authentication to do this,
-since it would create deadlock.
-The keyserver solves this problem by storing the secret keys by
-.I uid ,
-and only granting requests to local root processes.
-The client process then executes a
-.I setuid
-process, owned by root, which makes the request on the part of the client,
-telling the keyserver the real
-.I uid
-of the client. Ideally, the three operations described above
-would be system calls, and the kernel would talk to the keyserver directly,
-instead of executing the
-.I setuid
-program.
-.#
-.NH 1
-\&Naming of Network Entities
-.IX "naming of network entities"
-.IX "network naming"
-.LP
-The old UNIX authentication system has a few problems when it comes to naming.
-Recall that with UNIX authentication,
-the name of a network entity is basically the
-.I uid .
-These
-.I uid s
-are assigned per Yellow Pages naming domain,
-which typically spans several machines.
-We have already stated one problem with this system,
-that it is too UNIX system oriented,
-but there are two other problems as well.
-One is the problem of
-.I uid
-clashes when domains are linked together.
-The other problem is that the super-user (with
-.I uid
-of 0) should not be assigned on a per-domain basis,
-but rather on a per-machine basis.
-By default, the NFS deals with this latter problem in a severe manner:
-it does not allow root access across the network by
-.I uid
-0 at all.
-.LP
-DES authentication corrects these problems
-by basing naming upon new names that we call
-.I netnames.
-Simply put, a netname is just a string of printable characters,
-and fundamentally, it is really these netnames that we authenticate.
-The public and secret keys are stored on a per-netname,
-rather than per-username, basis.
-The Yellow Pages map
-.I netid.byname
-maps the netname into a local
-.I uid
-and group-access-list,
-though non-Sun environments may map the netname into something else.
-.LP
-We solve the Internet naming problem by choosing globally unique netnames.
-This is far easier then choosing globally unique user IDs.
-In the Sun environment, user names are unique within each Yellow Page domain.
-Netnames are assigned by concatenating the operating system and user ID
-with the Yellow Pages and ARPA domain names.
-For example, a UNIX system user with a user ID of 508 in the domain
-.I eng.sun.COM
-would be assigned the following netname:
-.I unix.508@eng.sun.COM .
-A good convention for naming domains is to append
-the ARPA domain name (COM, EDU, GOV, MIL) to the local domain name.
-Thus, the Yellow Pages domain
-.I eng
-within the ARPA domain
-.I sun.COM
-becomes
-.I eng.sun.COM .
-.LP
-We solve the problem of multiple super-users per domain
-by assigning netnames to machines as well as to users.
-A machine's netname is formed much like a user's.
-For example, a UNIX machine named
-.I hal
-in the same domain as before has the netname
-.I unix.hal@eng.sun.COM .
-Proper authentication of machines is very important for diskless machines
-that need full access to their home directories over the net.
-.LP
-Non-Sun environments will have other ways of generating netnames,
-but this does not preclude them from accessing
-the secure network services of the Sun environment.
-To authenticate users from any remote domain,
-all that has to be done is make entries for them in two Yellow Pages databases.
-One is an entry for their public and secret keys,
-the other is for their local
-.I uid
-and group-access-list mapping.
-Upon doing this, users in the remote domain
-will be able access all of the local network services,
-such as the NFS and remote logins.
-.#
-.NH 1
-\&Applications of DES Authentication
-.IX "applications of DES authentication"
-.IX "authentication" "DES"
-.LP
-The first application of DES authentication
-is a generalized Yellow Pages update service.
-This service allows users to update private fields in Yellow Page databases.
-So far the Yellow Pages maps
-.I hosts,
-.I ethers,
-.I bootparams
-and
-.I publickey
-employ the DES-based update service.
-Before the advent of an update service for mail aliases,
-Sun had to hire a full-time person just to update mail aliases.
-.LP
-The second application of DES authentication is the most important:
-a more secure Network File System.
-There are three security problems with the
-old NFS using UNIX authentication.
-The first is that verification of credentials occurs only at mount time
-when the client gets from the server a piece of information
-that is its key to all further requests: the
-.I "file handle" .
-Security can be broken if one can figure out a file handle
-without contacting the server, perhaps by tapping into the net or by guessing.
-After an NFS file system has been mounted,
-there is no checking of credentials during file requests,
-which brings up the second problem.
-If a file system has been mounted from a server that serves multiple clients
-(as is typically the case), there is no protection
-against someone who has root permission on their machine using
-.I su
-(or some other means of changing
-.I uid )
-gaining unauthorized access to other people's files.
-The third problem with the NFS is the severe method it uses to circumvent
-the problem of not being able to authenticate remote client super-users:
-denying them super-user access altogether.
-.LP
-The new authentication system corrects all of these problems.
-Guessing file handles is no longer a problem since in order to gain
-unauthorized access, the miscreant will also have to guess the right
-encrypted timestamp to place in the credential,
-which is a virtually impossible task.
-The problem of authenticating root users is solved,
-since the new system can authenticate machines.
-At this point, however,
-secure NFS is not used for root filesystems.
-Root users of nonsecure filesystems are identified by IP address.
-.LP
-Actually, the level of security associated with each filesystem
-may be altered by the administrator. The file
-.I /etc/exports
-.IX "etc/exports" "" "\&\fI/etc/exports\fP"
-contains a list of filesystems and which machines may mount them.
-By default, filesystems are exported with UNIX authentication,
-but the administrator can have them exported with DES authentication
-by specifying
-.I -secure
-on any line in the
-.I /etc/exports
-file. Associated with DES authentication is a parameter:
-the maximum window size that the server is willing to accept.
-.#
-.NH 1
-\&Security Issues Remaining
-.IX "security" "issues remaining"
-.IX "remaining security issues"
-.LP
-There are several ways to break DES authentication, but using
-.I su
-is not one of them. In order to be authenticated,
-your secret key must be stored by your workstation.
-This usually occurs when you login, with the
-.I login
-program decrypting your secret key with your login password,
-and storing it away for you.
-If somebody tries to use
-.I su
-to impersonate you, it won't work,
-because they won't be able to decrypt your secret key. Editing
-.I /etc/passwd
-isn't going to help them either, because the thing they need to edit,
-your encrypted secret key, is stored in the Yellow Pages.
-If you log into somebody else's workstation and type in your password,
-then your secret key would be stored in their workstation and they could use
-.I su
-to impersonate you. But this is not a problem since you should not
-be giving away your password to a machine you don't trust anyway.
-Someone on that machine could just as easily change
-.I login
-to save all the passwords it sees into a file.
-.LP
-Not having
-.I su
-to employ any more, how can nefarious users impersonate others now?
-Probably the easiest way is to guess somebody's password,
-since most people don't choose very secure passwords.
-We offer no protection against this;
-it's up to each user to choose a secure password.
-.LP
-The next best attack would be to attempt replays.
-For example, let's say I have been squirreling away
-all of your NFS transactions with a particular server.
-As long as the server remains up,
-I won't succeed by replaying them since the server always demands timestamps
-that are greater than the previous ones seen.
-But suppose I go and pull the plug on your server, causing it to crash.
-As it reboots, its credential table will be clean,
-so it has lost all track of previously seen timestamps,
-and now I am free to replay your transactions.
-There are few things to be said about this.
-First of all, servers should be kept in a secure place
-so that no one can go and pull the plug on them.
-But even if they are physically secure,
-servers occasionally crash without any help.
-Replaying transactions is not a very big security problem,
-but even so, there is protection against it.
-If a client specifies a window size that is smaller than the time it takes
-a server to reboot (5 to 10 minutes), the server will reject
-any replayed transactions because they will have expired.
-.LP
-There are other ways to break DES authentication,
-but they are much more difficult.
-These methods involve breaking the DES key itself,
-or computing the logarithm of the public key,
-both of which would would take months of compute time on a supercomputer.
-But it is important to keep our goals in mind.
-Sun did not aim for super-secure network computing.
-What we wanted was something as secure as a good time-sharing system,
-and in that we have been successful.
-.LP
-There is another security issue that DES authentication does not address,
-and that is tapping of the net.
-Even with DES authentication in place,
-there is no protection against somebody watching what goes across the net.
-This is not a big problem for most things,
-such as the NFS, since very few files are not publically readable, and besides,
-trying to make sense of all the bits flying over the net is not a trivial task.
-For logins, this is a bit of a problem because you wouldn't
-want somebody to pick up your password over the net.
-As we mentioned before,
-a side effect of the authentication system is a key exchange,
-so that the network tapping problem can be tackled on a per-application basis.
-.#
-.NH 1
-\&Performance
-.IX "performance of DES authentication"
-.IX "authentication" "performance"
-.LP
-Public key systems are known to be slow,
-but there is not much actual public key encryption going on in Sun's system.
-Public key encryption only occurs in the first transaction with a service,
-and even then, there is caching that speeds things up considerably.
-The first time a client program contacts a server,
-both it and the server will have to calculate the common key.
-The time it takes to compute the common key is basically the time it takes
-to compute an exponential modulo $M$.
-On a Sun-3 using a 192-bit modulus, this takes roughly 1 second,
-which means it takes 2 seconds just to get things started,
-since both client and server have to perform this operation.
-This is a long time,
-but you have to wait only the first time you contact a machine.
-Since the keyserver caches the results of previous computations,
-it does not have to recompute the exponential every time.
-.LP
-The most important service in terms of performance is the secure NFS,
-which is acceptably fast.
-The extra overhead that DES authentication requires versus UNIX authentication
-is the encryption.
-A timestamp is a 64-bit quantity,
-which also happens to be the DES block size.
-Four encryption operations take place in an average RPC transaction:
-the client encrypts the request timestamp, the server decrypts it,
-the server encrypts the reply timestamp, and the client decrypts it.
-On a Sun-3, the time it takes to encrypt one block is about
-half a millisecond if performed by hardware,
-and 1.2 milliseconds if performed by software.
-So, the extra time added to the round trip time is about
-2 milliseconds for hardware encryption and 5 for software.
-The round trip time for the average NFS request is about 20 milliseconds,
-resulting in a performance hit of 10 percent if one has encryption hardware,
-and 25 percent if not.
-Remember that this is the impact on network performance.
-The fact is that not all file operations go over the wire,
-so the impact on total system performance will actually be lower than this.
-It is also important to remember that security is optional,
-so environments that require higher performance can turn it off.
-.#
-.NH 1
-\&Problems with Booting and \&\fBsetuid\fP Programs
-.IX "problems with booting and \&\fIsetuid\fP programs"
-.IX "booting and \&\fIsetuid\fP problems"
-.LP
-Consider the problem of a machine rebooting,
-say after a power failure at some strange hour when nobody is around.
-All of the secret keys that were stored get wiped out,
-and now no process will be able to access secure network services,
-such as mounting an NFS filesystem.
-The important processes at this time are usually root processes,
-so things would work OK if root's secret key were stored away,
-but nobody is around to type the password that decrypts it.
-The solution to this problem is to store root's decrypted secret key in a file,
-which the keyserver can read.
-This works well for diskful machines that can store the secret key
-on a physically secure local disk,
-but not so well for diskless machines,
-whose secret key must be stored across the network.
-If you tap the net when a diskless machine is booting,
-you will find the decrypted key.
-This is not very easy to accomplish, though.
-.LP
-Another booting problem is the single-user boot.
-There is a mode of booting known as single-user mode, where a
-.I root
-login shell appears on the console.
-The problem here is that a password is not required for this.
-With C2 security installed,
-a password is required in order to boot single-user.
-Without C2 security installed,
-machines can still be booted single-user without a password,
-as long as the entry for
-.I console
-in the
-.I /etc/ttytab
-.IX "etc/ttytab" "" "\&\fI/etc/ttytab\fP"
-file is labeled as physically
-.I secure
-(this is the default).
-.LP
-Yet another problem is that diskless machine booting is not totally secure.
-It is possible for somebody to impersonate the boot-server,
-and boot a devious kernel that, for example,
-makes a record of your secret key on a remote machine.
-The problem is that our system is set up to provide protection
-only after the kernel and the keyserver are running.
-Before that, there is no way to authenticate
-the replies given by the boot server.
-We don't consider this a serious problem,
-because it is highly unlikely that somebody would be able to write
-this funny kernel without source code.
-Also, the crime is not without evidence.
-If you polled the net for boot-servers,
-you would discover the devious boot-server's location.
-.LP
-Not all
-.I setuid
-programs will behave as they should.
-For example, if a
-.I setuid
-program is owned by
-.I dave ,
-who has not logged into the machine since it booted,
-then the program will not be able to access any secure network services as
-.I dave .
-The good news is that most
-.I setuid
-programs are owned by root,
-and since root's secret key is always stored at boot time,
-these programs will behave as they always have.
-.#
-.NH 1
-\&Conclusion
-.IX "network security" "summary"
-.LP
-Our goal was to build a system as secure as a time-shared system.
-This goal has been met.
-The way you are authenticated in a time-sharing system
-is by knowing your password.
-With DES authentication, the same is true.
-In time-sharing the person you trust is your system administrator,
-who has an ethical obligation
-not to change your password in order to impersonate you.
-In Sun's system, you trust your network administrator,
-who does not alter your entry in the public key database.
-In one sense, our system is even more secure than time-sharing,
-because it is useless to place a tap on the network
-in hopes of catching a password or encryption key,
-since these are encrypted.
-Most time-sharing environments do not encrypt data emanating from the terminal;
-users must trust that nobody is tapping their terminal lines.
-.LP
-DES authentication is perhaps not the ultimate authentication system.
-In the future it is likely there will be sufficient advances
-in algorithms and hardware to render the public key system
-as we have defined it useless.
-But at least DES authentication offers a smooth migration path for the future.
-Syntactically speaking,
-nothing in the protocol requires the encryption of the conversation
-key to be Diffie-Hellman, or even public key encryption in general.
-To make the authentication stronger in the future,
-all that needs to be done is to strengthen the way
-the conversation key is encrypted.
-Semantically, this will be a different protocol,
-but the beauty of RPC is that it can be plugged in
-and live peacefully with any authentication system.
-.LP
-For the present at least, DES authentication satisfies our requirements
-for a secure networking environment.
-From it we built a system secure enough for use in unfriendly networks,
-such as a student-run university workstation environment.
-The price for this security is not high.
-Nobody has to carry around a magnetic card or remember
-any hundred digit numbers.
-You use your login password to authenticate yourself, just as before.
-There is a small impact on performance,
-but if this worries you and you have a friendly net,
-you can turn authentication off.
-.#
-.NH 1
-\&References
-.IX "references on network security"
-.LP
-Diffie and Hellman, ``New Directions in Cryptography,''
-\fIIEEE Transactions on Information Theory IT-22,\fP
-November 1976.
-.LP
-Gusella & Zatti, ``TEMPO: A Network Time Controller
-for a Distributed Berkeley UNIX System,''
-\fIUSENIX 1984 Summer Conference Proceedings,\fP
-June 1984.
-.LP
-National Bureau of Standards, ``Data Encryption Standard,''
-\fIFederal Information Processing Standards Publication 46,\fP
-January 15, 1977.
-.LP
-Needham & Schroeder, ``Using Encryption for Authentication
-in Large Networks of Computers,''
-\fIXerox Corporation CSL-78-4,\fP
-September 1978.
-.EQ
-delim off
-.EN
-.IX "security" "of networks" "" "" PAGE END
-.IX "network security" "" "" "" PAGE END
-.IX "NFS security" "" "" "" PAGE END
diff --git a/lib/librpc/secure_rpc/keyserv/Makefile b/lib/librpc/secure_rpc/keyserv/Makefile
deleted file mode 100644
index de6771e..0000000
--- a/lib/librpc/secure_rpc/keyserv/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# @(#)Makefile 2.4 88/08/15 4.0 RPCSRC; from 1.9 87/11/29 SMI
-#
-CFLAGS= -O
-RPCLIB= -lrpclib
-#RPCLIB= -lrpcsvc
-
-KEYSERV_OBJS = keyserv.o setkey.o detach.o mp.o
-KEYENVOY_OBJS = keyenvoy.o
-SRCS = keyserv.c setkey.c detach.c keyenvoy.c mp.c
-
-ALL= keyserv keyenvoy
-
-all: $(ALL)
-
-keyserv: $(KEYSERV_OBJS)
- $(CC) $(CFLAGS) $(KEYSERV_OBJS) -lmp $(LIBC) $(RPCLIB) -o $@
-
-keyenvoy: $(KEYENVOY_OBJS)
- $(CC) $(CFLAGS) $(KEYENVOY_OBJS) $(LIBC) $(RPCLIB) -o $@
-
-clean:
- rm -f $(ALL) $(KEYSERV_OBJS) $(KEYENVOY_OBJS)
-
-install: $(ALL)
- install -s -m 755 keyserv $(DESTDIR)/usr/etc
- install -s -m 4755 keyenvoy $(DESTDIR)/usr/etc
-
-depend:
- rm -f makedep
- for i in ${SRCS}; do \
- ${CC} -M ${INCPATH} $$i | \
- awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
- else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
- else rec = rec " " $$2 } } \
- END { print rec } ' >> makedep; done
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile
-
-# DO NOT DELETE THIS LINE -- make depend uses it
-
-
diff --git a/lib/librpc/secure_rpc/keyserv/detach.c b/lib/librpc/secure_rpc/keyserv/detach.c
deleted file mode 100644
index ff1fac3..0000000
--- a/lib/librpc/secure_rpc/keyserv/detach.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)detach.c 2.2 88/08/10 4.0 RPCSRC";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-/*
- * detach from tty
- */
-detachfromtty()
-{
- int tt;
-
- close(0);
- close(1);
- close(2);
- switch (fork()) {
- case -1:
- perror("fork");
- break;
- case 0:
- break;
- default:
- exit(0);
- }
- tt = open("/dev/tty", O_RDWR);
- if (tt > 0) {
- ioctl(tt, TIOCNOTTY, 0);
- close(tt);
- }
- (void)open("/dev/null", O_RDWR, 0);
- dup(0);
- dup(0);
-}
-
-
diff --git a/lib/librpc/secure_rpc/keyserv/keyenvoy.c b/lib/librpc/secure_rpc/keyserv/keyenvoy.c
deleted file mode 100644
index 5379651..0000000
--- a/lib/librpc/secure_rpc/keyserv/keyenvoy.c
+++ /dev/null
@@ -1,213 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)keyenvoy.c 2.2 88/08/10 4.0 RPCSRC";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <fcntl.h>
-
-/*
- * Talk to the keyserver on a privileged port on the part of a calling program.
- *
- * Protocol is for caller to send through stdin the procedure number
- * to call followed by the argument data. We call the keyserver, and
- * send the results back to the caller through stdout.
- * Non-zero exit status means something went wrong.
- */
-
-#ifndef DEBUG
-#define debug(msg)
-#endif
-
-#define TOTAL_TIMEOUT 30 /* total timeout talking to keyserver */
-#define TOTAL_TRIES 10 /* Number of tries */
-
-/*
- * Opaque data that we send and receive
- */
-#define MAXOPAQUE 256
-struct opaqn {
- u_int len;
- u_int data[MAXOPAQUE];
-};
-bool_t xdr_opaqn();
-
-
-main(argc,argv)
- int argc;
- char *argv[];
-{
- XDR xdrs_args;
- XDR xdrs_rslt;
- int proc;
- struct opaqn args, rslt;
-
-
- if (isatty(0)) {
- fprintf(stderr,
- "This program cannot be used interactively.\n");
- exit(1);
- }
-
-#ifdef DEBUG
- close(2);
- open("/dev/console", O_WRONLY, 0);
-#endif
-
- xdrstdio_create(&xdrs_args, stdin, XDR_DECODE);
- xdrstdio_create(&xdrs_rslt, stdout, XDR_ENCODE);
-
- if ( ! xdr_u_long(&xdrs_args, &proc)) {
- debug("no proc");
- exit(1);
- }
- if (! xdr_opaqn(&xdrs_args, &args)) {
- debug("recving args failed");
- exit(1);
- }
- if (! callkeyserver(proc, xdr_opaqn, &args, xdr_opaqn, &rslt)) {
- debug("rpc_call failed");
- exit(1);
- }
- if (! xdr_opaqn(&xdrs_rslt, &rslt)) {
- debug("sending args failed");
- exit(1);
- }
- exit(0);
-}
-
-
-
-callkeyserver(proc, xdr_args, args, xdr_rslt, rslt)
- u_long proc;
- bool_t (*xdr_args)();
- void *args;
- bool_t (*xdr_rslt)();
- void *rslt;
-
-{
- struct sockaddr_in remote;
- int port;
- struct timeval wait;
- enum clnt_stat stat;
- CLIENT *client;
- int sd;
-
- /*
- * set up the remote address
- * and create client
- */
- remote.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- remote.sin_family = AF_INET;
- remote.sin_port = 0;
- wait.tv_sec = TOTAL_TIMEOUT/TOTAL_TRIES; wait.tv_usec = 0;
- sd = RPC_ANYSOCK;
- client = clntudp_create(&remote, KEY_PROG, KEY_VERS, wait, &sd);
- if (client == NULL) {
- debug("no client");
- return (0);
- }
-
- /*
- * Check that server is bound to a reserved port, so
- * that noone can masquerade as the keyserver.
- */
- if (ntohs(remote.sin_port) >= IPPORT_RESERVED) {
- debug("insecure port");
- return (0);
- }
-
- /*
- * Create authentication
- * All we care about really is sending the real uid
- */
- client->cl_auth = authunix_create("", getuid(), 0, 0, NULL);
- if (client->cl_auth == NULL) {
- debug("no auth");
- return (0);
- }
- wait.tv_sec = TOTAL_TIMEOUT; wait.tv_usec = 0;
- stat = clnt_call(client, proc, xdr_args, args, xdr_rslt, rslt, wait);
- if (stat != RPC_SUCCESS) {
- debug("clnt_call failed");
- }
- return (stat == RPC_SUCCESS);
-}
-
-
-/*
- * XDR opaque data
- * Don't know the length on decode, so just keep receiving until failure.
- */
-bool_t
-xdr_opaqn(xdrs, objp)
- XDR *xdrs;
- struct opaqn *objp;
-{
- int i;
-
- switch (xdrs->x_op) {
- case XDR_FREE:
- break;
- case XDR_DECODE:
- for (i = 0; i < MAXOPAQUE && xdr_int(xdrs, &objp->data[i]); i++) {
- }
- if (i == MAXOPAQUE) {
- return (FALSE);
- }
- objp->len = i;
- break;
- case XDR_ENCODE:
- for (i = 0; i < objp->len; i++) {
- if (! xdr_int(xdrs, &objp->data[i])) {
- return (FALSE);
- }
- }
- break;
- }
- return (TRUE);
-}
-
-
-#ifdef DEBUG
-debug(msg)
- char *msg;
-{
- fprintf(stderr, "%s\n", msg);
-}
-#endif
diff --git a/lib/librpc/secure_rpc/keyserv/keyserv.c b/lib/librpc/secure_rpc/keyserv/keyserv.c
deleted file mode 100644
index d82dc12..0000000
--- a/lib/librpc/secure_rpc/keyserv/keyserv.c
+++ /dev/null
@@ -1,458 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)keyserv.c 2.4 88/08/15 4.0 RPCSRC Copyr 1988 Sun Micro";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-/*
- * Keyserver
- * Store secret keys per uid. Do public key encryption and decryption
- * operations. Generate "random" keys. Do not talk to anything but a local root
- * process (by checking that the source port < IPPORT_RESERVED and by binding
- * to the loopback address).
- */
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <rpc/rpc.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <pwd.h>
-#include <des_crypt.h>
-#include <rpc/key_prot.h>
-
-
-char ROOTKEY[] = "/etc/.rootkey";
-
-extern long random();
-
-extern keystatus pk_setkey();
-extern keystatus pk_encrypt();
-extern keystatus pk_decrypt();
-
-
-#ifdef DEBUG
-int debugging = 1;
-#else
-int debugging = 0;
-#endif
-
-static void keyprogram();
-des_block masterkey;
-
-main(argc, argv)
- int argc;
- char *argv[];
-
-{
- SVCXPRT *transp;
- int nflag;
-
- nflag = (argc == 2) && (strcmp(argv[1], "-n") == 0);
- if (!(argc == 1 || nflag)) {
- (void) fprintf(stderr, "usage: %s [-n]\n", argv[0]);
- exit(1);
- }
- /*
- * Initialize
- */
- (void) umask(066); /* paranoia */
- if (geteuid() != 0) {
- (void) fprintf(stderr, "%s must be run as root\n", argv[0]);
- exit(1);
- }
- setmodulus(HEXMODULUS);
- openstore();
- getrootkey(&masterkey, nflag);
- readkeys();
-
- /*
- * create the service, register it, and run
- */
- transp = svcudp_create(RPC_ANYSOCK);
- if (transp == NULL) {
- (void) fprintf(stderr,
- "%s: unable to create udp service\n", argv[0]);
- exit(1);
- }
- pmap_unset(KEY_PROG, KEY_VERS);
- if (!svc_register(transp, KEY_PROG, KEY_VERS, keyprogram,
- IPPROTO_UDP)) {
- (void) fprintf(stderr, "%s: unable to register service\n",
- argv[0]);
- exit(1);
- }
- /*
- * run
- */
- if (!debugging) {
- detachfromtty();
- }
- svc_run();
- abort();
-}
-
-/*
- * In the event that we don't get a root password, we try to randomize the
- * master key the best we can
- */
-randomize(master)
- des_block *master;
-{
- int i;
- int seed;
- struct timeval tv;
- int shift;
-
- seed = 0;
- for (i = 0; i < 1024; i++) {
- (void) gettimeofday(&tv, (struct timezone *) NULL);
- shift = i % 8 * sizeof(int);
- seed ^= (tv.tv_usec << shift) | (tv.tv_usec >> (32 - shift));
- }
- srandom(seed);
- master->key.low = random();
- master->key.high = random();
- srandom(seed);
-}
-
-
-
-/*
- * Try to get root's secret key, by prompting if terminal is a tty, else trying
- * from standard input.
- */
-getrootkey(master, prompt)
- des_block *master;
- int prompt;
-{
- char *getpass();
- char *passwd;
- char name[MAXNETNAMELEN + 1];
- char secret[HEXKEYBYTES + 1];
- char *crypt();
- int fd;
-
- if (!prompt) {
- /*
- * Read secret key out of $ROOTKEY
- */
- fd = open(ROOTKEY, O_RDONLY, 0);
- if (fd < 0) {
- randomize(master);
- return (0);
- }
- if (read(fd, secret, HEXKEYBYTES) < 0) {
- (void) fprintf(stderr, "Invalid %s\n", ROOTKEY);
- (void) close(fd);
- return (0);
- }
- (void) close(fd);
- secret[HEXKEYBYTES] = 0;
- } else {
- /*
- * Decrypt yellow pages entry to get secret key
- */
- passwd = getpass("root password:");
- passwd2des(passwd, master);
- getnetname(name);
- if (!getsecretkey(name, secret, passwd)) {
- (void) fprintf(stderr,
- "Can't find %s's secret key\n", name);
- return (0);
- }
- if (secret[0] == 0) {
- (void) fprintf(stderr,
- "Invalid password for %s\n", name);
- return (0);
- }
- }
- (void) pk_setkey(0, secret);
- return (1);
-}
-
-
-/*
- * Procedures to implement RPC service
- */
-
-char *
-strstatus(status)
- keystatus status;
-{
- switch (status) {
- case KEY_SUCCESS:
- return ("KEY_SUCCESS");
- case KEY_NOSECRET:
- return ("KEY_NOSECRET");
- case KEY_UNKNOWN:
- return ("KEY_UNKNOWN");
- case KEY_SYSTEMERR:
- return ("KEY_SYSTEMERR");
- default:
- return ("(bad result code)");
- }
-}
-
-keystatus *
-key_set_1(uid, key)
- short uid;
- keybuf key;
-{
- static keystatus status;
-
- if (debugging) {
- (void) fprintf(stderr, "set(%d, %.*s) = ", uid,
- sizeof(keybuf), key);
- }
- status = pk_setkey(uid, key);
- if (debugging) {
- (void) fprintf(stderr, "%s\n", strstatus(status));
- (void) fflush(stderr);
- }
- return (&status);
-}
-
-
-
-cryptkeyres *
-key_encrypt_1(uid, arg)
- short uid;
- cryptkeyarg *arg;
-{
- static cryptkeyres res;
-
- if (debugging) {
- (void) fprintf(stderr, "encrypt(%d, %s, %08x%08x) = ", uid,
- arg->remotename, arg->deskey.key.high,
- arg->deskey.key.low);
- }
- res.cryptkeyres_u.deskey = arg->deskey;
- res.status = pk_encrypt(uid, arg->remotename, &res.cryptkeyres_u.deskey);
- if (debugging) {
- if (res.status == KEY_SUCCESS) {
- (void) fprintf(stderr, "%08x%08x\n",
- res.cryptkeyres_u.deskey.key.high,
- res.cryptkeyres_u.deskey.key.low);
- } else {
- (void) fprintf(stderr,
- "%s\n", strstatus(res.status));
- }
- (void) fflush(stderr);
- }
- return (&res);
-}
-
-cryptkeyres *
-key_decrypt_1(uid, arg)
- short uid;
- cryptkeyarg *arg;
-{
- static cryptkeyres res;
-
- if (debugging) {
- (void) fprintf(stderr, "decrypt(%d, %s, %08x%08x) = ", uid,
- arg->remotename, arg->deskey.key.high,
- arg->deskey.key.low);
- }
- res.cryptkeyres_u.deskey = arg->deskey;
- res.status = pk_decrypt(uid, arg->remotename,
- &res.cryptkeyres_u.deskey);
- if (debugging) {
- if (res.status == KEY_SUCCESS) {
- (void) fprintf(stderr, "%08x%08x\n",
- res.cryptkeyres_u.deskey.key.high,
- res.cryptkeyres_u.deskey.key.low);
- } else {
- (void) fprintf(stderr, "%s\n", strstatus(res.status));
- }
- (void) fflush(stderr);
- }
- return (&res);
-}
-
-des_block *
-key_gen_1()
-{
- struct timeval time;
- static des_block keygen;
- static des_block key;
-
- (void) gettimeofday(&time, (struct timezone *) NULL);
- keygen.key.high += (time.tv_sec ^ time.tv_usec);
- keygen.key.low += (time.tv_sec ^ time.tv_usec);
- ecb_crypt(&masterkey, &keygen, sizeof(keygen), DES_ENCRYPT | DES_HW);
- key = keygen;
- des_setparity(&key);
- if (debugging) {
- (void) fprintf(stderr, "gen() = %08x%08x\n", key.key.high,
- key.key.low);
- (void) fflush(stderr);
- }
- return (&key);
-}
-
-/* ARGSUSED */
-getcredres *
-key_getcred_1(uid, name)
- short uid;
- netnamestr *name;
-{
- static getcredres res;
- static int gids[NGROUPS];
- struct unixcred *cred;
-
- cred = &res.getcredres_u.cred;
- cred->gids.gids_val = gids;
- if (!netname2user(*name, &cred->uid, &cred->gid,
- &cred->gids.gids_len, gids)) {
- res.status = KEY_UNKNOWN;
- } else {
- res.status = KEY_SUCCESS;
- }
- if (debugging) {
- (void) fprintf(stderr, "getcred(%s) = ", *name);
- if (res.status == KEY_SUCCESS) {
- (void) fprintf(stderr, "uid=%d,gid=%d,grouplen=%d\n",
- cred->uid, cred->gid, cred->gids.gids_len);
- } else {
- (void) fprintf(stderr, "%s\n", strstatus(res.status));
- }
- (void) fflush(stderr);
- }
- return (&res);
-}
-
-
-/*
- * RPC boilerplate
- */
-static void
-keyprogram(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- union {
- keybuf key_set_1_arg;
- cryptkeyarg key_encrypt_1_arg;
- cryptkeyarg key_decrypt_1_arg;
- des_block key_gen_1_arg;
- } argument;
- char *result;
-
- bool_t(*xdr_argument) (), (*xdr_result) ();
- char *(*local) ();
- struct sockaddr_in remote;
- int uid;
- int check_auth;
-
- switch (rqstp->rq_proc) {
- case NULLPROC:
- svc_sendreply(transp, xdr_void, (char *) NULL);
- return;
-
- case KEY_SET:
- xdr_argument = xdr_keybuf;
- xdr_result = xdr_int;
- local = (char *(*)()) key_set_1;
- check_auth = 1;
- break;
-
- case KEY_ENCRYPT:
- xdr_argument = xdr_cryptkeyarg;
- xdr_result = xdr_cryptkeyres;
- local = (char *(*)()) key_encrypt_1;
- check_auth = 1;
- break;
-
- case KEY_DECRYPT:
- xdr_argument = xdr_cryptkeyarg;
- xdr_result = xdr_cryptkeyres;
- local = (char *(*)()) key_decrypt_1;
- check_auth = 1;
- break;
-
- case KEY_GEN:
- xdr_argument = xdr_void;
- xdr_result = xdr_des_block;
- local = (char *(*)()) key_gen_1;
- check_auth = 0;
- break;
-
- case KEY_GETCRED:
- xdr_argument = xdr_netnamestr;
- xdr_result = xdr_getcredres;
- local = (char *(*)()) key_getcred_1;
- check_auth = 0;
- break;
-
- default:
- svcerr_noproc(transp);
- return;
- }
- if (check_auth) {
- remote = *svc_getcaller(transp);
- if (ntohs(remote.sin_port) >= IPPORT_RESERVED ||
- ntohl(remote.sin_addr.s_addr) != INADDR_LOOPBACK) {
- if (debugging) {
- (void) fprintf(stderr,
- "not local privileged process\n");
- }
- svcerr_weakauth(transp);
- return;
- }
- if (rqstp->rq_cred.oa_flavor != AUTH_UNIX) {
- if (debugging) {
- (void) fprintf(stderr,
- "not unix authentication\n");
- }
- svcerr_weakauth(transp);
- return;
- }
- uid = ((struct authunix_parms *) rqstp->rq_clntcred)->aup_uid;
- }
- bzero((char *) &argument, sizeof(argument));
- if (!svc_getargs(transp, xdr_argument, &argument)) {
- svcerr_decode(transp);
- return;
- }
- result = (*local) (uid, &argument);
- if (!svc_sendreply(transp, xdr_result, (char *) result)) {
- (void) fprintf(stderr, "unable to reply\n");
- svcerr_systemerr(transp);
- }
- if (!svc_freeargs(transp, xdr_argument, &argument)) {
- (void) fprintf(stderr, "unable to free arguments\n");
- exit(1);
- }
-}
diff --git a/lib/librpc/secure_rpc/keyserv/mp.c b/lib/librpc/secure_rpc/keyserv/mp.c
deleted file mode 100644
index 97c85b0..0000000
--- a/lib/librpc/secure_rpc/keyserv/mp.c
+++ /dev/null
@@ -1,145 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)mp.c 2.1 88/08/15 4.0 RPCSRC Copyr 1988 Sun Micro";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * These routines add hexadecimal functionality to the multiple-precision
- * library.
- */
-#include <stdio.h>
-#include <mp.h>
-
-void mfree();
-
-/*
- * Convert hex digit to binary value
- */
-static int
-xtoi(c)
- char c;
-{
- if (c >= '0' && c <= '9') {
- return(c - '0');
- } else if (c >= 'a' && c <= 'f') {
- return(c - 'a' + 10);
- } else {
- return(-1);
- }
-}
-
-/*
- * Convert hex key to MINT key
- */
-MINT *
-xtom(key)
- char *key;
-{
- int digit;
- MINT *m = itom(0);
- MINT *d;
- MINT *sixteen;
- sixteen = itom(16);
- for (; *key; key++) {
- digit = xtoi(*key);
- if (digit < 0) {
- return(NULL);
- }
- d = itom(digit);
- mult(m,sixteen,m);
- madd(m,d,m);
- mfree(d);
- }
- mfree(sixteen);
- return(m);
-}
-static char
-itox(d)
- short d;
-{
- d &= 15;
- if (d < 10) {
- return('0' + d);
- } else {
- return('a' - 10 + d);
- }
-}
-/*
- * Convert MINT key to hex key
- */
-char *
-mtox(key)
- MINT *key;
-{
- MINT *m = itom(0);
- MINT *zero = itom(0);
- short r;
- char *p;
- char c;
- char *s;
- char *hex;
- int size;
-#define BASEBITS (8*sizeof(short) - 1)
- if (key->len >= 0) {
- size = key->len;
- } else {
- size = -key->len;
- }
- hex = malloc((unsigned) ((size * BASEBITS + 3)) / 4 + 1);
- if (hex == NULL) {
- return(NULL);
- }
- move(key,m);
- p = hex;
- do {
- sdiv(m,16,m,&r);
- *p++ = itox(r);
- } while (mcmp(m,zero) != 0);
- mfree(m);
- mfree(zero);
- *p = 0;
- for (p--, s = hex; s < p; s++, p--) {
- c = *p;
- *p = *s;
- *s = c;
- }
- return(hex);
-}
-/*
- * Deallocate a multiple precision integer
- */
-void
-mfree(a)
- MINT *a;
-{
- xfree(a);
- free((char *)a);
-}
-
diff --git a/lib/librpc/secure_rpc/keyserv/setkey.c b/lib/librpc/secure_rpc/keyserv/setkey.c
deleted file mode 100644
index d62dc9c..0000000
--- a/lib/librpc/secure_rpc/keyserv/setkey.c
+++ /dev/null
@@ -1,514 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)setkey.c 2.2 88/08/10 4.0 RPCSRC; from Copyr 1988 Sun Micro";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-/*
- * Do the real work of the keyserver .
- * Store secret keys. Compute common keys,
- * and use them to decrypt and encrypt DES keys .
- * Cache the common keys, so the
- * expensive computation is avoided.
- */
-#include <stdio.h>
-#include <sys/file.h>
-#include <mp.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-#include <des_crypt.h>
-#include <sys/errno.h>
-
-extern char *malloc();
-extern char ROOTKEY[];
-
-static MINT *MODULUS;
-static char *fetchsecretkey();
-static keystatus pk_crypt();
-
-
-/*
- * Set the modulus for all our Diffie-Hellman operations
- */
-setmodulus(modx)
- char *modx;
-{
- MODULUS = xtom(modx);
-}
-
-
-/*
- * Set the secretkey key for this uid
- */
-keystatus
-pk_setkey(uid, skey)
- short uid;
- keybuf skey;
-{
- if (!storesecretkey(uid, skey)) {
- return (KEY_SYSTEMERR);
- }
- return (KEY_SUCCESS);
-}
-
-
-/*
- * Encrypt the key using the public key associated with remote_name and the
- * secret key associated with uid.
- */
-keystatus
-pk_encrypt(uid, remote_name, key)
- short uid;
- char *remote_name;
- des_block *key;
-{
- return (pk_crypt(uid, remote_name, key, DES_ENCRYPT));
-}
-
-
-/*
- * Decrypt the key using the public key associated with remote_name and the
- * secret key associated with uid.
- */
-keystatus
-pk_decrypt(uid, remote_name, key)
- short uid;
- char *remote_name;
- des_block *key;
-{
- return (pk_crypt(uid, remote_name, key, DES_DECRYPT));
-}
-
-
-/*
- * Do the work of pk_encrypt && pk_decrypt
- */
-static keystatus
-pk_crypt(uid, remote_name, key, mode)
- short uid;
- char *remote_name;
- des_block *key;
- int mode;
-{
- char *xsecret;
- char xpublic[HEXKEYBYTES + 1];
- char xsecret_hold[HEXKEYBYTES + 1];
- des_block deskey;
- int err;
- MINT *public;
- MINT *secret;
- MINT *common;
- char zero[8];
-
- xsecret = fetchsecretkey(uid);
- if (xsecret == NULL) {
- bzero(zero, sizeof(zero));
- xsecret = xsecret_hold;
- if (!getsecretkey("nobody", xsecret, zero) ||
- xsecret[0] == 0) {
- return (KEY_NOSECRET);
- }
- }
- if (!getpublickey(remote_name, xpublic) &&
- !getpublickey("nobody", xpublic)) {
- return (KEY_UNKNOWN);
- }
- if (!readcache(xpublic, xsecret, &deskey)) {
- public = xtom(xpublic);
- secret = xtom(xsecret);
- common = itom(0);
- pow(public, secret, MODULUS, common);
- extractdeskey(common, &deskey);
- writecache(xpublic, xsecret, &deskey);
- mfree(secret);
- mfree(public);
- mfree(common);
- }
- err = ecb_crypt(&deskey, key, sizeof(des_block), DES_HW | mode);
- if (DES_FAILED(err)) {
- return (KEY_SYSTEMERR);
- }
- return (KEY_SUCCESS);
-}
-
-
-/*
- * Choose middle 64 bits of the common key to use as our des key, possibly
- * overwriting the lower order bits by setting parity.
- */
-static
-extractdeskey(ck, deskey)
- MINT *ck;
- des_block *deskey;
-{
- MINT *a;
- short r;
- int i;
- short base = (1 << 8);
- char *k;
-
-
- a = itom(0);
- move(ck, a);
- for (i = 0; i < ((KEYSIZE - 64) / 2) / 8; i++) {
- sdiv(a, base, a, &r);
- }
- k = deskey->c;
- for (i = 0; i < 8; i++) {
- sdiv(a, base, a, &r);
- *k++ = r;
- }
- mfree(a);
- des_setparity(deskey);
-}
-
-
-/*
- * Key storage management
- */
-
-struct secretkey_list {
- short uid;
- char secretkey[HEXKEYBYTES+1];
- struct secretkey_list *next;
-};
-
-static struct secretkey_list *g_secretkeys;
-
-/*
- * Fetch the secret key for this uid
- */
-static char *
-fetchsecretkey(uid)
- short uid;
-{
- struct secretkey_list *l;
-
- for (l = g_secretkeys; l != NULL; l = l->next) {
- if (l->uid == uid) {
- return (l->secretkey);
- }
- }
- return (NULL);
-}
-
-/*
- * Store the secretkey for this uid
- */
-storesecretkey(uid, key)
- short uid;
- keybuf key;
-{
- struct secretkey_list *new;
- struct secretkey_list **l;
- int nitems;
-
-
- nitems = 0;
- for (l = &g_secretkeys; *l != NULL && (*l)->uid != uid;
- l = &(*l)->next) {
- nitems++;
- }
- if (*l == NULL) {
- new = (struct secretkey_list *)malloc(sizeof(*new));
- if (new == NULL) {
- return (0);
- }
- new->uid = uid;
- new->next = NULL;
- *l = new;
- } else {
- new = *l;
- }
- bcopy(key, new->secretkey, HEXKEYBYTES);
- new->secretkey[HEXKEYBYTES] = 0;
- seekitem(nitems);
- writeitem(uid, new->secretkey);
- return (1);
-}
-
-
-hexdigit(val)
- int val;
-{
- return ("0123456789abcdef"[val]);
-
-}
-bin2hex(bin, hex, size)
- unsigned char *bin;
- unsigned char *hex;
- int size;
-{
- int i;
-
- for (i = 0; i < size; i++) {
- *hex++ = hexdigit(*bin >> 4);
- *hex++ = hexdigit(*bin++ & 0xf);
- }
-}
-
-hexval(dig)
- char dig;
-{
- if ('0' <= dig && dig <= '9') {
- return (dig - '0');
- } else if ('a' <= dig && dig <= 'f') {
- return (dig - 'a' + 10);
- } else if ('A' <= dig && dig <= 'F') {
- return (dig - 'A' + 10);
- } else {
- return (-1);
- }
-}
-
-hex2bin(hex, bin, size)
- unsigned char *hex;
- unsigned char *bin;
- int size;
-{
- int i;
-
- for (i = 0; i < size; i++) {
- *bin = hexval(*hex++) << 4;
- *bin++ |= hexval(*hex++);
- }
-}
-
-static char KEYSTORE[] = "/etc/keystore";
-FILE *kf;
-
-openstore()
-{
- kf = fopen(KEYSTORE, "r+");
- if (kf == NULL) {
- kf = fopen(KEYSTORE, "w+");
- if (kf == NULL) {
- return (0);
- }
- }
- setbuf(kf, NULL);
- return (1);
-}
-
-static char rootkey[KEYBYTES];
-static int haverootkey;
-struct storedkey {
- short uid;
- char crypt[KEYBYTES];
-};
-
-readkeys()
-{
- struct secretkey_list *node;
- struct secretkey_list **l;
- int uid;
- char secretkey[HEXKEYBYTES+1];
-
- if (kf == NULL) {
- return;
- }
- l = &g_secretkeys;
- seekitem(0);
- while (readitem(&uid, secretkey)) {
- node = (struct secretkey_list *)malloc(sizeof(*node));
- if (node == NULL) {
- return;
- }
- node->uid = uid;
- bcopy(secretkey, node->secretkey, HEXKEYBYTES + 1);
- node->next = NULL;
- *l = node;
- l = &node->next;
- }
-}
-
-writekeys()
-{
- struct secretkey_list *k;
-
- seekitem(0);
- for (k = g_secretkeys; k != NULL; k = k->next) {
- writeitem(k->uid, k->secretkey);
- }
-}
-
-seekitem(item)
- int item;
-{
- if (kf != NULL) {
- fseek(kf, item * sizeof(struct storedkey), 0);
- }
-}
-
-writeitem(uid, key)
- int uid;
- char *key;
-{
- struct storedkey item;
- char rootkey_tmp[KEYBYTES];
- int reencrypt;
-
- if (kf == NULL) {
- return (1);
- }
- if (uid == 0) {
- writerootkey(key);
- hex2bin(key, rootkey_tmp, KEYBYTES);
- reencrypt = (haverootkey &&
- bcmp(rootkey, rootkey_tmp, KEYBYTES) != 0);
- bcopy(rootkey_tmp, rootkey, KEYBYTES);
- haverootkey = 1;
- if (reencrypt) {
- writekeys();
- return (1);
- }
- }
- if (!haverootkey) {
- return (1);
- }
- item.uid = uid;
- hex2bin(key, item.crypt, KEYBYTES);
- ecb_crypt(rootkey, item.crypt, KEYBYTES, DES_ENCRYPT|DES_HW);
- return (fwrite(&item, sizeof(item), 1, kf) >= 0);
-}
-
-
-readitem(uidp, key)
- int *uidp;
- char *key;
-{
- struct storedkey item;
-
- if (!haverootkey || kf == NULL) {
- return (0);
- }
- if (fread(&item, sizeof(item), 1, kf) != 1) {
- return (0);
- }
- *uidp = item.uid;
- ecb_crypt(rootkey, item.crypt, KEYBYTES, DES_DECRYPT|DES_HW);
- bin2hex(item.crypt, key, KEYBYTES);
- key[HEXKEYBYTES] = 0;
- return (1);
-}
-
-/*
- * Root users store their key in /etc/$ROOTKEY so
- * that they can auto reboot without having to be
- * around to type a password. Storing this in a file
- * is rather dubious: it should really be in the EEPROM
- * so it does not go over the net for diskless machines.
- */
-writerootkey(secret)
- char *secret;
-{
- char newline = '\n';
- int fd;
-
- fd = open(ROOTKEY, O_WRONLY|O_TRUNC|O_CREAT, 0);
- if (fd < 0) {
- perror(ROOTKEY);
- } else {
- if (write(fd, secret, strlen(secret)) < 0 ||
- write(fd, &newline, sizeof(newline)) < 0) {
- (void)fprintf(stderr, "%s: ", ROOTKEY);
- perror("write");
- }
- close(fd);
- }
-}
-
-
-/*
- * Exponential caching management
- */
-struct cachekey_list {
- keybuf secret;
- keybuf public;
- des_block deskey;
- struct cachekey_list *next;
-};
-static struct cachekey_list *g_cachedkeys;
-
-
-/*
- * cache result of expensive multiple precision exponential operation
- */
-static
-writecache(pub, sec, deskey)
- char *pub;
- char *sec;
- des_block *deskey;
-{
- struct cachekey_list *new;
-
- new = (struct cachekey_list *) malloc(sizeof(struct cachekey_list));
- if (new == NULL) {
- return;
- }
- bcopy(pub, new->public, sizeof(keybuf));
- bcopy(sec, new->secret, sizeof(keybuf));
- new->deskey = *deskey;
- new->next = g_cachedkeys;
- g_cachedkeys = new;
-}
-
-/*
- * Try to find the common key in the cache
- */
-static
-readcache(pub, sec, deskey)
- char *pub;
- char *sec;
- des_block *deskey;
-{
- struct cachekey_list *found;
- register struct cachekey_list **l;
-
-#define cachehit(pub, sec, list) \
- (bcmp(pub, (list)->public, sizeof(keybuf)) == 0 && \
- bcmp(sec, (list)->secret, sizeof(keybuf)) == 0)
-
- for (l = &g_cachedkeys;
- (*l) != NULL && !cachehit(pub, sec, *l);
- l = &(*l)->next);
- if ((*l) == NULL) {
- return (0);
- }
- found = *l;
- (*l) = (*l)->next;
- found->next = g_cachedkeys;
- g_cachedkeys = found;
- *deskey = found->deskey;
- return (1);
-}
diff --git a/lib/librpc/secure_rpc/man/chkey.1 b/lib/librpc/secure_rpc/man/chkey.1
deleted file mode 100644
index fbf1fcd..0000000
--- a/lib/librpc/secure_rpc/man/chkey.1
+++ /dev/null
@@ -1,19 +0,0 @@
-.\" @(#)chkey.1 2.1 88/08/10 4.0 RPCSRC; from 1.6 88/02/29 SMI;
-.TH CHKEY 1 "9 September 1987"
-.SH NAME
-chkey \- change your encryption key
-.SH SYNOPSIS
-.B chkey
-.SH DESCRIPTION
-.IX "chkey command" "" "\fLchkey\fP command"
-.IX "encryption key, change, \fLchkey\fR command"
-.B chkey
-prompts the user for their login password, and uses it to encrypt
-a new encryption key for the user to be stored in the
-.BR publickey (5)
-database.
-.SH "SEE ALSO"
-.BR keylogin (1),
-.BR publickey (5),
-.BR keyserv (8C),
-.BR newkey (8)
diff --git a/lib/librpc/secure_rpc/man/des_crypt.3 b/lib/librpc/secure_rpc/man/des_crypt.3
deleted file mode 100644
index ca0a33e..0000000
--- a/lib/librpc/secure_rpc/man/des_crypt.3
+++ /dev/null
@@ -1,126 +0,0 @@
-.\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
-.TH DES_CRYPT 3 "6 October 1987"
-.SH NAME
-des_crypt, ecb_crypt, cbc_crypt, des_setparity \- fast DES encryption
-.SH SYNOPSIS
-.nf
-.B #include <des_crypt.h>
-.LP
-.B int ecb_crypt(key, data, datalen, mode)
-.B char *key;
-.B char *data;
-.B unsigned datalen;
-.B unsigned mode;
-.LP
-.B int cbc_crypt(key, data, datalen, mode, ivec)
-.B char *key;
-.B char *data;
-.B unsigned datalen;
-.B unsigned mode;
-.B char *ivec;
-.LP
-.B void des_setparity(key)
-.B char *key;
-.fi
-.SH DESCRIPTION
-.IX encryption cbc_crypt "" \fLcbc_crypt\fP
-.IX "des encryption" cbc_crypt "DES encryption" \fLcbc_crypt\fP
-.IX encryption des_setparity "" \fLdes_setparity\fP
-.IX "des encryption" des_setparity "DES encryption" \fLdes_setparity\fP
-.B ecb_crypt(\|)
-and
-.B cbc_crypt(\|)
-implement the
-.SM NBS
-.SM DES
-(Data Encryption Standard).
-These routines are faster and more general purpose than
-.BR crypt (3).
-They also are able to utilize
-.SM DES
-hardware if it is available.
-.B ecb_crypt(\|)
-encrypts in
-.SM ECB
-(Electronic Code Book)
-mode, which encrypts blocks of data independently.
-.B cbc_crypt(\|)
-encrypts in
-.SM CBC
-(Cipher Block Chaining)
-mode, which chains together
-successive blocks.
-.SM CBC
-mode protects against insertions, deletions and
-substitutions of blocks. Also, regularities in the clear text will
-not appear in the cipher text.
-.LP
-Here is how to use these routines. The first parameter,
-.IR key ,
-is the 8-byte encryption key with parity.
-To set the key's parity, which for
-.SM DES
-is in the low bit of each byte, use
-.IR des_setparity .
-The second parameter,
-.IR data ,
-contains the data to be encrypted or decrypted. The
-third parameter,
-.IR datalen ,
-is the length in bytes of
-.IR data ,
-which must be a multiple of 8. The fourth parameter,
-.IR mode ,
-is formed by
-.SM OR\s0'ing
-together some things. For the encryption direction 'or' in either
-.SM DES_ENCRYPT
-or
-.SM DES_DECRYPT\s0.
-For software versus hardware
-encryption, 'or' in either
-.SM DES_HW
-or
-.SM DES_SW\s0.
-If
-.SM DES_HW
-is specified, and there is no hardware, then the encryption is performed
-in software and the routine returns
-.SM DESERR_NOHWDEVICE\s0.
-For
-.IR cbc_crypt ,
-the parameter
-.I ivec
-is the the 8-byte initialization
-vector for the chaining. It is updated to the next initialization
-vector upon return.
-.LP
-.SH "SEE ALSO"
-.BR des (1),
-.BR crypt (3)
-.SH DIAGNOSTICS
-.PD 0
-.TP 20
-.SM DESERR_NONE
-No error.
-.TP
-.SM DESERR_NOHWDEVICE
-Encryption succeeded, but done in software instead of the requested hardware.
-.TP
-.SM DESERR_HWERR
-An error occurred in the hardware or driver.
-.TP
-.SM DESERR_BADPARAM
-Bad parameter to routine.
-.PD
-.LP
-Given a result status
-.IR stat ,
-the macro
-.SM DES_FAILED\c
-.BR ( stat )
-is false only for the first two statuses.
-.SH RESTRICTIONS
-These routines are not available in RPCSRC 4.0.
-This information is provided to describe the DES interface expected by
-Secure RPC.
diff --git a/lib/librpc/secure_rpc/man/keyenvoy.8c b/lib/librpc/secure_rpc/man/keyenvoy.8c
deleted file mode 100644
index 8cf7bc3..0000000
--- a/lib/librpc/secure_rpc/man/keyenvoy.8c
+++ /dev/null
@@ -1,22 +0,0 @@
-.\" @(#)keyenvoy.8c 2.1 88/08/10 4.0 RPCSRC; from 1.5 88/03/01 SMI;
-.TH KEYENVOY 8C "9 September 1987"
-.SH NAME
-keyenvoy \- talk to keyserver
-.SH SYNOPSIS
-.B keyenvoy
-.SH DESCRIPTION
-.IX "keyenvoy command" "" "\fLkeyenvoy\fP command"
-.B keyenvoy
-is used by some
-.SM RPC
-programs to talk to the key server,
-.BR keyserv (8C).
-The key server will not talk to anything but a root process, and
-.B keyenvoy
-is a set-uid root process that acts as an intermediary between a user
-process that wishes to talk to the
-key server and the key server itself.
-.LP
-This program cannot be run interactively.
-.SH "SEE ALSO"
-.BR keyserv (8C)
diff --git a/lib/librpc/secure_rpc/man/keylogin.1 b/lib/librpc/secure_rpc/man/keylogin.1
deleted file mode 100644
index 516d9de..0000000
--- a/lib/librpc/secure_rpc/man/keylogin.1
+++ /dev/null
@@ -1,32 +0,0 @@
-.\" @(#)keylogin.1 2.1 88/08/10 4.0 RPCSRC; from 1.6 88/02/29 SMI;
-.TH KEYLOGIN 1 "9 September 1987"
-.SH NAME
-keylogin \- decrypt and store secret key
-.SH SYNOPSIS
-.B keylogin
-.SH DESCRIPTION
-.IX "keylogin command" "" "\fLkeylogin\fR command"
-.LP
-.B keylogin
-prompts the user for their login password, and uses it do decrypt
-the user's secret key stored in the
-.BR publickey (5)
-database. Once decrypted, the user's key is stored by the local
-key server process
-.BR keyserv (8C)
-to be used by any secure network services, such as
-.SM NFS\s0.
-.LP
-Normally,
-.BR login (1)
-does this work when the user logs onto the system, but running
-.B keylogin
-may be necessary if
-the user did not type a password to
-.BR login (1).
-.SH "SEE ALSO"
-.BR chkey (1),
-.BR login (1),
-.BR publickey (5),
-.BR keyserv (8C),
-.BR newkey (8)
diff --git a/lib/librpc/secure_rpc/man/keyserv.8c b/lib/librpc/secure_rpc/man/keyserv.8c
deleted file mode 100644
index aa153ed..0000000
--- a/lib/librpc/secure_rpc/man/keyserv.8c
+++ /dev/null
@@ -1,52 +0,0 @@
-.\" @(#)keyserv.8c 2.1 88/08/10 4.0 RPCSRC; from 1.6 88/03/01 SMI;
-.TH KEYSERV 8C "9 September 1987"
-.SH NAME
-keyserv \- server for storing public and private keys
-.SH SYNOPSIS
-.B keyserv
-[
-.B \-n
-]
-.SH DESCRIPTION
-.IX "keyenvoy server" "" "\fLkeyenvoy\fP server"
-.B keyserv
-is a daemon that is used for storing the
-private encryption keys of each
-user logged into the system. These encryption
-keys are using for accessing
-secure network services such as secure
-.SM NFS\s0.
-When a user logs in to the system, the
-.BR login(1)
-program uses the login password to decrypt
-the user's encryption key stored
-in the Yellow Pages, and then gives the decrypted key to the
-.B keyserv
-daemon to store away.
-.LP
-Normally, root's key is read from the file
-.B /etc/.rootkey
-when the daemon starts up. This is useful during power-fail reboots
-when no one is around to type a password, yet you still want the
-secure network services to operate normally.
-.SH OPTIONS
-.TP
-.B \-n
-Do not read root's key from
-.BR /etc/.rootkey .
-Instead, prompt the user for the password to decrypt
-.B root 's
-key stored in the Yellow Pages and then store the decrypted key in
-.B /etc/.rootkey
-for future use.
-This option is useful if the
-.B /etc/.rootkey
-file ever gets out of date or corrupted.
-.SH FILES
-.PD 0
-.TP 20
-.B /etc/.rootkey
-.PD
-.SH "SEE ALSO"
-.BR login (1),
-.BR publickey (5)
diff --git a/lib/librpc/secure_rpc/man/publickey.3r b/lib/librpc/secure_rpc/man/publickey.3r
deleted file mode 100644
index 7063e8a..0000000
--- a/lib/librpc/secure_rpc/man/publickey.3r
+++ /dev/null
@@ -1,44 +0,0 @@
-.\" @(#)publickey.3r 2.1 88/08/07 4.0 RPCSRC
-.TH PUBLICKEY 3R "6 October 1987"
-.SH NAME
-publickey, getpublickey, getsecretkey \- get public or secret key
-.SH SYNOPSIS
-.nf
-.B #include <rpc/rpc.h>
-.B #include <rpc/key_prot.h>
-.LP
-.B getpublickey(netname, publickey)
-.B char netname[\s-1MAXNETNAMELEN\s0+1];
-.B char publickey[\s-1HEXKEYBYTES\s0+1];
-.LP
-.B getsecretkey(netname, secretkey, passwd)
-.B char netname[\s-1MAXNETNAMELEN\s0+1];
-.B char secretkey[\s-1HEXKEYBYTES\s0+1];
-.B char *passwd;
-.fi
-.SH DESCRIPTION
-.IX "getpublickey function" "" "\fLgetpublickey()\fP function"
-.IX "getsecretkey function" "" "\fLgetsecretkey()\fP function"
-These routines are used to get public and secret keys from the
-.SM YP
-database.
-.B getsecretkey(\|)
-has an extra argument,
-.IR passwd ,
-which is used to decrypt the encrypted secret key stored in the database.
-Both routines return 1 if they are successful in finding the key, 0 otherwise.
-The keys are returned as
-.SM NULL\s0-terminated,
-hexadecimal strings. If the password supplied to
-.B getsecretkey(\|)
-fails to decrypt the secret key, the routine will return 1 but the
-.I secretkey
-argument will be a
-.SM NULL
-string (``'').
-.SH "SEE ALSO"
-.BR publickey (5)
-.LP
-.I \s-1RPC\s0 Programmer's Manual
-in
-.TX NETP
diff --git a/lib/librpc/secure_rpc/man/publickey.5 b/lib/librpc/secure_rpc/man/publickey.5
deleted file mode 100644
index de3c1e9..0000000
--- a/lib/librpc/secure_rpc/man/publickey.5
+++ /dev/null
@@ -1,37 +0,0 @@
-.\" @(#)publickey.5 2.1 88/08/07 4.0 RPCSRC; from 1.6 88/02/29 SMI;
-.TH PUBLICKEY 5 "19 October 1987"
-.SH NAME
-publickey \- public key database
-.SH SYNOPSIS
-.B /etc/publickey
-.SH DESCRIPTION
-.LP
-.B /etc/publickey
-is the public key database used for secure
-networking. Each entry in
-the database consists of a network user
-name (which may either refer to
-a user or a hostname), followed by the user's
-public key (in hex
-notation), a colon, and then the user's
-secret key encrypted with
-its login password (also in hex notation).
-.LP
-This file is altered either by the user through the
-.BR chkey (1)
-command or by the system administrator through the
-.BR newkey (8)
-command.
-The file
-.B /etc/publickey
-should only contain data on the Yellow
-Pages master machine, where it
-is converted into the
-.SM YP
-database
-.BR publickey.byname .
-.SH SEE ALSO
-.BR chkey (1),
-.BR publickey (3R),
-.BR newkey (8),
-.BR ypupdated (8C)
diff --git a/lib/librpc/secure_rpc/man/rpc_secure.3n b/lib/librpc/secure_rpc/man/rpc_secure.3n
deleted file mode 100644
index 6e9a2ee..0000000
--- a/lib/librpc/secure_rpc/man/rpc_secure.3n
+++ /dev/null
@@ -1,330 +0,0 @@
-.\" @(#)rpc_secure.3n 2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
-.TH RPC 3N "16 February 1988"
-.SH NAME
-rpc_secure \- library routines for secure remote procedure calls
-.SH SYNOPSIS AND DESCRIPTION
-These routines are part of the RPC library. They implement DES
-Authentication. See
-.BR rpc (3N)
-for further details about RPC.
-.LP
-.ft B
-.nf
-.sp .5
-#include <rpc/rpc.h>
-.fi
-.ft R
-.br
-.if t .ne 22
-.LP
-.ft B
-.nf
-.sp .5
-\s-1AUTH\s0 *
-authdes_create(name, window, syncaddr, ckey)
-char *name;
-unsigned window;
-struct sockaddr_in *addr;
-des_block *ckey;
-.fi
-.ft R
-.IP
-.B authdes_create(\|)
-is the first of two routines which interface to the
-.SM RPC
-secure authentication system, known as
-.SM DES
-authentication.
-The second is
-.BR authdes_getucred(\|) ,
-below. Note: the keyserver daemon
-.BR keyserv (8C)
-must be running for the
-.SM DES
-authentication system to work.
-.IP
-.BR authdes_create(\|) ,
-used on the client side, returns an authentication handle that
-will enable the use of the secure authentication system.
-The first parameter
-.I name
-is the network name, or
-.IR netname ,
-of the owner of the server process. This field usually
-represents a
-.I hostname
-derived from the utility routine
-.BR host2netname ,
-but could also represent a user name using
-.BR user2netname .
-The second field is window on the validity of
-the client credential, given in seconds. A small
-window is more secure than a large one, but choosing
-too small of a window will increase the frequency of
-resynchronizations because of clock drift. The third
-parameter
-.I syncaddr
-is optional. If it is
-.SM NULL\s0,
-then the authentication system will assume
-that the local clock is always in sync with the server's
-clock, and will not attempt resynchronizations. If an address
-is supplied, however, then the system will use the address
-for consulting the remote time service whenever
-resynchronization
-is required. This parameter is usually the
-address of the
-.SM RPC
-server itself. The final parameter
-.I ckey
-is also optional. If it is
-.SM NULL\s0,
-then the authentication system will
-generate a random
-.SM DES
-key to be used for the encryption of credentials.
-If it is supplied, however, then it will be used instead.
-.br
-.if t .ne 13
-.LP
-.ft B
-.nf
-.sp .5
-authdes_getucred(adc, uid, gid, grouplen, groups)
-struct authdes_cred *adc;
-short *uid;
-short *gid;
-short *grouplen;
-int *groups;
-.fi
-.ft R
-.IP
-.BR authdes_getucred(\|) ,
-the second of the two
-.SM DES
-authentication routines,
-is used on the server side for converting a
-.SM DES
-credential, which is
-operating system independent, into a
-.UX
-credential. This routine differs from utility routine
-.B netname2user
-in that
-.B authdes_getucred(\|)
-pulls its information from a cache, and does not have to do a
-Yellow Pages lookup every time it is called to get its information.
-.br
-.ft .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-host2netname(name, host, domain)
-char *name;
-char *host;
-char *domain;
-.fi
-.ft R
-.IP
-Convert from a domain-specific hostname to an
-operating-system independent netname. Return
-.SM TRUE
-if it succeeds and
-.SM FALSE
-if it fails. Inverse of
-.BR netname2host(\|) .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-key_decryptsession(remotename, deskey)
-char *remotename;
-des_block *deskey;
-.fi
-.ft R
-.IP
-.B key_decryptsession(\|)
-is an interface to the keyserver daemon, which is associated
-with
-.SM RPC\s0's
-secure authentication system (\s-1DES\s0
-authentication).
-User programs rarely need to call it, or its associated routines
-.BR key_encryptsession(\|) ,
-.B key_gendes(\|)
-and
-.BR key_setsecret(\|) .
-System commands such as
-.B login
-and the
-.SM RPC
-library are the main clients of these four routines.
-.IP
-.B key_decryptsession(\|)
-takes a server netname and a des key, and decrypts the key by
-using the the public key of the the server and the secret key
-associated with the effective uid of the calling process. It
-is the inverse of
-.BR key_encryptsession(\|) .
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-key_encryptsession(remotename, deskey)
-char *remotename;
-des_block *deskey;
-.fi
-.ft R
-.IP
-.B key_encryptsession(\|)
-is a keyserver interface routine. It
-takes a server netname and a des key, and encrypts
-it using the public key of the the server and the secret key
-associated with the effective uid of the calling process. It
-is the inverse of
-.BR key_decryptsession(\|) .
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-key_gendes(deskey)
-des_block *deskey;
-.fi
-.ft R
-.IP
-.B key_gendes(\|)
-is a keyserver interface routine. It
-is used to ask the keyserver for a secure conversation key.
-Choosing one at \(lqrandom\(rq is usually not good enough,
-because
-the common ways of choosing random numbers, such as using the
-current time, are very easy to guess.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-key_setsecret(key)
-char *key;
-.fi
-.ft R
-.IP
-.B key_setsecret(\|)
-is a keyserver interface routine. It is used to set the key for
-the effective
-.I uid
-of the calling process.
-.br
-.if t .ne 7
-.LP
-.ft B
-.nf
-.sp .5
-getnetname(name)
-char name[\s-1MAXNETNAMELEN\s0];
-.fi
-.ft R
-.IP
-.B getnetname(\|)
-installs the unique, operating-system independent netname of
-the
-caller in the fixed-length array
-.IR name .
-Returns
-.SM TRUE
-if it succeeds and
-.SM FALSE
-if it fails.
-.br
-.if t .ne 6
-.LP
-.ft B
-.nf
-.sp .5
-netname2host(name, host, hostlen)
-char *name;
-char *host;
-int hostlen;
-.fi
-.ft R
-.IP
-Convert from an operating-system independent netname to a
-domain-specific hostname. Returns
-.SM TRUE
-if it succeeds and
-.SM FALSE
-if it fails. Inverse of
-.BR host2netname(\|) .
-.br
-.if t .ne 9
-.LP
-.ft B
-.nf
-.sp .5
-netname2user(name, uidp, gidp, gidlenp, gidlist)
-char *name;
-int *uidp;
-int *gidp;
-int *gidlenp;
-int *gidlist;
-.fi
-.ft R
-.IP
-Convert from an operating-system independent netname to a
-domain-specific user
-.SM ID.
-Returns
-.SM TRUE
-if it succeeds and
-.SM FALSE
-if it fails. Inverse of
-.BR user2netname(\|) .
-.br
-.if t .ne 8
-.LP
-.ft B
-.nf
-.sp .5
-user2netname(name, uid, domain)
-char *name;
-int uid;
-char *domain;
-.fi
-.ft R
-.IP
-Convert from a domain-specific username to an operating-system
-independent netname. Returns
-.SM TRUE
-if it succeeds and
-.SM FALSE
-if it fails. Inverse of
-.BR netname2user(\|) .
-.br
-.SH SEE ALSO
-.BR xdr (3N),
-.BR keyserv (8C),
-.BR rpc (3N)
-.br
-The following manuals:
-.RS
-.ft I
-Remote Procedure Calls: Protocol Specification
-.br
-Remote Procedure Call Programming Guide
-.br
-rpcgen Programming Guide
-.br
-.ft R
-.RE
-.IR "\s-1RPC\s0: Remote Procedure Call Protocol Specification" ,
-.SM RFC1050, Sun Microsystems, Inc.,
-.SM USC-ISI\s0.
-
diff --git a/lib/librpc/secure_rpc/man/rtime.3n b/lib/librpc/secure_rpc/man/rtime.3n
deleted file mode 100644
index af0c1ca..0000000
--- a/lib/librpc/secure_rpc/man/rtime.3n
+++ /dev/null
@@ -1,43 +0,0 @@
-.\" @(#)rtime.3n 2.1 88/08/08 4.0 RPCSRC; from 1.5 88/02/08 SMI
-.TH RTIME 3 "22 November 1987"
-.SH NAME
-rtime \- get remote time
-.SH SYNOPSIS
-.nf
-.B #include <sys/types.h>
-.B #include <sys/time.h>
-.B #include <netinet/in.h>
-.LP
-.B int rtime(addrp, timep, timeout)
-.B struct sockaddr_in \(**addrp;
-.B struct timeval \(**timep;
-.B struct timeval \(**timeout;
-.fi
-.SH DESCRIPTION
-.B rtime(\|)
-consults the Internet Time Server at the address pointed to by
-.I addrp
-and returns the remote time in the
-.B timeval
-struct pointed to by
-.IR timep .
-Normally, the
-.SM UDP
-protocol is used when consulting the Time Server. The
-.I timeout
-parameter specifies how long the
-routine should wait before giving
-up when waiting for a reply. If
-.I timeout
-is specified as
-.SM NULL\s0,
-however, the routine will instead use
-.SM TCP
-and block until a reply is received from the time server.
-.LP
-The routine returns 0 if it is successful. Otherwise,
-it returns \-1 and
-.B errno
-is set to reflect the cause of the error.
-.SH "SEE ALSO"
-.BR timed (8c)
diff --git a/lib/librpc/secure_rpc/rpc/Makefile b/lib/librpc/secure_rpc/rpc/Makefile
deleted file mode 100644
index 88b242f..0000000
--- a/lib/librpc/secure_rpc/rpc/Makefile
+++ /dev/null
@@ -1,109 +0,0 @@
-#
-# @(#)Makefile 2.3 88/08/15 4.0 RPCSRC
-#
-#
-# Copyright (c) 1987 by Sun Microsystems, Inc.
-#
-
-DESTDIR=
-
-CFLAGS = -I..
-
-SRCS = auth_des.c authdes_prot.c key_call.c key_prot.c netname.c svcauth_des.c \
- openchild.c rtime.c publickey.c xcrypt.c \
- auth_none.c auth_unix.c authunix_prot.c bindresvport.c \
- clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c clnt_tcp.c \
- clnt_udp.c rpc_dtablesize.c get_myaddress.c getrpcent.c getrpcport.c \
- pmap_clnt.c pmap_getmaps.c pmap_getport.c pmap_prot.c \
- pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c rpc_callmsg.c \
- svc.c svc_auth.c svc_auth_unix.c svc_raw.c svc_run.c svc_simple.c \
- svc_tcp.c svc_udp.c xdr.c xdr_array.c xdr_float.c xdr_mem.c \
- xdr_rec.c xdr_reference.c xdr_stdio.c
-
-OBJS = auth_des.o authdes_prot.o key_call.o key_prot.o netname.o svcauth_des.o \
- openchild.o rtime.o publickey.o xcrypt.o \
- auth_none.o auth_unix.o authunix_prot.o bindresvport.o \
- clnt_generic.o clnt_perror.o clnt_raw.o clnt_simple.o clnt_tcp.o \
- clnt_udp.o rpc_dtablesize.o get_myaddress.o getrpcent.o getrpcport.o \
- pmap_clnt.o pmap_getmaps.o pmap_getport.o pmap_prot.o \
- pmap_prot2.o pmap_rmt.o rpc_prot.o rpc_commondata.o rpc_callmsg.o \
- svc.o svc_auth.o svc_auth_unix.o svc_raw.o svc_run.o svc_simple.o \
- svc_tcp.o svc_udp.o xdr.o xdr_array.o xdr_float.o xdr_mem.o \
- xdr_rec.o xdr_reference.o xdr_stdio.o
-
-HDRS = key_prot.h \
- auth.h auth_unix.h auth_des.h clnt.h netdb.h pmap_clnt.h \
- pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h svc.h svc_auth.h types.h xdr.h
-
-XFILES= key_prot.x
-
-all rpclib: librpclib.a
-
-librpclib.a: ${OBJS}
- @echo "building librpclib.a"
- @ar cru librpclib.a ${OBJS}
-
-install: $(HDRS) librpclib.a
- @echo "Creating RPC header directory"
- -mkdir ${DESTDIR}/usr/include/rpc && \
- chown bin ${DESTDIR}/usr/include/rpc && \
- chmod 755 ${DESTDIR}/usr/include/rpc
- @echo "Installing RPC header files"
- -set -x;for i in $(HDRS) $(XFILES) ; do \
- (install -c -m 644 $$i ${DESTDIR}/usr/include/rpc) done
- @echo "Installing RPC library"
- install -c -m 644 librpclib.a ${DESTDIR}/usr/lib
- ranlib ${DESTDIR}/usr/lib/librpclib.a
-
-tags: $(SRCS) $(HDRS)
- ctags -tw $(SRCS) $(HDRS)
-
-ref: tags
- sed 's, /.*,,' tags | \
- awk ' { printf("%-26s%-16s%s\n", $$1, $$2, $$3) }' > ref
-
-lint: $(SRCS) $(HDRS)
- $(LINT.c) $(SRCS)
-
-clean: rm -f *.o rpclib.a
-
-.SUFFIXES: .x .x~
-
-.x.c:
- rpcgen -c $< | \
- sed 's/^#include \"$*\.h\"/#include <rpc\/$*\.h>/' > $@
-
-.x.h:
- rpcgen -h $< > $@
-
-depend: $(SRCS) $(HDRS)
- @${CC} ${CFLAGS} -M ${SRCS} > makedep
- @echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
- @echo '$$r makedep' >>eddep
- @echo 'w' >>eddep
- @cp Makefile makefile.bak
- @ed - Makefile < eddep
- @rm eddep makedep makefile.bak
-
-depend.42BSD depend.42bsd:
- cp /dev/null x.c
- for i in $(SRCS) ; do \
- (/bin/grep '^#[ ]*include' x.c $$i | sed \
- -e '/\.\.\/h/d' \
- -e '/\.\.\/ufs/d' \
- -e 's,<\(.*\)>,"/usr/include/\1",' \
- -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
- -e 's/\.c/\.o/' >>makedep); done
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep x.c
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile
-
-# DO NOT DELETE THIS LINE
-
-
diff --git a/lib/librpc/secure_rpc/rpc/auth_des.c b/lib/librpc/secure_rpc/rpc/auth_des.c
deleted file mode 100644
index a757c49..0000000
--- a/lib/librpc/secure_rpc/rpc/auth_des.c
+++ /dev/null
@@ -1,411 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)auth_des.c 2.2 88/07/29 4.0 RPCSRC; from 1.9 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-/*
- * auth_des.c, client-side implementation of DES authentication
- */
-
-#include <des_crypt.h>
-#include <rpc/types.h>
-#include <rpc/auth.h>
-#include <rpc/auth_des.h>
-#include <rpc/xdr.h>
-#include <netinet/in.h> /* XXX: just to get htonl() and ntohl() */
-#include <sys/socket.h>
-
-#define MILLION 1000000L
-#define RTIME_TIMEOUT 5 /* seconds to wait for sync */
-
-#define AUTH_PRIVATE(auth) (struct ad_private *) auth->ah_private
-#define ALLOC(object_type) (object_type *) mem_alloc(sizeof(object_type))
-#define FREE(ptr, size) mem_free((char *)(ptr), (int) size)
-#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
-
-#define debug(msg) /*printf("%s\n", msg) */
-
-/*
- * DES authenticator operations vector
- */
-static void authdes_nextverf();
-static bool_t authdes_marshal();
-static bool_t authdes_validate();
-static bool_t authdes_refresh();
-static void authdes_destroy();
-static struct auth_ops authdes_ops = {
- authdes_nextverf,
- authdes_marshal,
- authdes_validate,
- authdes_refresh,
- authdes_destroy
-};
-
-
-/*
- * This struct is pointed to by the ah_private field of an "AUTH *"
- */
-struct ad_private {
- char *ad_fullname; /* client's full name */
- u_int ad_fullnamelen; /* length of name, rounded up */
- char *ad_servername; /* server's full name */
- u_int ad_servernamelen; /* length of name, rounded up */
- u_int ad_window; /* client specified window */
- bool_t ad_dosync; /* synchronize? */
- struct sockaddr ad_syncaddr; /* remote host to synch with */
- struct timeval ad_timediff; /* server's time - client's time */
- u_long ad_nickname; /* server's nickname for client */
- struct authdes_cred ad_cred; /* storage for credential */
- struct authdes_verf ad_verf; /* storage for verifier */
- struct timeval ad_timestamp; /* timestamp sent */
- des_block ad_xkey; /* encrypted conversation key */
-};
-
-
-/*
- * Create the client des authentication object
- */
-AUTH *
-authdes_create(servername, window, syncaddr, ckey)
- char *servername; /* network name of server */
- u_int window; /* time to live */
- struct sockaddr *syncaddr; /* optional addr of host to sync with */
- des_block *ckey; /* optional conversation key to use*/
-{
-
- AUTH *auth;
- struct ad_private *ad;
- char namebuf[MAXNETNAMELEN+1];
-
- /*
- * Allocate everything now
- */
- auth = ALLOC(AUTH);
- ad = ALLOC(struct ad_private);
- (void) getnetname(namebuf);
-
- ad->ad_fullnamelen = RNDUP(strlen(namebuf));
- ad->ad_fullname = mem_alloc(ad->ad_fullnamelen + 1);
-
- ad->ad_servernamelen = strlen(servername);
- ad->ad_servername = mem_alloc(ad->ad_servernamelen + 1);
-
- if (auth == NULL || ad == NULL || ad->ad_fullname == NULL ||
- ad->ad_servername == NULL) {
- debug("authdes_create: out of memory");
- goto failed;
- }
-
- /*
- * Set up private data
- */
- bcopy(namebuf, ad->ad_fullname, ad->ad_fullnamelen + 1);
- bcopy(servername, ad->ad_servername, ad->ad_servernamelen + 1);
- if (syncaddr != NULL) {
- ad->ad_syncaddr = *syncaddr;
- ad->ad_dosync = TRUE;
- } else {
- ad->ad_dosync = FALSE;
- }
- ad->ad_window = window;
- if (ckey == NULL) {
- if (key_gendes(&auth->ah_key) < 0) {
- debug("authdes_create: unable to gen conversation key");
- return (NULL);
- }
- } else {
- auth->ah_key = *ckey;
- }
-
- /*
- * Set up auth handle
- */
- auth->ah_cred.oa_flavor = AUTH_DES;
- auth->ah_verf.oa_flavor = AUTH_DES;
- auth->ah_ops = &authdes_ops;
- auth->ah_private = (caddr_t)ad;
-
- if (!authdes_refresh(auth)) {
- goto failed;
- }
- return (auth);
-
-failed:
- if (auth != NULL)
- FREE(auth, sizeof(AUTH));
- if (ad != NULL)
- FREE(ad, sizeof(struct ad_private));
- if (ad->ad_fullname != NULL)
- FREE(ad->ad_fullname, ad->ad_fullnamelen + 1);
- if (ad->ad_servername != NULL)
- FREE(ad->ad_servername, ad->ad_servernamelen + 1);
- return (NULL);
-}
-
-/*
- * Implement the five authentication operations
- */
-
-
-/*
- * 1. Next Verifier
- */
-/*ARGSUSED*/
-static void
-authdes_nextverf(auth)
- AUTH *auth;
-{
- /* what the heck am I supposed to do??? */
-}
-
-
-
-/*
- * 2. Marshal
- */
-static bool_t
-authdes_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
-{
- struct ad_private *ad = AUTH_PRIVATE(auth);
- struct authdes_cred *cred = &ad->ad_cred;
- struct authdes_verf *verf = &ad->ad_verf;
- des_block cryptbuf[2];
- des_block ivec;
- int status;
- int len;
- register long *ixdr;
-
- /*
- * Figure out the "time", accounting for any time difference
- * with the server if necessary.
- */
- (void) gettimeofday(&ad->ad_timestamp, (struct timezone *)NULL);
- ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
- ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
- if (ad->ad_timestamp.tv_usec >= MILLION) {
- ad->ad_timestamp.tv_usec -= MILLION;
- ad->ad_timestamp.tv_sec += 1;
- }
-
- /*
- * XDR the timestamp and possibly some other things, then
- * encrypt them.
- */
- ixdr = (long *)cryptbuf;
- IXDR_PUT_LONG(ixdr, ad->ad_timestamp.tv_sec);
- IXDR_PUT_LONG(ixdr, ad->ad_timestamp.tv_usec);
- if (ad->ad_cred.adc_namekind == ADN_FULLNAME) {
- IXDR_PUT_U_LONG(ixdr, ad->ad_window);
- IXDR_PUT_U_LONG(ixdr, ad->ad_window - 1);
- ivec.key.high = ivec.key.low = 0;
- status = cbc_crypt((char *)&auth->ah_key, (char *)cryptbuf,
- 2*sizeof(des_block), DES_ENCRYPT | DES_HW, (char *)&ivec);
- } else {
- status = ecb_crypt((char *)&auth->ah_key, (char *)cryptbuf,
- sizeof(des_block), DES_ENCRYPT | DES_HW);
- }
- if (DES_FAILED(status)) {
- debug("authdes_marshal: DES encryption failure");
- return (FALSE);
- }
- ad->ad_verf.adv_xtimestamp = cryptbuf[0];
- if (ad->ad_cred.adc_namekind == ADN_FULLNAME) {
- ad->ad_cred.adc_fullname.window = cryptbuf[1].key.high;
- ad->ad_verf.adv_winverf = cryptbuf[1].key.low;
- } else {
- ad->ad_cred.adc_nickname = ad->ad_nickname;
- ad->ad_verf.adv_winverf = 0;
- }
-
- /*
- * Serialize the credential and verifier into opaque
- * authentication data.
- */
- if (ad->ad_cred.adc_namekind == ADN_FULLNAME) {
- len = ((1 + 1 + 2 + 1)*BYTES_PER_XDR_UNIT + ad->ad_fullnamelen);
- } else {
- len = (1 + 1)*BYTES_PER_XDR_UNIT;
- }
-
- if (ixdr = xdr_inline(xdrs, 2*BYTES_PER_XDR_UNIT)) {
- IXDR_PUT_LONG(ixdr, AUTH_DES);
- IXDR_PUT_LONG(ixdr, len);
- } else {
- ATTEMPT(xdr_putlong(xdrs, &auth->ah_cred.oa_flavor));
- ATTEMPT(xdr_putlong(xdrs, &len));
- }
- ATTEMPT(xdr_authdes_cred(xdrs, cred));
-
- len = (2 + 1)*BYTES_PER_XDR_UNIT;
- if (ixdr = xdr_inline(xdrs, 2*BYTES_PER_XDR_UNIT)) {
- IXDR_PUT_LONG(ixdr, AUTH_DES);
- IXDR_PUT_LONG(ixdr, len);
- } else {
- ATTEMPT(xdr_putlong(xdrs, &auth->ah_verf.oa_flavor));
- ATTEMPT(xdr_putlong(xdrs, &len));
- }
- ATTEMPT(xdr_authdes_verf(xdrs, verf));
- return (TRUE);
-}
-
-
-/*
- * 3. Validate
- */
-static bool_t
-authdes_validate(auth, rverf)
- AUTH *auth;
- struct opaque_auth *rverf;
-{
- struct ad_private *ad = AUTH_PRIVATE(auth);
- struct authdes_verf verf;
- int status;
- register u_long *ixdr;
-
- if (rverf->oa_length != (2 + 1) * BYTES_PER_XDR_UNIT) {
- return (FALSE);
- }
- ixdr = (u_long *)rverf->oa_base;
- verf.adv_xtimestamp.key.high = (u_long)*ixdr++;
- verf.adv_xtimestamp.key.low = (u_long)*ixdr++;
- verf.adv_int_u = (u_long)*ixdr++; /* nickname not XDR'd ! */
-
- /*
- * Decrypt the timestamp
- */
- status = ecb_crypt((char *)&auth->ah_key, (char *)&verf.adv_xtimestamp,
- sizeof(des_block), DES_DECRYPT | DES_HW);
-
- if (DES_FAILED(status)) {
- debug("authdes_validate: DES decryption failure");
- return (FALSE);
- }
-
- /*
- * xdr the decrypted timestamp
- */
- ixdr = (u_long *)verf.adv_xtimestamp.c;
- verf.adv_timestamp.tv_sec = IXDR_GET_LONG(ixdr) + 1;
- verf.adv_timestamp.tv_usec = IXDR_GET_LONG(ixdr);
-
- /*
- * validate
- */
- if (bcmp((char *)&ad->ad_timestamp, (char *)&verf.adv_timestamp,
- sizeof(struct timeval)) != 0) {
- debug("authdes_validate: verifier mismatch\n");
- return (FALSE);
- }
-
- /*
- * We have a nickname now, let's use it
- */
- ad->ad_nickname = verf.adv_nickname;
- ad->ad_cred.adc_namekind = ADN_NICKNAME;
- return (TRUE);
-}
-
-/*
- * 4. Refresh
- */
-static bool_t
-authdes_refresh(auth)
- AUTH *auth;
-{
- struct ad_private *ad = AUTH_PRIVATE(auth);
- struct authdes_cred *cred = &ad->ad_cred;
-
- if (ad->ad_dosync &&
- !synchronize(&ad->ad_syncaddr, &ad->ad_timediff)) {
- /*
- * Hope the clocks are synced!
- */
- ad->ad_timediff.tv_sec = ad->ad_timediff.tv_usec = 0;
- debug("authdes_refresh: unable to synchronize with server");
- }
- ad->ad_xkey = auth->ah_key;
- if (key_encryptsession(ad->ad_servername, &ad->ad_xkey) < 0) {
- debug("authdes_create: unable to encrypt conversation key");
- return (FALSE);
- }
- cred->adc_fullname.key = ad->ad_xkey;
- cred->adc_namekind = ADN_FULLNAME;
- cred->adc_fullname.name = ad->ad_fullname;
- return (TRUE);
-}
-
-
-/*
- * 5. Destroy
- */
-static void
-authdes_destroy(auth)
- AUTH *auth;
-{
- struct ad_private *ad = AUTH_PRIVATE(auth);
-
- FREE(ad->ad_fullname, ad->ad_fullnamelen + 1);
- FREE(ad->ad_servername, ad->ad_servernamelen + 1);
- FREE(ad, sizeof(struct ad_private));
- FREE(auth, sizeof(AUTH));
-}
-
-
-
-/*
- * Synchronize with the server at the given address, that is,
- * adjust timep to reflect the delta between our clocks
- */
-static bool_t
-synchronize(syncaddr, timep)
- struct sockaddr *syncaddr;
- struct timeval *timep;
-{
- struct timeval mytime;
- struct timeval timeout;
-
- timeout.tv_sec = RTIME_TIMEOUT;
- timeout.tv_usec = 0;
- if (rtime((struct sockaddr_in *)syncaddr, timep, &timeout) < 0) {
- return (FALSE);
- }
- (void) gettimeofday(&mytime, (struct timezone *)NULL);
- timep->tv_sec -= mytime.tv_sec;
- if (mytime.tv_usec > timep->tv_usec) {
- timep->tv_sec -= 1;
- timep->tv_usec += MILLION;
- }
- timep->tv_usec -= mytime.tv_usec;
- return (TRUE);
-}
diff --git a/lib/librpc/secure_rpc/rpc/auth_des.h b/lib/librpc/secure_rpc/rpc/auth_des.h
deleted file mode 100644
index 4ae4761..0000000
--- a/lib/librpc/secure_rpc/rpc/auth_des.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * auth_des.h, Protocol for DES style authentication for RPC
- */
-
-#ifndef _AUTH_DES_
-#define _AUTH_DES_
-
-/*
- * There are two kinds of "names": fullnames and nicknames
- */
-enum authdes_namekind {
- ADN_FULLNAME,
- ADN_NICKNAME
-};
-
-/*
- * A fullname contains the network name of the client,
- * a conversation key and the window
- */
-struct authdes_fullname {
- char *name; /* network name of client, up to MAXNETNAMELEN */
- des_block key; /* conversation key */
- u_long window; /* associated window */
-};
-
-
-/*
- * A credential
- */
-struct authdes_cred {
- enum authdes_namekind adc_namekind;
- struct authdes_fullname adc_fullname;
- u_long adc_nickname;
-};
-
-
-
-/*
- * A des authentication verifier
- */
-struct authdes_verf {
- union {
- struct timeval adv_ctime; /* clear time */
- des_block adv_xtime; /* crypt time */
- } adv_time_u;
- u_long adv_int_u;
-};
-
-/*
- * des authentication verifier: client variety
- *
- * adv_timestamp is the current time.
- * adv_winverf is the credential window + 1.
- * Both are encrypted using the conversation key.
- */
-#define adv_timestamp adv_time_u.adv_ctime
-#define adv_xtimestamp adv_time_u.adv_xtime
-#define adv_winverf adv_int_u
-
-/*
- * des authentication verifier: server variety
- *
- * adv_timeverf is the client's timestamp + client's window
- * adv_nickname is the server's nickname for the client.
- * adv_timeverf is encrypted using the conversation key.
- */
-#define adv_timeverf adv_time_u.adv_ctime
-#define adv_xtimeverf adv_time_u.adv_xtime
-#define adv_nickname adv_int_u
-
-#endif /* ndef _AUTH_DES_ */
diff --git a/lib/librpc/secure_rpc/rpc/authdes_prot.c b/lib/librpc/secure_rpc/rpc/authdes_prot.c
deleted file mode 100644
index 14679c0..0000000
--- a/lib/librpc/secure_rpc/rpc/authdes_prot.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)authdes_prot.c 2.1 88/07/29 4.0 RPCSRC; from 1.6 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * authdes_prot.c, XDR routines for DES authentication
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#include <rpc/auth_des.h>
-
-#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
-
-bool_t
-xdr_authdes_cred(xdrs, cred)
- XDR *xdrs;
- struct authdes_cred *cred;
-{
- /*
- * Unrolled xdr
- */
- ATTEMPT(xdr_enum(xdrs, (enum_t *)&cred->adc_namekind));
- switch (cred->adc_namekind) {
- case ADN_FULLNAME:
- ATTEMPT(xdr_string(xdrs, &cred->adc_fullname.name, MAXNETNAMELEN));
- ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.key, sizeof(des_block)));
- ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.window, sizeof(cred->adc_fullname.window)));
- return (TRUE);
- case ADN_NICKNAME:
- ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_nickname, sizeof(cred->adc_nickname)));
- return (TRUE);
- default:
- return (FALSE);
- }
-}
-
-
-bool_t
-xdr_authdes_verf(xdrs, verf)
- register XDR *xdrs;
- register struct authdes_verf *verf;
-{
- /*
- * Unrolled xdr
- */
- ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_xtimestamp, sizeof(des_block)));
- ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_int_u, sizeof(verf->adv_int_u)));
- return (TRUE);
-}
diff --git a/lib/librpc/secure_rpc/rpc/key_call.c b/lib/librpc/secure_rpc/rpc/key_call.c
deleted file mode 100644
index c2fd335..0000000
--- a/lib/librpc/secure_rpc/rpc/key_call.c
+++ /dev/null
@@ -1,228 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)key_call.c 2.2 88/08/15 4.0 RPCSRC; from 1.11 88/02/08 SMI";
-#endif
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * key_call.c, Interface to keyserver
- *
- * setsecretkey(key) - set your secret key
- * encryptsessionkey(agent, deskey) - encrypt a session key to talk to agent
- * decryptsessionkey(agent, deskey) - decrypt ditto
- * gendeskey(deskey) - generate a secure des key
- * netname2user(...) - get unix credential for given name (kernel only)
- */
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-
-#define KEY_TIMEOUT 5 /* per-try timeout in seconds */
-#define KEY_NRETRY 12 /* number of retries */
-
-#define debug(msg) /* turn off debugging */
-
-static struct timeval trytimeout = { KEY_TIMEOUT, 0 };
-static struct timeval tottimeout = { KEY_TIMEOUT * KEY_NRETRY, 0 };
-
-key_setsecret(secretkey)
- char *secretkey;
-{
- keystatus status;
-
- if (!key_call((u_long)KEY_SET, xdr_keybuf, secretkey, xdr_keystatus,
- (char*)&status))
- {
- return (-1);
- }
- if (status != KEY_SUCCESS) {
- debug("set status is nonzero");
- return (-1);
- }
- return (0);
-}
-
-
-key_encryptsession(remotename, deskey)
- char *remotename;
- des_block *deskey;
-{
- cryptkeyarg arg;
- cryptkeyres res;
-
- arg.remotename = remotename;
- arg.deskey = *deskey;
- if (!key_call((u_long)KEY_ENCRYPT,
- xdr_cryptkeyarg, (char *)&arg, xdr_cryptkeyres, (char *)&res))
- {
- return (-1);
- }
- if (res.status != KEY_SUCCESS) {
- debug("encrypt status is nonzero");
- return (-1);
- }
- *deskey = res.cryptkeyres_u.deskey;
- return (0);
-}
-
-
-key_decryptsession(remotename, deskey)
- char *remotename;
- des_block *deskey;
-{
- cryptkeyarg arg;
- cryptkeyres res;
-
- arg.remotename = remotename;
- arg.deskey = *deskey;
- if (!key_call((u_long)KEY_DECRYPT,
- xdr_cryptkeyarg, (char *)&arg, xdr_cryptkeyres, (char *)&res))
- {
- return (-1);
- }
- if (res.status != KEY_SUCCESS) {
- debug("decrypt status is nonzero");
- return (-1);
- }
- *deskey = res.cryptkeyres_u.deskey;
- return (0);
-}
-
-key_gendes(key)
- des_block *key;
-{
- struct sockaddr_in sin;
- CLIENT *client;
- int socket;
- enum clnt_stat stat;
-
-
- sin.sin_family = AF_INET;
- sin.sin_port = 0;
- sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- bzero(sin.sin_zero, sizeof(sin.sin_zero));
- socket = RPC_ANYSOCK;
- client = clntudp_bufcreate(&sin, (u_long)KEY_PROG, (u_long)KEY_VERS,
- trytimeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
- if (client == NULL) {
- return (-1);
- }
- stat = clnt_call(client, KEY_GEN, xdr_void, NULL,
- xdr_des_block, key, tottimeout);
- clnt_destroy(client);
- (void) close(socket);
- if (stat != RPC_SUCCESS) {
- return (-1);
- }
- return (0);
-}
-
-
-#include <stdio.h>
-#include <sys/wait.h>
-
-
-static
-key_call(proc, xdr_arg, arg, xdr_rslt, rslt)
- u_long proc;
- bool_t (*xdr_arg)();
- char *arg;
- bool_t (*xdr_rslt)();
- char *rslt;
-{
- XDR xdrargs;
- XDR xdrrslt;
- FILE *fargs;
- FILE *frslt;
- int (*osigchild)();
- union wait status;
- int pid;
- int success;
- int ruid;
- int euid;
- static char MESSENGER[] = "/usr/etc/keyenvoy";
-
- success = 1;
- osigchild = signal(SIGCHLD, SIG_IGN);
-
- /*
- * We are going to exec a set-uid program which makes our effective uid
- * zero, and authenticates us with our real uid. We need to make the
- * effective uid be the real uid for the setuid program, and
- * the real uid be the effective uid so that we can change things back.
- */
- euid = geteuid();
- ruid = getuid();
- (void) setreuid(euid, ruid);
- pid = _openchild(MESSENGER, &fargs, &frslt);
- (void) setreuid(ruid, euid);
- if (pid < 0) {
- debug("open_streams");
- return (0);
- }
- xdrstdio_create(&xdrargs, fargs, XDR_ENCODE);
- xdrstdio_create(&xdrrslt, frslt, XDR_DECODE);
-
- if (!xdr_u_long(&xdrargs, &proc) || !(*xdr_arg)(&xdrargs, arg)) {
- debug("xdr args");
- success = 0;
- }
- (void) fclose(fargs);
-
- if (success && !(*xdr_rslt)(&xdrrslt, rslt)) {
- debug("xdr rslt");
- success = 0;
- }
-
-#ifdef NOTDEF
- /*
- * WARNING! XXX
- * The original code appears first. wait4 returns only after the process
- * with the requested pid terminates. The effect of using wait() instead
- * has not been determined.
- */
- (void) fclose(frslt);
- if (wait4(pid, &status, 0, NULL) < 0 || status.w_retcode != 0) {
- debug("wait4");
- success = 0;
- }
-#endif /* def NOTDEF */
- if (wait(&status) < 0 || status.w_retcode != 0) {
- debug("wait");
- success = 0;
- }
- (void)signal(SIGCHLD, osigchild);
-
- return (success);
-}
-
diff --git a/lib/librpc/secure_rpc/rpc/key_prot.c b/lib/librpc/secure_rpc/rpc/key_prot.c
deleted file mode 100644
index a93f543..0000000
--- a/lib/librpc/secure_rpc/rpc/key_prot.c
+++ /dev/null
@@ -1,165 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)key_prot.c 2.1 88/08/07 4.0 RPCSRC; from 1.4 88/02/08 SMI";
-#endif
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-
-
-/*
- * Compiled from key_prot.x using rpcgen.
- * DO NOT EDIT THIS FILE!
- * This is NOT source code!
- */
-
-
-bool_t
-xdr_keystatus(xdrs, objp)
- XDR *xdrs;
- keystatus *objp;
-{
- if (!xdr_enum(xdrs, (enum_t *)objp)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_keybuf(xdrs, objp)
- XDR *xdrs;
- keybuf objp;
-{
- if (!xdr_opaque(xdrs, objp, HEXKEYBYTES)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_netnamestr(xdrs, objp)
- XDR *xdrs;
- netnamestr *objp;
-{
- if (!xdr_string(xdrs, objp, MAXNETNAMELEN)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_cryptkeyarg(xdrs, objp)
- XDR *xdrs;
- cryptkeyarg *objp;
-{
- if (!xdr_netnamestr(xdrs, &objp->remotename)) {
- return (FALSE);
- }
- if (!xdr_des_block(xdrs, &objp->deskey)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_cryptkeyres(xdrs, objp)
- XDR *xdrs;
- cryptkeyres *objp;
-{
- if (!xdr_keystatus(xdrs, &objp->status)) {
- return (FALSE);
- }
- switch (objp->status) {
- case KEY_SUCCESS:
- if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey)) {
- return (FALSE);
- }
- break;
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_unixcred(xdrs, objp)
- XDR *xdrs;
- unixcred *objp;
-{
- if (!xdr_int(xdrs, &objp->uid)) {
- return (FALSE);
- }
- if (!xdr_int(xdrs, &objp->gid)) {
- return (FALSE);
- }
- if (!xdr_array(xdrs, (char **)&objp->gids.gids_val, (u_int *)&objp->gids.gids_len, MAXGIDS, sizeof(int), xdr_int)) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-
-
-bool_t
-xdr_getcredres(xdrs, objp)
- XDR *xdrs;
- getcredres *objp;
-{
- if (!xdr_keystatus(xdrs, &objp->status)) {
- return (FALSE);
- }
- switch (objp->status) {
- case KEY_SUCCESS:
- if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred)) {
- return (FALSE);
- }
- break;
- }
- return (TRUE);
-}
-
-
diff --git a/lib/librpc/secure_rpc/rpc/key_prot.h b/lib/librpc/secure_rpc/rpc/key_prot.h
deleted file mode 100644
index 277e4b8..0000000
--- a/lib/librpc/secure_rpc/rpc/key_prot.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* @(#)key_prot.h 2.1 88/08/07 4.0 RPCSRC; from 1.4 87/03/10 Copyr 1986 Sun Micro */
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-
-/*
- * Compiled from key_prot.x using rpcgen.
- * DO NOT EDIT THIS FILE!
- * This is NOT source code!
- */
-
-#define KEY_PROG 100029
-#define KEY_VERS 1
-#define KEY_SET 1
-#define KEY_ENCRYPT 2
-#define KEY_DECRYPT 3
-#define KEY_GEN 4
-#define KEY_GETCRED 5
-
-#define PROOT 3
-#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
-#define HEXKEYBYTES 48
-#define KEYSIZE 192
-#define KEYBYTES 24
-#define KEYCHECKSUMSIZE 16
-
-enum keystatus {
- KEY_SUCCESS = 0,
- KEY_NOSECRET = 1,
- KEY_UNKNOWN = 2,
- KEY_SYSTEMERR = 3,
-};
-typedef enum keystatus keystatus;
-bool_t xdr_keystatus();
-
-
-typedef char keybuf[HEXKEYBYTES];
-bool_t xdr_keybuf();
-
-
-typedef char *netnamestr;
-bool_t xdr_netnamestr();
-
-
-struct cryptkeyarg {
- netnamestr remotename;
- des_block deskey;
-};
-typedef struct cryptkeyarg cryptkeyarg;
-bool_t xdr_cryptkeyarg();
-
-
-struct cryptkeyres {
- keystatus status;
- union {
- des_block deskey;
- } cryptkeyres_u;
-};
-typedef struct cryptkeyres cryptkeyres;
-bool_t xdr_cryptkeyres();
-
-#define MAXGIDS 16
-
-struct unixcred {
- int uid;
- int gid;
- struct {
- u_int gids_len;
- int *gids_val;
- } gids;
-};
-typedef struct unixcred unixcred;
-bool_t xdr_unixcred();
-
-
-struct getcredres {
- keystatus status;
- union {
- unixcred cred;
- } getcredres_u;
-};
-typedef struct getcredres getcredres;
-bool_t xdr_getcredres();
-
diff --git a/lib/librpc/secure_rpc/rpc/key_prot.x b/lib/librpc/secure_rpc/rpc/key_prot.x
deleted file mode 100644
index 2f6ebdb..0000000
--- a/lib/librpc/secure_rpc/rpc/key_prot.x
+++ /dev/null
@@ -1,151 +0,0 @@
-%/* @(#)key_prot.x 2.1 88/08/07 4.0 RPCSRC; from 1.7 88/02/08 SMI */
-%
-%/*
-% * Copyright (c) 1988 by Sun Microsystems, Inc.
-% */
-%
-%/*
-% * Compiled from key_prot.x using rpcgen.
-% * DO NOT EDIT THIS FILE!
-% * This is NOT source code!
-% */
-
-/*
- * Key server protocol definition
- * Copyright (C) 1987 Sun Microsystems, Inc.
- *
- * The keyserver is a public key storage/encryption/decryption service
- * The encryption method used is Diffie-Hellman with 128 bit keys.
- *
- * The key server is local to each machine, akin to the portmapper.
- * Only privileged processes may talk to the key server, so
- * user processes must communicate through a privileged dispatcher (such
- * as the kernel or a set-uid-root process).
- */
-program KEY_PROG {
- version KEY_VERS {
- /*
- * This is my secret key.
- * Store it for me.
- */
- int
- KEY_SET(keybuf) = 1;
-
- /*
- * I want to talk to X.
- * Encrypt a conversation key for me.
- */
- cryptkeyres
- KEY_ENCRYPT(cryptkeyarg) = 2;
-
- /*
- * X just sent me a message.
- * Decrypt the conversation key for me.
- */
- cryptkeyres
- KEY_DECRYPT(cryptkeyarg) = 3;
-
- /*
- * Generate a secure conversation key for me
- */
- des_block
- KEY_GEN(void) = 4;
-
- /*
- * Get me the uid, gid and group-access-list associated
- * with this netname (for kernel which cannot use yp)
- */
- getcredres
- KEY_GETCRED(netnamestr) = 5;
- } = 1;
-} = 100029;
-
-
-/*
- * PROOT and MODULUS define the way the Diffie-Hellman key is generated.
- *
- * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1,
- * where p is also prime.
- *
- * PROOT satisfies the following two conditions:
- * (1) (PROOT ** 2) % MODULUS != 1
- * (2) (PROOT ** p) % MODULUS != 1
- *
- */
-
-const PROOT = 3;
-const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b";
-
-const HEXKEYBYTES = 48; /* HEXKEYBYTES == strlen(HEXMODULUS) */
-const KEYSIZE = 192; /* KEYSIZE == bit length of key */
-const KEYBYTES = 24; /* byte length of key */
-
-/*
- * The first 16 hex digits of the encrypted secret key are used as
- * a checksum in the database.
- */
-const KEYCHECKSUMSIZE = 16;
-
-/*
- * status of operation
- */
-enum keystatus {
- KEY_SUCCESS, /* no problems */
- KEY_NOSECRET, /* no secret key stored */
- KEY_UNKNOWN, /* unknown netname */
- KEY_SYSTEMERR /* system error (out of memory, encryption failure) */
-};
-
-/*
- * The kernel doesn't use keybuf, so we insure that it
- * is ifdef'd out in the output files. The proper way to do
- * this is to #ifndef KERNEL it here, and have the kernel build
- * use rpcgen, but config doesn't understand rpcgen files so
- * it is done this way.
- */
-#ifndef RPC_SVC
-%#ifndef KERNEL
-typedef opaque keybuf[HEXKEYBYTES]; /* store key in hex */
-%#endif
-#endif
-
-typedef string netnamestr<MAXNETNAMELEN>;
-
-/*
- * Argument to ENCRYPT or DECRYPT
- */
-struct cryptkeyarg {
- netnamestr remotename;
- des_block deskey;
-};
-
-/*
- * Result of ENCRYPT or DECRYPT
- */
-union cryptkeyres switch (keystatus status) {
-case KEY_SUCCESS:
- des_block deskey;
-default:
- void;
-};
-
-const MAXGIDS = 16; /* max number of gids in gid list */
-
-/*
- * Unix credential
- */
-struct unixcred {
- int uid;
- int gid;
- int gids<MAXGIDS>;
-};
-
-/*
- * Result returned from GETCRED
- */
-union getcredres switch (keystatus status) {
-case KEY_SUCCESS:
- unixcred cred;
-default:
- void;
-};
diff --git a/lib/librpc/secure_rpc/rpc/netname.c b/lib/librpc/secure_rpc/rpc/netname.c
deleted file mode 100644
index 21e2491..0000000
--- a/lib/librpc/secure_rpc/rpc/netname.c
+++ /dev/null
@@ -1,239 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)netname.c 2.2 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * netname utility routines
- * convert from unix names to network names and vice-versa
- * This module is operating system dependent!
- * What we define here will work with any unix system that has adopted
- * the sun yp domain architecture.
- */
-#include <sys/param.h>
-#include <rpc/rpc.h>
-#include <ctype.h>
-
-extern char *sprintf();
-extern char *strncpy();
-
-static char OPSYS[] = "unix";
-static char NETID[] = "netid.byname";
-
-/*
- * Convert network-name into unix credential
- */
-netname2user(netname, uidp, gidp, gidlenp, gidlist)
- char netname[MAXNETNAMELEN+1];
- int *uidp;
- int *gidp;
- int *gidlenp;
- int *gidlist;
-{
- int stat;
- char *val;
- char *p;
- int vallen;
- char *domain;
- int gidlen;
-
- stat = yp_get_default_domain(&domain);
- if (stat != 0) {
- return (0);
- }
- stat = yp_match(domain, NETID, netname, strlen(netname), &val, &vallen);
- if (stat != 0) {
- return (0);
- }
- val[vallen] = 0;
- p = val;
- *uidp = atois(&p);
- if (p == NULL || *p++ != ':') {
- free(val);
- return (0);
- }
- *gidp = atois(&p);
- if (p == NULL) {
- free(val);
- return (0);
- }
- gidlen = 0;
- for (gidlen = 0; gidlen < NGROUPS; gidlen++) {
- if (*p++ != ',') {
- break;
- }
- gidlist[gidlen] = atois(&p);
- if (p == NULL) {
- free(val);
- return (0);
- }
- }
- *gidlenp = gidlen;
- free(val);
- return (1);
-}
-
-/*
- * Convert network-name to hostname
- */
-netname2host(netname, hostname, hostlen)
- char netname[MAXNETNAMELEN+1];
- char *hostname;
- int hostlen;
-{
- int stat;
- char *val;
- int vallen;
- char *domain;
-
- stat = yp_get_default_domain(&domain);
- if (stat != 0) {
- return (0);
- }
- stat = yp_match(domain, NETID, netname, strlen(netname), &val, &vallen);
- if (stat != 0) {
- return (0);
- }
- val[vallen] = 0;
- if (*val != '0') {
- free(val);
- return (0);
- }
- if (val[1] != ':') {
- free(val);
- return (0);
- }
- (void) strncpy(hostname, val + 2, hostlen);
- free(val);
- return (1);
-}
-
-
-/*
- * Figure out my fully qualified network name
- */
-getnetname(name)
- char name[MAXNETNAMELEN+1];
-{
- int uid;
-
- uid = geteuid();
- if (uid == 0) {
- return (host2netname(name, (char *) NULL, (char *) NULL));
- } else {
- return (user2netname(name, uid, (char *) NULL));
- }
-}
-
-
-/*
- * Convert unix cred to network-name
- */
-user2netname(netname, uid, domain)
- char netname[MAXNETNAMELEN + 1];
- int uid;
- char *domain;
-{
- char *dfltdom;
-
-#define MAXIPRINT (11) /* max length of printed integer */
-
- if (domain == NULL) {
- if (yp_get_default_domain(&dfltdom) != 0) {
- return (0);
- }
- domain = dfltdom;
- }
- if (strlen(domain) + 1 + MAXIPRINT > MAXNETNAMELEN) {
- return (0);
- }
- (void) sprintf(netname, "%s.%d@%s", OPSYS, uid, domain);
- return (1);
-}
-
-
-/*
- * Convert host to network-name
- */
-host2netname(netname, host, domain)
- char netname[MAXNETNAMELEN + 1];
- char *host;
- char *domain;
-{
- char *dfltdom;
- char hostname[MAXHOSTNAMELEN+1];
-
- if (domain == NULL) {
- if (yp_get_default_domain(&dfltdom) != 0) {
- return (0);
- }
- domain = dfltdom;
- }
- if (host == NULL) {
- (void) gethostname(hostname, sizeof(hostname));
- host = hostname;
- }
- if (strlen(domain) + 1 + strlen(host) > MAXNETNAMELEN) {
- return (0);
- }
- (void) sprintf(netname, "%s.%s@%s", OPSYS, host, domain);
- return (1);
-}
-
-
-static
-atois(str)
- char **str;
-{
- char *p;
- int n;
- int sign;
-
- if (**str == '-') {
- sign = -1;
- (*str)++;
- } else {
- sign = 1;
- }
- n = 0;
- for (p = *str; isdigit(*p); p++) {
- n = (10 * n) + (*p - '0');
- }
- if (p == *str) {
- *str = NULL;
- return (0);
- }
- *str = p;
- return (n * sign);
-}
diff --git a/lib/librpc/secure_rpc/rpc/openchild.c b/lib/librpc/secure_rpc/rpc/openchild.c
deleted file mode 100644
index b30e615..0000000
--- a/lib/librpc/secure_rpc/rpc/openchild.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)openchild.c 2.3 88/08/15 4.0 RPCSRC; from 1.7 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * Open two pipes to a child process, one for reading, one for writing.
- * The pipes are accessed by FILE pointers. This is NOT a public
- * interface, but for internal use only!
- */
-#include <stdio.h>
-
-extern char *malloc();
-extern char *rindex();
-extern char *sprintf();
-
-static char *basename();
-static char SHELL[] = "/bin/sh";
-
-
-/*
- * returns pid, or -1 for failure
- */
-_openchild(command, fto, ffrom)
- char *command;
- FILE **fto;
- FILE **ffrom;
-{
- int i;
- int pid;
- int pdto[2];
- int pdfrom[2];
- char *com;
-
-
- if (pipe(pdto) < 0) {
- goto error1;
- }
- if (pipe(pdfrom) < 0) {
- goto error2;
- }
- switch (pid = vfork()) {
- case -1:
- goto error3;
-
- case 0:
- /*
- * child: read from pdto[0], write into pdfrom[1]
- */
- (void) close(0);
- (void) dup(pdto[0]);
- (void) close(1);
- (void) dup(pdfrom[1]);
- for (i = _rpc_dtablesize() - 1; i >= 3; i--) {
- (void) close(i);
- }
- com = malloc((unsigned) strlen(command) + 6);
- if (com == NULL) {
- _exit(~0);
- }
- (void) sprintf(com, "exec %s", command);
- execl(SHELL, basename(SHELL), "-c", com, NULL);
- _exit(~0);
-
- default:
- /*
- * parent: write into pdto[1], read from pdfrom[0]
- */
- *fto = fdopen(pdto[1], "w");
- (void) close(pdto[0]);
- *ffrom = fdopen(pdfrom[0], "r");
- (void) close(pdfrom[1]);
- break;
- }
- return (pid);
-
- /*
- * error cleanup and return
- */
-error3:
- (void) close(pdfrom[0]);
- (void) close(pdfrom[1]);
-error2:
- (void) close(pdto[0]);
- (void) close(pdto[1]);
-error1:
- return (-1);
-}
-
-static char *
-basename(path)
- char *path;
-{
- char *p;
-
- p = rindex(path, '/');
- if (p == NULL) {
- return (path);
- } else {
- return (p + 1);
- }
-}
diff --git a/lib/librpc/secure_rpc/rpc/publickey.c b/lib/librpc/secure_rpc/rpc/publickey.c
deleted file mode 100644
index d403b63..0000000
--- a/lib/librpc/secure_rpc/rpc/publickey.c
+++ /dev/null
@@ -1,129 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)publickey.c 2.3 88/08/15 4.0 RPCSRC";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- * @(#) from SUN 1.3
- */
-
-/*
- * Public key lookup routines
- */
-#include <stdio.h>
-#include <pwd.h>
-#include <rpc/rpc.h>
-#include <rpc/key_prot.h>
-
-
-extern char *index();
-extern char *strcpy();
-
-static char PKMAP[] = "publickey.byname";
-
-/*
- * Get somebody's encrypted secret key from the database, using
- * the given passwd to decrypt it.
- */
-getsecretkey(netname, secretkey, passwd)
- char *netname;
- char *secretkey;
- char *passwd;
-{
- char *domain;
- int len;
- char *lookup;
- int err;
- char *p;
-
-
- err = yp_get_default_domain(&domain);
- if (err) {
- return(0);
- }
- err = yp_match(domain, PKMAP, netname, strlen(netname), &lookup, &len);
- if (err) {
- return(0);
- }
- lookup[len] = 0;
- p = index(lookup,':');
- if (p == NULL) {
- free(lookup);
- return(0);
- }
- p++;
- if (!xdecrypt(p, passwd)) {
- free(lookup);
- return(0);
- }
- if (bcmp(p, p + HEXKEYBYTES, KEYCHECKSUMSIZE) != 0) {
- secretkey[0] = 0;
- free(lookup);
- return(1);
- }
- p[HEXKEYBYTES] = 0;
- (void) strcpy(secretkey, p);
- free(lookup);
- return(1);
-}
-
-
-
-/*
- * Get somebody's public key
- */
-getpublickey(netname, publickey)
- char *netname;
- char *publickey;
-{
- char *domain;
- int len;
- char *lookup;
- int err;
- char *p;
-
- err = yp_get_default_domain(&domain);
- if (err) {
- return(0);
- }
- err = yp_match(domain, PKMAP, netname, strlen(netname), &lookup, &len);
- if (err) {
- return(0);
- }
- p = index(lookup, ':');
- if (p == NULL) {
- free(lookup);
- return(0);
- }
- *p = 0;
- (void) strcpy(publickey, lookup);
- return(1);
-}
diff --git a/lib/librpc/secure_rpc/rpc/rtime.c b/lib/librpc/secure_rpc/rpc/rtime.c
deleted file mode 100644
index 725995c..0000000
--- a/lib/librpc/secure_rpc/rpc/rtime.c
+++ /dev/null
@@ -1,141 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
-
- */
-
-/*
- * rtime - get time from remote machine
- *
- * gets time, obtaining value from host
- * on the udp/time socket. Since timeserver returns
- * with time of day in seconds since Jan 1, 1900, must
- * subtract seconds before Jan 1, 1970 to get
- * what unix uses.
- */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/errno.h>
-#include <netinet/in.h>
-#include <stdio.h>
-
-#define NYEARS (1970 - 1900)
-#define TOFFSET (60*60*24*(365*NYEARS + (NYEARS/4)))
-extern errno;
-
-static void do_close();
-
-rtime(addrp, timep, timeout)
- struct sockaddr_in *addrp;
- struct timeval *timep;
- struct timeval *timeout;
-{
- int s;
- fd_set readfds;
- int res;
- unsigned long thetime;
- struct sockaddr_in from;
- int fromlen;
- int type;
-
- if (timeout == NULL) {
- type = SOCK_STREAM;
- } else {
- type = SOCK_DGRAM;
- }
- s = socket(AF_INET, type, 0);
- if (s < 0) {
- return(-1);
- }
- addrp->sin_family = AF_INET;
- addrp->sin_port = htons(IPPORT_TIMESERVER);
- if (type == SOCK_DGRAM) {
- res = sendto(s, (char *)&thetime, sizeof(thetime), 0,
- (struct sockaddr *)addrp, sizeof(*addrp));
- if (res < 0) {
- do_close(s);
- return(-1);
- }
- do {
- FD_ZERO(&readfds);
- FD_SET(s, &readfds);
- res = select(_rpc_dtablesize(), &readfds, (int *)NULL,
- (int *)NULL, timeout);
- } while (res < 0 && errno == EINTR);
- if (res <= 0) {
- if (res == 0) {
- errno = ETIMEDOUT;
- }
- do_close(s);
- return(-1);
- }
- fromlen = sizeof(from);
- res = recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
- (struct sockaddr *)&from, &fromlen);
- do_close(s);
- if (res < 0) {
- return(-1);
- }
- } else {
- if (connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
- do_close(s);
- return(-1);
- }
- res = read(s, (char *)&thetime, sizeof(thetime));
- do_close(s);
- if (res < 0) {
- return(-1);
- }
- }
- if (res != sizeof(thetime)) {
- errno = EIO;
- return(-1);
- }
- thetime = ntohl(thetime);
- timep->tv_sec = thetime - TOFFSET;
- timep->tv_usec = 0;
- return(0);
-}
-
-static void
-do_close(s)
- int s;
-{
- int save;
-
- save = errno;
- (void) close(s);
- errno = save;
-}
diff --git a/lib/librpc/secure_rpc/rpc/svc_auth.c b/lib/librpc/secure_rpc/rpc/svc_auth.c
deleted file mode 100644
index 7ad47ca..0000000
--- a/lib/librpc/secure_rpc/rpc/svc_auth.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* @(#)svc_auth.c 2.4 88/08/15 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_auth.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_auth.c, Server-side rpc authenticator interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-
-/*
- * svcauthsw is the bdevsw of server side authentication.
- *
- * Server side authenticators are called from authenticate by
- * using the client auth struct flavor field to index into svcauthsw.
- * The server auth flavors must implement a routine that looks
- * like:
- *
- * enum auth_stat
- * flavorx_auth(rqst, msg)
- * register struct svc_req *rqst;
- * register struct rpc_msg *msg;
- *
- */
-
-enum auth_stat _svcauth_null(); /* no authentication */
-enum auth_stat _svcauth_unix(); /* unix style (uid, gids) */
-enum auth_stat _svcauth_short(); /* short hand unix style */
-enum auth_stat _svcauth_des(); /* des style */
-
-static struct {
- enum auth_stat (*authenticator)();
-} svcauthsw[] = {
- _svcauth_null, /* AUTH_NULL */
- _svcauth_unix, /* AUTH_UNIX */
- _svcauth_short, /* AUTH_SHORT */
- _svcauth_des /* AUTH_DES */
-};
-#define AUTH_MAX 3 /* HIGHEST AUTH NUMBER */
-
-
-/*
- * The call rpc message, msg has been obtained from the wire. The msg contains
- * the raw form of credentials and verifiers. authenticate returns AUTH_OK
- * if the msg is successfully authenticated. If AUTH_OK then the routine also
- * does the following things:
- * set rqst->rq_xprt->verf to the appropriate response verifier;
- * sets rqst->rq_client_cred to the "cooked" form of the credentials.
- *
- * NB: rqst->rq_cxprt->verf must be pre-alloctaed;
- * its length is set appropriately.
- *
- * The caller still owns and is responsible for msg->u.cmb.cred and
- * msg->u.cmb.verf. The authentication system retains ownership of
- * rqst->rq_client_cred, the cooked credentials.
- *
- * There is an assumption that any flavour less than AUTH_NULL is
- * invalid.
- */
-enum auth_stat
-_authenticate(rqst, msg)
- register struct svc_req *rqst;
- struct rpc_msg *msg;
-{
- register int cred_flavor;
-
- rqst->rq_cred = msg->rm_call.cb_cred;
- rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor;
- rqst->rq_xprt->xp_verf.oa_length = 0;
- cred_flavor = rqst->rq_cred.oa_flavor;
- if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) {
- return ((*(svcauthsw[cred_flavor].authenticator))(rqst, msg));
- }
-
- return (AUTH_REJECTEDCRED);
-}
-
-enum auth_stat
-_svcauth_null(/*rqst, msg*/)
- /*struct svc_req *rqst;
- struct rpc_msg *msg;*/
-{
-
- return (AUTH_OK);
-}
diff --git a/lib/librpc/secure_rpc/rpc/svcauth_des.c b/lib/librpc/secure_rpc/rpc/svcauth_des.c
deleted file mode 100644
index 0129bef..0000000
--- a/lib/librpc/secure_rpc/rpc/svcauth_des.c
+++ /dev/null
@@ -1,519 +0,0 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)svcauth_des.c 2.3 89/07/11 4.0 RPCSRC; from 1.15 88/02/08 SMI";
-#endif
-
-/*
- * Copyright (c) 1988 by Sun Microsystems, Inc.
- */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * svcauth_des.c, server-side des authentication
- *
- * We insure for the service the following:
- * (1) The timestamp microseconds do not exceed 1 million.
- * (2) The timestamp plus the window is less than the current time.
- * (3) The timestamp is not less than the one previously
- * seen in the current session.
- *
- * It is up to the server to determine if the window size is
- * too small .
- *
- */
-
-#include <des_crypt.h>
-#include <sys/param.h>
-#include <netinet/in.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#include <rpc/auth_des.h>
-#include <rpc/svc_auth.h>
-#include <rpc/svc.h>
-#include <rpc/rpc_msg.h>
-
-
-#define debug(msg) /*printf("svcauth_des: %s\n", msg)*/
-
-extern char *strcpy();
-
-#define USEC_PER_SEC ((u_long) 1000000L)
-#define BEFORE(t1, t2) timercmp(t1, t2, <)
-
-/*
- * LRU cache of conversation keys and some other useful items.
- */
-#define AUTHDES_CACHESZ 64
-struct cache_entry {
- des_block key; /* conversation key */
- char *rname; /* client's name */
- u_int window; /* credential lifetime window */
- struct timeval laststamp; /* detect replays of creds */
- char *localcred; /* generic local credential */
-};
-static struct cache_entry *authdes_cache/* [AUTHDES_CACHESZ] */;
-static short *authdes_lru/* [AUTHDES_CACHESZ] */;
-
-static void cache_init(); /* initialize the cache */
-static short cache_spot(); /* find an entry in the cache */
-static void cache_ref(/*short sid*/); /* note that sid was ref'd */
-
-static void invalidate(); /* invalidate entry in cache */
-
-/*
- * cache statistics
- */
-struct {
- u_long ncachehits; /* times cache hit, and is not replay */
- u_long ncachereplays; /* times cache hit, and is replay */
- u_long ncachemisses; /* times cache missed */
-} svcauthdes_stats;
-
-/*
- * Service side authenticator for AUTH_DES
- */
-enum auth_stat
-_svcauth_des(rqst, msg)
- register struct svc_req *rqst;
- register struct rpc_msg *msg;
-{
-
- register long *ixdr;
- des_block cryptbuf[2];
- register struct authdes_cred *cred;
- struct authdes_verf verf;
- int status;
- register struct cache_entry *entry;
- short sid;
- des_block *sessionkey;
- des_block ivec;
- u_int window;
- struct timeval timestamp;
- u_long namelen;
- struct area {
- struct authdes_cred area_cred;
- char area_netname[MAXNETNAMELEN+1];
- } *area;
-
- if (authdes_cache == NULL) {
- cache_init();
- }
-
- area = (struct area *)rqst->rq_clntcred;
- cred = (struct authdes_cred *)&area->area_cred;
-
- /*
- * Get the credential
- */
- ixdr = (long *)msg->rm_call.cb_cred.oa_base;
- cred->adc_namekind = IXDR_GET_ENUM(ixdr, enum authdes_namekind);
- switch (cred->adc_namekind) {
- case ADN_FULLNAME:
- namelen = IXDR_GET_U_LONG(ixdr);
- if (namelen > MAXNETNAMELEN) {
- return (AUTH_BADCRED);
- }
- cred->adc_fullname.name = area->area_netname;
- bcopy((char *)ixdr, cred->adc_fullname.name,
- (u_int)namelen);
- cred->adc_fullname.name[namelen] = 0;
- ixdr += (RNDUP(namelen) / BYTES_PER_XDR_UNIT);
- cred->adc_fullname.key.key.high = (u_long)*ixdr++;
- cred->adc_fullname.key.key.low = (u_long)*ixdr++;
- cred->adc_fullname.window = (u_long)*ixdr++;
- break;
- case ADN_NICKNAME:
- cred->adc_nickname = (u_long)*ixdr++;
- break;
- default:
- return (AUTH_BADCRED);
- }
-
- /*
- * Get the verifier
- */
- ixdr = (long *)msg->rm_call.cb_verf.oa_base;
- verf.adv_xtimestamp.key.high = (u_long)*ixdr++;
- verf.adv_xtimestamp.key.low = (u_long)*ixdr++;
- verf.adv_int_u = (u_long)*ixdr++;
-
-
- /*
- * Get the conversation key
- */
- if (cred->adc_namekind == ADN_FULLNAME) {
- sessionkey = &cred->adc_fullname.key;
- if (key_decryptsession(cred->adc_fullname.name,
- sessionkey) < 0) {
- debug("decryptsessionkey");
- return (AUTH_BADCRED); /* key not found */
- }
- } else { /* ADN_NICKNAME */
- sid = (short)cred->adc_nickname;
- if (sid >= AUTHDES_CACHESZ) {
- debug("bad nickname");
- return (AUTH_BADCRED); /* garbled credential */
- }
- sessionkey = &authdes_cache[sid].key;
- }
-
-
- /*
- * Decrypt the timestamp
- */
- cryptbuf[0] = verf.adv_xtimestamp;
- if (cred->adc_namekind == ADN_FULLNAME) {
- cryptbuf[1].key.high = cred->adc_fullname.window;
- cryptbuf[1].key.low = verf.adv_winverf;
- ivec.key.high = ivec.key.low = 0;
- status = cbc_crypt((char *)sessionkey, (char *)cryptbuf,
- 2*sizeof(des_block), DES_DECRYPT | DES_HW,
- (char *)&ivec);
- } else {
- status = ecb_crypt((char *)sessionkey, (char *)cryptbuf,
- sizeof(des_block), DES_DECRYPT | DES_HW);
- }
- if (DES_FAILED(status)) {
- debug("decryption failure");
- return (AUTH_FAILED); /* system error */
- }
-
- /*
- * XDR the decrypted timestamp
- */
- ixdr = (long *)cryptbuf;
- timestamp.tv_sec = IXDR_GET_LONG(ixdr);
- timestamp.tv_usec = IXDR_GET_LONG(ixdr);
-
- /*
- * Check for valid credentials and verifiers.
- * They could be invalid because the key was flushed
- * out of the cache, and so a new session should begin.
- * Be sure and send AUTH_REJECTED{CRED, VERF} if this is the case.
- */
- {
- struct timeval current;
- int nick;
- int winverf;
-
- if (cred->adc_namekind == ADN_FULLNAME) {
- window = IXDR_GET_U_LONG(ixdr);
- winverf = IXDR_GET_U_LONG(ixdr);
- if (winverf != window - 1) {
- debug("window verifier mismatch");
- return (AUTH_BADCRED); /* garbled credential */
- }
- sid = cache_spot(sessionkey, cred->adc_fullname.name,
- &timestamp);
- if (sid < 0) {
- debug("replayed credential");
- return (AUTH_REJECTEDCRED); /* replay */
- }
- nick = 0;
- } else { /* ADN_NICKNAME */
- window = authdes_cache[sid].window;
- nick = 1;
- }
-
- if ((u_long)timestamp.tv_usec >= USEC_PER_SEC) {
- debug("invalid usecs");
- /* cached out (bad key), or garbled verifier */
- return (nick ? AUTH_REJECTEDVERF : AUTH_BADVERF);
- }
- if (nick && BEFORE(&timestamp,
- &authdes_cache[sid].laststamp)) {
- debug("timestamp before last seen");
- return (AUTH_REJECTEDVERF); /* replay */
- }
- (void) gettimeofday(&current, (struct timezone *)NULL);
- current.tv_sec -= window; /* allow for expiration */
- if (!BEFORE(&current, &timestamp)) {
- debug("timestamp expired");
- /* replay, or garbled credential */
- return (nick ? AUTH_REJECTEDVERF : AUTH_BADCRED);
- }
- }
-
- /*
- * Set up the reply verifier
- */
- verf.adv_nickname = (u_long)sid;
-
- /*
- * xdr the timestamp before encrypting
- */
- ixdr = (long *)cryptbuf;
- IXDR_PUT_LONG(ixdr, timestamp.tv_sec - 1);
- IXDR_PUT_LONG(ixdr, timestamp.tv_usec);
-
- /*
- * encrypt the timestamp
- */
- status = ecb_crypt((char *)sessionkey, (char *)cryptbuf,
- sizeof(des_block), DES_ENCRYPT | DES_HW);
- if (DES_FAILED(status)) {
- debug("encryption failure");
- return (AUTH_FAILED); /* system error */
- }
- verf.adv_xtimestamp = cryptbuf[0];
-
- /*
- * Serialize the reply verifier, and update rqst
- */
- ixdr = (long *)msg->rm_call.cb_verf.oa_base;
- *ixdr++ = (long)verf.adv_xtimestamp.key.high;
- *ixdr++ = (long)verf.adv_xtimestamp.key.low;
- *ixdr++ = (long)verf.adv_int_u;
-
- rqst->rq_xprt->xp_verf.oa_flavor = AUTH_DES;
- rqst->rq_xprt->xp_verf.oa_base = msg->rm_call.cb_verf.oa_base;
- rqst->rq_xprt->xp_verf.oa_length =
- (char *)ixdr - msg->rm_call.cb_verf.oa_base;
-
- /*
- * We succeeded, commit the data to the cache now and
- * finish cooking the credential.
- */
- entry = &authdes_cache[sid];
- entry->laststamp = timestamp;
- cache_ref(sid);
- if (cred->adc_namekind == ADN_FULLNAME) {
- cred->adc_fullname.window = window;
- cred->adc_nickname = (u_long)sid; /* save nickname */
- if (entry->rname != NULL) {
- mem_free(entry->rname, strlen(entry->rname) + 1);
- }
- entry->rname = mem_alloc((u_int)strlen(cred->adc_fullname.name)
- + 1);
- if (entry->rname != NULL) {
- (void) strcpy(entry->rname, cred->adc_fullname.name);
- } else {
- debug("out of memory");
- }
- entry->key = *sessionkey;
- entry->window = window;
- invalidate(entry->localcred); /* mark any cached cred invalid */
- } else { /* ADN_NICKNAME */
- /*
- * nicknames are cooked into fullnames
- */
- cred->adc_namekind = ADN_FULLNAME;
- cred->adc_fullname.name = entry->rname;
- cred->adc_fullname.key = entry->key;
- cred->adc_fullname.window = entry->window;
- }
- return (AUTH_OK); /* we made it!*/
-}
-
-
-/*
- * Initialize the cache
- */
-static void
-cache_init()
-{
- register int i;
-
- authdes_cache = (struct cache_entry *)
- mem_alloc(sizeof(struct cache_entry) * AUTHDES_CACHESZ);
- bzero((char *)authdes_cache,
- sizeof(struct cache_entry) * AUTHDES_CACHESZ);
-
- authdes_lru = (short *)mem_alloc(sizeof(short) * AUTHDES_CACHESZ);
- /*
- * Initialize the lru list
- */
- for (i = 0; i < AUTHDES_CACHESZ; i++) {
- authdes_lru[i] = i;
- }
-}
-
-
-/*
- * Find the lru victim
- */
-static short
-cache_victim()
-{
- return (authdes_lru[AUTHDES_CACHESZ-1]);
-}
-
-/*
- * Note that sid was referenced
- */
-static void
-cache_ref(sid)
- register short sid;
-{
- register int i;
- register short curr;
- register short prev;
-
- prev = authdes_lru[0];
- authdes_lru[0] = sid;
- for (i = 1; prev != sid; i++) {
- curr = authdes_lru[i];
- authdes_lru[i] = prev;
- prev = curr;
- }
-}
-
-
-/*
- * Find a spot in the cache for a credential containing
- * the items given. Return -1 if a replay is detected, otherwise
- * return the spot in the cache.
- */
-static short
-cache_spot(key, name, timestamp)
- register des_block *key;
- char *name;
- struct timeval *timestamp;
-{
- register struct cache_entry *cp;
- register int i;
- register u_long hi;
-
- hi = key->key.high;
- for (cp = authdes_cache, i = 0; i < AUTHDES_CACHESZ; i++, cp++) {
- if (cp->key.key.high == hi &&
- cp->key.key.low == key->key.low &&
- cp->rname != NULL &&
- bcmp(cp->rname, name, strlen(name) + 1) == 0) {
- if (BEFORE(timestamp, &cp->laststamp)) {
- svcauthdes_stats.ncachereplays++;
- return (-1); /* replay */
- }
- svcauthdes_stats.ncachehits++;
- return (i); /* refresh */
- }
- }
- svcauthdes_stats.ncachemisses++;
- return (cache_victim()); /* new credential */
-}
-
-
-#if (defined(sun) || defined(vax))
-/*
- * Local credential handling stuff.
- * NOTE: bsd unix dependent.
- * Other operating systems should put something else here.
- */
-#define UNKNOWN -2 /* grouplen, if cached cred is unknown user */
-#define INVALID -1 /* grouplen, if cache entry is invalid */
-
-struct bsdcred {
- short uid; /* cached uid */
- short gid; /* cached gid */
- short grouplen; /* length of cached groups */
- short groups[NGROUPS]; /* cached groups */
-};
-
-/*
- * Map a des credential into a unix cred.
- * We cache the credential here so the application does
- * not have to make an rpc call every time to interpret
- * the credential.
- */
-authdes_getucred(adc, uid, gid, grouplen, groups)
- struct authdes_cred *adc;
- short *uid;
- short *gid;
- short *grouplen;
- register int *groups;
-{
- unsigned sid;
- register int i;
- int i_uid;
- int i_gid;
- int i_grouplen;
- struct bsdcred *cred;
-
- sid = adc->adc_nickname;
- if (sid >= AUTHDES_CACHESZ) {
- debug("invalid nickname");
- return (0);
- }
- cred = (struct bsdcred *)authdes_cache[sid].localcred;
- if (cred == NULL) {
- cred = (struct bsdcred *)mem_alloc(sizeof(struct bsdcred));
- authdes_cache[sid].localcred = (char *)cred;
- cred->grouplen = INVALID;
- }
- if (cred->grouplen == INVALID) {
- /*
- * not in cache: lookup
- */
- if (!netname2user(adc->adc_fullname.name, &i_uid, &i_gid,
- &i_grouplen, groups))
- {
- debug("unknown netname");
- cred->grouplen = UNKNOWN; /* mark as lookup up, but not found */
- return (0);
- }
- debug("missed ucred cache");
- *uid = cred->uid = i_uid;
- *gid = cred->gid = i_gid;
- *grouplen = cred->grouplen = i_grouplen;
- for (i = i_grouplen - 1; i >= 0; i--) {
- cred->groups[i] = groups[i]; /* int to short */
- }
- return (1);
- } else if (cred->grouplen == UNKNOWN) {
- /*
- * Already lookup up, but no match found
- */
- return (0);
- }
-
- /*
- * cached credentials
- */
- *uid = cred->uid;
- *gid = cred->gid;
- *grouplen = cred->grouplen;
- for (i = cred->grouplen - 1; i >= 0; i--) {
- groups[i] = cred->groups[i]; /* short to int */
- }
- return (1);
-}
-
-static void
-invalidate(cred)
- char *cred;
-{
- if (cred == NULL) {
- return;
- }
- ((struct bsdcred *)cred)->grouplen = INVALID;
-}
-#endif
-
diff --git a/lib/librpc/secure_rpc/rpc/xcrypt.c b/lib/librpc/secure_rpc/rpc/xcrypt.c
deleted file mode 100644
index 215fda6..0000000
--- a/lib/librpc/secure_rpc/rpc/xcrypt.c
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef lint
-static char sccsid[] = "@(#)xcrypt.c 2.2 88/08/10 4.0 RPCSRC";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Hex encryption/decryption and utility routines
- *
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <des_crypt.h>
-
-extern char *malloc();
-
-extern char hex[]; /* forward */
-static char hexval();
-
-/*
- * Encrypt a secret key given passwd
- * The secret key is passed and returned in hex notation.
- * Its length must be a multiple of 16 hex digits (64 bits).
- */
-xencrypt(secret, passwd)
- char *secret;
- char *passwd;
-{
- char key[8];
- char ivec[8];
- char *buf;
- int err;
- int len;
-
- len = strlen(secret) / 2;
- buf = malloc((unsigned)len);
-
- hex2bin(len, secret, buf);
- passwd2des(passwd, key);
- bzero(ivec, 8);
-
- err = cbc_crypt(key, buf, len, DES_ENCRYPT | DES_HW, ivec);
- if (DES_FAILED(err)) {
- free(buf);
- return (0);
- }
- bin2hex(len, (unsigned char *) buf, secret);
- free(buf);
- return (1);
-}
-
-/*
- * Decrypt secret key using passwd
- * The secret key is passed and returned in hex notation.
- * Once again, the length is a multiple of 16 hex digits
- */
-xdecrypt(secret, passwd)
- char *secret;
- char *passwd;
-{
- char key[8];
- char ivec[8];
- char *buf;
- int err;
- int len;
-
- len = strlen(secret) / 2;
- buf = malloc((unsigned)len);
-
- hex2bin(len, secret, buf);
- passwd2des(passwd, key);
- bzero(ivec, 8);
-
- err = cbc_crypt(key, buf, len, DES_DECRYPT | DES_HW, ivec);
- if (DES_FAILED(err)) {
- free(buf);
- return (0);
- }
- bin2hex(len, (unsigned char *) buf, secret);
- free(buf);
- return (1);
-}
-
-
-/*
- * Turn password into DES key
- */
-passwd2des(pw, key)
- char *pw;
- char *key;
-{
- int i;
-
- bzero(key, 8);
- for (i = 0; *pw; i = (i+1)%8) {
- key[i] ^= *pw++ << 1;
- }
- des_setparity(key);
-}
-
-
-
-/*
- * Hex to binary conversion
- */
-static
-hex2bin(len, hexnum, binnum)
- int len;
- char *hexnum;
- char *binnum;
-{
- int i;
-
- for (i = 0; i < len; i++) {
- *binnum++ = 16 * hexval(hexnum[2*i]) + hexval(hexnum[2*i+1]);
- }
-}
-
-/*
- * Binary to hex conversion
- */
-static
-bin2hex(len, binnum, hexnum)
- int len;
- unsigned char *binnum;
- char *hexnum;
-{
- int i;
- unsigned val;
-
- for (i = 0; i < len; i++) {
- val = binnum[i];
- hexnum[i*2] = hex[val >> 4];
- hexnum[i*2+1] = hex[val & 0xf];
- }
- hexnum[len*2] = 0;
-}
-
-static char hex[16] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
-};
-
-static char
-hexval(c)
- char c;
-{
- if (c >= '0' && c <= '9') {
- return (c - '0');
- } else if (c >= 'a' && c <= 'z') {
- return (c - 'a' + 10);
- } else if (c >= 'A' && c <= 'Z') {
- return (c - 'A' + 10);
- } else {
- return (-1);
- }
-}
diff --git a/lib/libtelnet/auth-proto.h b/lib/libtelnet/auth-proto.h
deleted file mode 100644
index 06bba2b..0000000
--- a/lib/libtelnet/auth-proto.h
+++ /dev/null
@@ -1,96 +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.
- *
- * @(#)auth-proto.h 8.1 (Berkeley) 6/4/93
- */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#if !defined(P)
-#ifdef __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-#endif
-
-#if defined(AUTHENTICATION)
-Authenticator *findauthenticator P((int, int));
-
-void auth_init P((char *, int));
-int auth_cmd P((int, char **));
-void auth_request P((void));
-void auth_send P((unsigned char *, int));
-void auth_send_retry P((void));
-void auth_is P((unsigned char *, int));
-void auth_reply P((unsigned char *, int));
-void auth_finished P((Authenticator *, int));
-int auth_wait P((char *));
-void auth_disable_name P((char *));
-void auth_gen_printsub P((unsigned char *, int, unsigned char *, int));
-
-#ifdef KRB4
-int kerberos4_init P((Authenticator *, int));
-int kerberos4_send P((Authenticator *));
-void kerberos4_is P((Authenticator *, unsigned char *, int));
-void kerberos4_reply P((Authenticator *, unsigned char *, int));
-int kerberos4_status P((Authenticator *, char *, int));
-void kerberos4_printsub P((unsigned char *, int, unsigned char *, int));
-#endif
-
-#ifdef KRB5
-int kerberos5_init P((Authenticator *, int));
-int kerberos5_send P((Authenticator *));
-void kerberos5_is P((Authenticator *, unsigned char *, int));
-void kerberos5_reply P((Authenticator *, unsigned char *, int));
-int kerberos5_status P((Authenticator *, char *, int));
-void kerberos5_printsub P((unsigned char *, int, unsigned char *, int));
-#endif
-#endif
diff --git a/lib/libtelnet/auth.c b/lib/libtelnet/auth.c
deleted file mode 100644
index 1eb198a..0000000
--- a/lib/libtelnet/auth.c
+++ /dev/null
@@ -1,658 +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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)auth.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-
-#if defined(AUTHENTICATION)
-#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-#define AUTH_NAMES
-#include <arpa/telnet.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-#include "encrypt.h"
-#include "auth.h"
-#include "misc-proto.h"
-#include "auth-proto.h"
-
-#define typemask(x) (1<<((x)-1))
-
-#ifdef KRB4_ENCPWD
-extern krb4encpwd_init();
-extern krb4encpwd_send();
-extern krb4encpwd_is();
-extern krb4encpwd_reply();
-extern krb4encpwd_status();
-extern krb4encpwd_printsub();
-#endif
-
-#ifdef RSA_ENCPWD
-extern rsaencpwd_init();
-extern rsaencpwd_send();
-extern rsaencpwd_is();
-extern rsaencpwd_reply();
-extern rsaencpwd_status();
-extern rsaencpwd_printsub();
-#endif
-
-int auth_debug_mode = 0;
-static char *Name = "Noname";
-static int Server = 0;
-static Authenticator *authenticated = 0;
-static int authenticating = 0;
-static int validuser = 0;
-static unsigned char _auth_send_data[256];
-static unsigned char *auth_send_data;
-static int auth_send_cnt = 0;
-
-/*
- * Authentication types supported. Plese note that these are stored
- * in priority order, i.e. try the first one first.
- */
-Authenticator authenticators[] = {
-#ifdef SPX
- { AUTHTYPE_SPX, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
- spx_init,
- spx_send,
- spx_is,
- spx_reply,
- spx_status,
- spx_printsub },
- { AUTHTYPE_SPX, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
- spx_init,
- spx_send,
- spx_is,
- spx_reply,
- spx_status,
- spx_printsub },
-#endif
-#ifdef KRB5
-# ifdef ENCRYPTION
- { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
- kerberos5_init,
- kerberos5_send,
- kerberos5_is,
- kerberos5_reply,
- kerberos5_status,
- kerberos5_printsub },
-# endif /* ENCRYPTION */
- { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
- kerberos5_init,
- kerberos5_send,
- kerberos5_is,
- kerberos5_reply,
- kerberos5_status,
- kerberos5_printsub },
-#endif
-#ifdef KRB4
-# ifdef ENCRYPTION
- { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
- kerberos4_init,
- kerberos4_send,
- kerberos4_is,
- kerberos4_reply,
- kerberos4_status,
- kerberos4_printsub },
-# endif /* ENCRYPTION */
- { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
- kerberos4_init,
- kerberos4_send,
- kerberos4_is,
- kerberos4_reply,
- kerberos4_status,
- kerberos4_printsub },
-#endif
-#ifdef KRB4_ENCPWD
- { AUTHTYPE_KRB4_ENCPWD, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
- krb4encpwd_init,
- krb4encpwd_send,
- krb4encpwd_is,
- krb4encpwd_reply,
- krb4encpwd_status,
- krb4encpwd_printsub },
-#endif
-#ifdef RSA_ENCPWD
- { AUTHTYPE_RSA_ENCPWD, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
- rsaencpwd_init,
- rsaencpwd_send,
- rsaencpwd_is,
- rsaencpwd_reply,
- rsaencpwd_status,
- rsaencpwd_printsub },
-#endif
- { 0, },
-};
-
-static Authenticator NoAuth = { 0 };
-
-static int i_support = 0;
-static int i_wont_support = 0;
-
- Authenticator *
-findauthenticator(type, way)
- int type;
- int way;
-{
- Authenticator *ap = authenticators;
-
- while (ap->type && (ap->type != type || ap->way != way))
- ++ap;
- return(ap->type ? ap : 0);
-}
-
- void
-auth_init(name, server)
- char *name;
- int server;
-{
- Authenticator *ap = authenticators;
-
- Server = server;
- Name = name;
-
- i_support = 0;
- authenticated = 0;
- authenticating = 0;
- while (ap->type) {
- if (!ap->init || (*ap->init)(ap, server)) {
- i_support |= typemask(ap->type);
- if (auth_debug_mode)
- printf(">>>%s: I support auth type %d %d\r\n",
- Name,
- ap->type, ap->way);
- }
- ++ap;
- }
-}
-
- void
-auth_disable_name(name)
- char *name;
-{
- int x;
- for (x = 0; x < AUTHTYPE_CNT; ++x) {
- if (!strcasecmp(name, AUTHTYPE_NAME(x))) {
- i_wont_support |= typemask(x);
- break;
- }
- }
-}
-
- int
-getauthmask(type, maskp)
- char *type;
- int *maskp;
-{
- register int x;
-
- if (strcasecmp(type, AUTHTYPE_NAME(0))) {
- *maskp = -1;
- return(1);
- }
-
- for (x = 1; x < AUTHTYPE_CNT; ++x) {
- if (!strcasecmp(type, AUTHTYPE_NAME(x))) {
- *maskp = typemask(x);
- return(1);
- }
- }
- return(0);
-}
-
- int
-auth_enable(type)
- int type;
-{
- return(auth_onoff(type, 1));
-}
-
- int
-auth_disable(type)
- int type;
-{
- return(auth_onoff(type, 0));
-}
-
- int
-auth_onoff(type, on)
- char *type;
- int on;
-{
- int mask = -1;
- Authenticator *ap;
-
- if (!strcasecmp(type, "?") || !strcasecmp(type, "help")) {
- printf("auth %s 'type'\n", on ? "enable" : "disable");
- printf("Where 'type' is one of:\n");
- printf("\t%s\n", AUTHTYPE_NAME(0));
- for (ap = authenticators; ap->type; ap++)
- printf("\t%s\n", AUTHTYPE_NAME(ap->type));
- return(0);
- }
-
- if (!getauthmask(type, &mask)) {
- printf("%s: invalid authentication type\n", type);
- return(0);
- }
- mask = getauthmask(type, &mask);
- if (on)
- i_wont_support &= ~mask;
- else
- i_wont_support |= mask;
- return(1);
-}
-
- int
-auth_togdebug(on)
- int on;
-{
- if (on < 0)
- auth_debug_mode ^= 1;
- else
- auth_debug_mode = on;
- printf("auth debugging %s\n", auth_debug_mode ? "enabled" : "disabled");
- return(1);
-}
-
- int
-auth_status()
-{
- Authenticator *ap;
-
- if (i_wont_support == -1)
- printf("Authentication disabled\n");
- else
- printf("Authentication enabled\n");
-
- for (ap = authenticators; ap->type; ap++)
- printf("%s: %s\n", AUTHTYPE_NAME(ap->type),
- (i_wont_support & typemask(ap->type)) ?
- "disabled" : "enabled");
- return(1);
-}
-
-/*
- * This routine is called by the server to start authentication
- * negotiation.
- */
- void
-auth_request()
-{
- static unsigned char str_request[64] = { IAC, SB,
- TELOPT_AUTHENTICATION,
- TELQUAL_SEND, };
- Authenticator *ap = authenticators;
- unsigned char *e = str_request + 4;
-
- if (!authenticating) {
- authenticating = 1;
- while (ap->type) {
- if (i_support & ~i_wont_support & typemask(ap->type)) {
- if (auth_debug_mode) {
- printf(">>>%s: Sending type %d %d\r\n",
- Name, ap->type, ap->way);
- }
- *e++ = ap->type;
- *e++ = ap->way;
- }
- ++ap;
- }
- *e++ = IAC;
- *e++ = SE;
- net_write(str_request, e - str_request);
- printsub('>', &str_request[2], e - str_request - 2);
- }
-}
-
-/*
- * This is called when an AUTH SEND is received.
- * It should never arrive on the server side (as only the server can
- * send an AUTH SEND).
- * You should probably respond to it if you can...
- *
- * If you want to respond to the types out of order (i.e. even
- * if he sends LOGIN KERBEROS and you support both, you respond
- * with KERBEROS instead of LOGIN (which is against what the
- * protocol says)) you will have to hack this code...
- */
- void
-auth_send(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Authenticator *ap;
- static unsigned char str_none[] = { IAC, SB, TELOPT_AUTHENTICATION,
- TELQUAL_IS, AUTHTYPE_NULL, 0,
- IAC, SE };
- if (Server) {
- if (auth_debug_mode) {
- printf(">>>%s: auth_send called!\r\n", Name);
- }
- return;
- }
-
- if (auth_debug_mode) {
- printf(">>>%s: auth_send got:", Name);
- printd(data, cnt); printf("\r\n");
- }
-
- /*
- * Save the data, if it is new, so that we can continue looking
- * at it if the authorization we try doesn't work
- */
- if (data < _auth_send_data ||
- data > _auth_send_data + sizeof(_auth_send_data)) {
- auth_send_cnt = cnt > sizeof(_auth_send_data)
- ? sizeof(_auth_send_data)
- : cnt;
- bcopy((void *)data, (void *)_auth_send_data, auth_send_cnt);
- auth_send_data = _auth_send_data;
- } else {
- /*
- * This is probably a no-op, but we just make sure
- */
- auth_send_data = data;
- auth_send_cnt = cnt;
- }
- while ((auth_send_cnt -= 2) >= 0) {
- if (auth_debug_mode)
- printf(">>>%s: He supports %d\r\n",
- Name, *auth_send_data);
- if ((i_support & ~i_wont_support) & typemask(*auth_send_data)) {
- ap = findauthenticator(auth_send_data[0],
- auth_send_data[1]);
- if (ap && ap->send) {
- if (auth_debug_mode)
- printf(">>>%s: Trying %d %d\r\n",
- Name, auth_send_data[0],
- auth_send_data[1]);
- if ((*ap->send)(ap)) {
- /*
- * Okay, we found one we like
- * and did it.
- * we can go home now.
- */
- if (auth_debug_mode)
- printf(">>>%s: Using type %d\r\n",
- Name, *auth_send_data);
- auth_send_data += 2;
- return;
- }
- }
- /* else
- * just continue on and look for the
- * next one if we didn't do anything.
- */
- }
- auth_send_data += 2;
- }
- net_write(str_none, sizeof(str_none));
- printsub('>', &str_none[2], sizeof(str_none) - 2);
- if (auth_debug_mode)
- printf(">>>%s: Sent failure message\r\n", Name);
- auth_finished(0, AUTH_REJECT);
-#ifdef KANNAN
- /*
- * We requested strong authentication, however no mechanisms worked.
- * Therefore, exit on client end.
- */
- printf("Unable to securely authenticate user ... exit\n");
- exit(0);
-#endif /* KANNAN */
-}
-
- void
-auth_send_retry()
-{
- /*
- * if auth_send_cnt <= 0 then auth_send will end up rejecting
- * the authentication and informing the other side of this.
- */
- auth_send(auth_send_data, auth_send_cnt);
-}
-
- void
-auth_is(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Authenticator *ap;
-
- if (cnt < 2)
- return;
-
- if (data[0] == AUTHTYPE_NULL) {
- auth_finished(0, AUTH_REJECT);
- return;
- }
-
- if (ap = findauthenticator(data[0], data[1])) {
- if (ap->is)
- (*ap->is)(ap, data+2, cnt-2);
- } else if (auth_debug_mode)
- printf(">>>%s: Invalid authentication in IS: %d\r\n",
- Name, *data);
-}
-
- void
-auth_reply(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Authenticator *ap;
-
- if (cnt < 2)
- return;
-
- if (ap = findauthenticator(data[0], data[1])) {
- if (ap->reply)
- (*ap->reply)(ap, data+2, cnt-2);
- } else if (auth_debug_mode)
- printf(">>>%s: Invalid authentication in SEND: %d\r\n",
- Name, *data);
-}
-
- void
-auth_name(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Authenticator *ap;
- unsigned char savename[256];
-
- if (cnt < 1) {
- if (auth_debug_mode)
- printf(">>>%s: Empty name in NAME\r\n", Name);
- return;
- }
- if (cnt > sizeof(savename) - 1) {
- if (auth_debug_mode)
- printf(">>>%s: Name in NAME (%d) exceeds %d length\r\n",
- Name, cnt, sizeof(savename)-1);
- return;
- }
- bcopy((void *)data, (void *)savename, cnt);
- savename[cnt] = '\0'; /* Null terminate */
- if (auth_debug_mode)
- printf(">>>%s: Got NAME [%s]\r\n", Name, savename);
- auth_encrypt_user(savename);
-}
-
- int
-auth_sendname(cp, len)
- unsigned char *cp;
- int len;
-{
- static unsigned char str_request[256+6]
- = { IAC, SB, TELOPT_AUTHENTICATION, TELQUAL_NAME, };
- register unsigned char *e = str_request + 4;
- register unsigned char *ee = &str_request[sizeof(str_request)-2];
-
- while (--len >= 0) {
- if ((*e++ = *cp++) == IAC)
- *e++ = IAC;
- if (e >= ee)
- return(0);
- }
- *e++ = IAC;
- *e++ = SE;
- net_write(str_request, e - str_request);
- printsub('>', &str_request[2], e - &str_request[2]);
- return(1);
-}
-
- void
-auth_finished(ap, result)
- Authenticator *ap;
- int result;
-{
- if (!(authenticated = ap))
- authenticated = &NoAuth;
- validuser = result;
-}
-
- /* ARGSUSED */
- static void
-auth_intr(sig)
- int sig;
-{
- auth_finished(0, AUTH_REJECT);
-}
-
- int
-auth_wait(name)
- char *name;
-{
- if (auth_debug_mode)
- printf(">>>%s: in auth_wait.\r\n", Name);
-
- if (Server && !authenticating)
- return(0);
-
- (void) signal(SIGALRM, auth_intr);
- alarm(30);
- while (!authenticated)
- if (telnet_spin())
- break;
- alarm(0);
- (void) signal(SIGALRM, SIG_DFL);
-
- /*
- * Now check to see if the user is valid or not
- */
- if (!authenticated || authenticated == &NoAuth)
- return(AUTH_REJECT);
-
- if (validuser == AUTH_VALID)
- validuser = AUTH_USER;
-
- if (authenticated->status)
- validuser = (*authenticated->status)(authenticated,
- name, validuser);
- return(validuser);
-}
-
- void
-auth_debug(mode)
- int mode;
-{
- auth_debug_mode = mode;
-}
-
- void
-auth_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- Authenticator *ap;
-
- if ((ap = findauthenticator(data[1], data[2])) && ap->printsub)
- (*ap->printsub)(data, cnt, buf, buflen);
- else
- auth_gen_printsub(data, cnt, buf, buflen);
-}
-
- void
-auth_gen_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- register unsigned char *cp;
- unsigned char tbuf[16];
-
- cnt -= 3;
- data += 3;
- buf[buflen-1] = '\0';
- buf[buflen-2] = '*';
- buflen -= 2;
- for (; cnt > 0; cnt--, data++) {
- sprintf((char *)tbuf, " %d", *data);
- for (cp = tbuf; *cp && buflen > 0; --buflen)
- *buf++ = *cp++;
- if (buflen <= 0)
- return;
- }
- *buf = '\0';
-}
-#endif
diff --git a/lib/libtelnet/auth.h b/lib/libtelnet/auth.h
deleted file mode 100644
index 615e8a0..0000000
--- a/lib/libtelnet/auth.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)auth.h 8.1 (Berkeley) 6/4/93
- */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#ifndef __AUTH__
-#define __AUTH__
-
-#define AUTH_REJECT 0 /* Rejected */
-#define AUTH_UNKNOWN 1 /* We don't know who he is, but he's okay */
-#define AUTH_OTHER 2 /* We know him, but not his name */
-#define AUTH_USER 3 /* We know he name */
-#define AUTH_VALID 4 /* We know him, and he needs no password */
-
-#if !defined(P)
-#ifdef __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-#endif
-
-typedef struct XauthP {
- int type;
- int way;
- int (*init) P((struct XauthP *, int));
- int (*send) P((struct XauthP *));
- void (*is) P((struct XauthP *, unsigned char *, int));
- void (*reply) P((struct XauthP *, unsigned char *, int));
- int (*status) P((struct XauthP *, char *, int));
- void (*printsub) P((unsigned char *, int, unsigned char *, int));
-} Authenticator;
-
-#include "auth-proto.h"
-
-extern auth_debug_mode;
-#endif
diff --git a/lib/libtelnet/enc-proto.h b/lib/libtelnet/enc-proto.h
deleted file mode 100644
index 2e30908..0000000
--- a/lib/libtelnet/enc-proto.h
+++ /dev/null
@@ -1,125 +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.
- *
- * @(#)enc-proto.h 8.1 (Berkeley) 6/4/93
- */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-#if !defined(P)
-#ifdef __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-#endif
-
-#ifdef ENCRYPTION
-void encrypt_init P((char *, int));
-Encryptions *findencryption P((int));
-void encrypt_send_supprt P((void));
-void encrypt_auto P((int));
-void decrypt_auto P((int));
-void encrypt_is P((unsigned char *, int));
-void encrypt_reply P((unsigned char *, int));
-void encrypt_start_input P((int));
-void encrypt_session_key P((Session_Key *, int));
-void encrypt_end_input P((void));
-void encrypt_start_output P((int));
-void encrypt_end_output P((void));
-void encrypt_send_request_start P((void));
-void encrypt_send_request_end P((void));
-void encrypt_send_end P((void));
-void encrypt_wait P((void));
-void encrypt_send_support P((void));
-void encrypt_send_keyid P((int, unsigned char *, int, int));
-int net_write P((unsigned char *, int));
-
-#ifdef TELENTD
-void encrypt_wait P((void));
-#else
-int encrypt_cmd P((int, char **));
-void encrypt_display P((void));
-#endif
-
-void krbdes_encrypt P((unsigned char *, int));
-int krbdes_decrypt P((int));
-int krbdes_is P((unsigned char *, int));
-int krbdes_reply P((unsigned char *, int));
-void krbdes_init P((int));
-int krbdes_start P((int, int));
-void krbdes_session P((Session_Key *, int));
-void krbdes_printsub P((unsigned char *, int, unsigned char *, int));
-
-void cfb64_encrypt P((unsigned char *, int));
-int cfb64_decrypt P((int));
-void cfb64_init P((int));
-int cfb64_start P((int, int));
-int cfb64_is P((unsigned char *, int));
-int cfb64_reply P((unsigned char *, int));
-void cfb64_session P((Session_Key *, int));
-int cfb64_keyid P((int, unsigned char *, int *));
-void cfb64_printsub P((unsigned char *, int, unsigned char *, int));
-
-void ofb64_encrypt P((unsigned char *, int));
-int ofb64_decrypt P((int));
-void ofb64_init P((int));
-int ofb64_start P((int, int));
-int ofb64_is P((unsigned char *, int));
-int ofb64_reply P((unsigned char *, int));
-void ofb64_session P((Session_Key *, int));
-int ofb64_keyid P((int, unsigned char *, int *));
-void ofb64_printsub P((unsigned char *, int, unsigned char *, int));
-
-int des_new_random_key P((Block));
-void des_set_random_generator_seed P((Block));
-void des_key_sched P((Block, Schedule));
-void des_ecb_encrypt P((Block, Block, Schedule, int));
-int des_string_to_key P((char *, Block));
-#endif /* ENCRYPTION */
diff --git a/lib/libtelnet/enc_des.c b/lib/libtelnet/enc_des.c
deleted file mode 100644
index 15e8521..0000000
--- a/lib/libtelnet/enc_des.c
+++ /dev/null
@@ -1,724 +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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)enc_des.c 8.2 (Berkeley) 12/15/93";
-#endif /* not lint */
-
-#ifdef ENCRYPTION
-# ifdef AUTHENTICATION
-# ifdef DES_ENCRYPTION
-#include <arpa/telnet.h>
-#include <stdio.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-
-#include "encrypt.h"
-#include "key-proto.h"
-#include "misc-proto.h"
-
-extern encrypt_debug_mode;
-
-#define CFB 0
-#define OFB 1
-
-#define NO_SEND_IV 1
-#define NO_RECV_IV 2
-#define NO_KEYID 4
-#define IN_PROGRESS (NO_SEND_IV|NO_RECV_IV|NO_KEYID)
-#define SUCCESS 0
-#define FAILED -1
-
-
-struct fb {
- Block krbdes_key;
- Schedule krbdes_sched;
- Block temp_feed;
- unsigned char fb_feed[64];
- int need_start;
- int state[2];
- int keyid[2];
- int once;
- struct stinfo {
- Block str_output;
- Block str_feed;
- Block str_iv;
- Block str_ikey;
- Schedule str_sched;
- int str_index;
- int str_flagshift;
- } streams[2];
-};
-
-static struct fb fb[2];
-
-struct keyidlist {
- char *keyid;
- int keyidlen;
- char *key;
- int keylen;
- int flags;
-} keyidlist [] = {
- { "\0", 1, 0, 0, 0 }, /* default key of zero */
- { 0, 0, 0, 0, 0 }
-};
-
-#define KEYFLAG_MASK 03
-
-#define KEYFLAG_NOINIT 00
-#define KEYFLAG_INIT 01
-#define KEYFLAG_OK 02
-#define KEYFLAG_BAD 03
-
-#define KEYFLAG_SHIFT 2
-
-#define SHIFT_VAL(a,b) (KEYFLAG_SHIFT*((a)+((b)*2)))
-
-#define FB64_IV 1
-#define FB64_IV_OK 2
-#define FB64_IV_BAD 3
-
-
-void fb64_stream_iv P((Block, struct stinfo *));
-void fb64_init P((struct fb *));
-static int fb64_start P((struct fb *, int, int));
-int fb64_is P((unsigned char *, int, struct fb *));
-int fb64_reply P((unsigned char *, int, struct fb *));
-static void fb64_session P((Session_Key *, int, struct fb *));
-void fb64_stream_key P((Block, struct stinfo *));
-int fb64_keyid P((int, unsigned char *, int *, struct fb *));
-
- void
-cfb64_init(server)
- int server;
-{
- fb64_init(&fb[CFB]);
- fb[CFB].fb_feed[4] = ENCTYPE_DES_CFB64;
- fb[CFB].streams[0].str_flagshift = SHIFT_VAL(0, CFB);
- fb[CFB].streams[1].str_flagshift = SHIFT_VAL(1, CFB);
-}
-
- void
-ofb64_init(server)
- int server;
-{
- fb64_init(&fb[OFB]);
- fb[OFB].fb_feed[4] = ENCTYPE_DES_OFB64;
- fb[CFB].streams[0].str_flagshift = SHIFT_VAL(0, OFB);
- fb[CFB].streams[1].str_flagshift = SHIFT_VAL(1, OFB);
-}
-
- void
-fb64_init(fbp)
- register struct fb *fbp;
-{
- bzero((void *)fbp, sizeof(*fbp));
- fbp->state[0] = fbp->state[1] = FAILED;
- fbp->fb_feed[0] = IAC;
- fbp->fb_feed[1] = SB;
- fbp->fb_feed[2] = TELOPT_ENCRYPT;
- fbp->fb_feed[3] = ENCRYPT_IS;
-}
-
-/*
- * Returns:
- * -1: some error. Negotiation is done, encryption not ready.
- * 0: Successful, initial negotiation all done.
- * 1: successful, negotiation not done yet.
- * 2: Not yet. Other things (like getting the key from
- * Kerberos) have to happen before we can continue.
- */
- int
-cfb64_start(dir, server)
- int dir;
- int server;
-{
- return(fb64_start(&fb[CFB], dir, server));
-}
- int
-ofb64_start(dir, server)
- int dir;
- int server;
-{
- return(fb64_start(&fb[OFB], dir, server));
-}
-
- static int
-fb64_start(fbp, dir, server)
- struct fb *fbp;
- int dir;
- int server;
-{
- Block b;
- int x;
- unsigned char *p;
- register int state;
-
- switch (dir) {
- case DIR_DECRYPT:
- /*
- * This is simply a request to have the other side
- * start output (our input). He will negotiate an
- * IV so we need not look for it.
- */
- state = fbp->state[dir-1];
- if (state == FAILED)
- state = IN_PROGRESS;
- break;
-
- case DIR_ENCRYPT:
- state = fbp->state[dir-1];
- if (state == FAILED)
- state = IN_PROGRESS;
- else if ((state & NO_SEND_IV) == 0)
- break;
-
- if (!VALIDKEY(fbp->krbdes_key)) {
- fbp->need_start = 1;
- break;
- }
- state &= ~NO_SEND_IV;
- state |= NO_RECV_IV;
- if (encrypt_debug_mode)
- printf("Creating new feed\r\n");
- /*
- * Create a random feed and send it over.
- */
- des_new_random_key(fbp->temp_feed);
- des_ecb_encrypt(fbp->temp_feed, fbp->temp_feed,
- fbp->krbdes_sched, 1);
- p = fbp->fb_feed + 3;
- *p++ = ENCRYPT_IS;
- p++;
- *p++ = FB64_IV;
- for (x = 0; x < sizeof(Block); ++x) {
- if ((*p++ = fbp->temp_feed[x]) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
- net_write(fbp->fb_feed, p - fbp->fb_feed);
- break;
- default:
- return(FAILED);
- }
- return(fbp->state[dir-1] = state);
-}
-
-/*
- * Returns:
- * -1: some error. Negotiation is done, encryption not ready.
- * 0: Successful, initial negotiation all done.
- * 1: successful, negotiation not done yet.
- */
- int
-cfb64_is(data, cnt)
- unsigned char *data;
- int cnt;
-{
- return(fb64_is(data, cnt, &fb[CFB]));
-}
- int
-ofb64_is(data, cnt)
- unsigned char *data;
- int cnt;
-{
- return(fb64_is(data, cnt, &fb[OFB]));
-}
-
- int
-fb64_is(data, cnt, fbp)
- unsigned char *data;
- int cnt;
- struct fb *fbp;
-{
- int x;
- unsigned char *p;
- Block b;
- register int state = fbp->state[DIR_DECRYPT-1];
-
- if (cnt-- < 1)
- goto failure;
-
- switch (*data++) {
- case FB64_IV:
- if (cnt != sizeof(Block)) {
- if (encrypt_debug_mode)
- printf("CFB64: initial vector failed on size\r\n");
- state = FAILED;
- goto failure;
- }
-
- if (encrypt_debug_mode)
- printf("CFB64: initial vector received\r\n");
-
- if (encrypt_debug_mode)
- printf("Initializing Decrypt stream\r\n");
-
- fb64_stream_iv((void *)data, &fbp->streams[DIR_DECRYPT-1]);
-
- p = fbp->fb_feed + 3;
- *p++ = ENCRYPT_REPLY;
- p++;
- *p++ = FB64_IV_OK;
- *p++ = IAC;
- *p++ = SE;
- printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
- net_write(fbp->fb_feed, p - fbp->fb_feed);
-
- state = fbp->state[DIR_DECRYPT-1] = IN_PROGRESS;
- break;
-
- default:
- if (encrypt_debug_mode) {
- printf("Unknown option type: %d\r\n", *(data-1));
- printd(data, cnt);
- printf("\r\n");
- }
- /* FALL THROUGH */
- failure:
- /*
- * We failed. Send an FB64_IV_BAD option
- * to the other side so it will know that
- * things failed.
- */
- p = fbp->fb_feed + 3;
- *p++ = ENCRYPT_REPLY;
- p++;
- *p++ = FB64_IV_BAD;
- *p++ = IAC;
- *p++ = SE;
- printsub('>', &fbp->fb_feed[2], p - &fbp->fb_feed[2]);
- net_write(fbp->fb_feed, p - fbp->fb_feed);
-
- break;
- }
- return(fbp->state[DIR_DECRYPT-1] = state);
-}
-
-/*
- * Returns:
- * -1: some error. Negotiation is done, encryption not ready.
- * 0: Successful, initial negotiation all done.
- * 1: successful, negotiation not done yet.
- */
- int
-cfb64_reply(data, cnt)
- unsigned char *data;
- int cnt;
-{
- return(fb64_reply(data, cnt, &fb[CFB]));
-}
- int
-ofb64_reply(data, cnt)
- unsigned char *data;
- int cnt;
-{
- return(fb64_reply(data, cnt, &fb[OFB]));
-}
-
-
- int
-fb64_reply(data, cnt, fbp)
- unsigned char *data;
- int cnt;
- struct fb *fbp;
-{
- int x;
- unsigned char *p;
- Block b;
- register int state = fbp->state[DIR_ENCRYPT-1];
-
- if (cnt-- < 1)
- goto failure;
-
- switch (*data++) {
- case FB64_IV_OK:
- fb64_stream_iv(fbp->temp_feed, &fbp->streams[DIR_ENCRYPT-1]);
- if (state == FAILED)
- state = IN_PROGRESS;
- state &= ~NO_RECV_IV;
- encrypt_send_keyid(DIR_ENCRYPT, (unsigned char *)"\0", 1, 1);
- break;
-
- case FB64_IV_BAD:
- bzero(fbp->temp_feed, sizeof(Block));
- fb64_stream_iv(fbp->temp_feed, &fbp->streams[DIR_ENCRYPT-1]);
- state = FAILED;
- break;
-
- default:
- if (encrypt_debug_mode) {
- printf("Unknown option type: %d\r\n", data[-1]);
- printd(data, cnt);
- printf("\r\n");
- }
- /* FALL THROUGH */
- failure:
- state = FAILED;
- break;
- }
- return(fbp->state[DIR_ENCRYPT-1] = state);
-}
-
- void
-cfb64_session(key, server)
- Session_Key *key;
- int server;
-{
- fb64_session(key, server, &fb[CFB]);
-}
-
- void
-ofb64_session(key, server)
- Session_Key *key;
- int server;
-{
- fb64_session(key, server, &fb[OFB]);
-}
-
- static void
-fb64_session(key, server, fbp)
- Session_Key *key;
- int server;
- struct fb *fbp;
-{
-
- if (!key || key->type != SK_DES) {
- if (encrypt_debug_mode)
- printf("Can't set krbdes's session key (%d != %d)\r\n",
- key ? key->type : -1, SK_DES);
- return;
- }
- bcopy((void *)key->data, (void *)fbp->krbdes_key, sizeof(Block));
-
- fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
- fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
-
- if (fbp->once == 0) {
- des_set_random_generator_seed(fbp->krbdes_key);
- fbp->once = 1;
- }
- des_key_sched(fbp->krbdes_key, fbp->krbdes_sched);
- /*
- * Now look to see if krbdes_start() was was waiting for
- * the key to show up. If so, go ahead an call it now
- * that we have the key.
- */
- if (fbp->need_start) {
- fbp->need_start = 0;
- fb64_start(fbp, DIR_ENCRYPT, server);
- }
-}
-
-/*
- * We only accept a keyid of 0. If we get a keyid of
- * 0, then mark the state as SUCCESS.
- */
- int
-cfb64_keyid(dir, kp, lenp)
- int dir, *lenp;
- unsigned char *kp;
-{
- return(fb64_keyid(dir, kp, lenp, &fb[CFB]));
-}
-
- int
-ofb64_keyid(dir, kp, lenp)
- int dir, *lenp;
- unsigned char *kp;
-{
- return(fb64_keyid(dir, kp, lenp, &fb[OFB]));
-}
-
- int
-fb64_keyid(dir, kp, lenp, fbp)
- int dir, *lenp;
- unsigned char *kp;
- struct fb *fbp;
-{
- register int state = fbp->state[dir-1];
-
- if (*lenp != 1 || (*kp != '\0')) {
- *lenp = 0;
- return(state);
- }
-
- if (state == FAILED)
- state = IN_PROGRESS;
-
- state &= ~NO_KEYID;
-
- return(fbp->state[dir-1] = state);
-}
-
- void
-fb64_printsub(data, cnt, buf, buflen, type)
- unsigned char *data, *buf, *type;
- int cnt, buflen;
-{
- char lbuf[32];
- register int i;
- char *cp;
-
- buf[buflen-1] = '\0'; /* make sure it's NULL terminated */
- buflen -= 1;
-
- switch(data[2]) {
- case FB64_IV:
- sprintf(lbuf, "%s_IV", type);
- cp = lbuf;
- goto common;
-
- case FB64_IV_OK:
- sprintf(lbuf, "%s_IV_OK", type);
- cp = lbuf;
- goto common;
-
- case FB64_IV_BAD:
- sprintf(lbuf, "%s_IV_BAD", type);
- cp = lbuf;
- goto common;
-
- default:
- sprintf(lbuf, " %d (unknown)", data[2]);
- cp = lbuf;
- common:
- for (; (buflen > 0) && (*buf = *cp++); buf++)
- buflen--;
- for (i = 3; i < cnt; i++) {
- sprintf(lbuf, " %d", data[i]);
- for (cp = lbuf; (buflen > 0) && (*buf = *cp++); buf++)
- buflen--;
- }
- break;
- }
-}
-
- void
-cfb64_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- fb64_printsub(data, cnt, buf, buflen, "CFB64");
-}
-
- void
-ofb64_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- fb64_printsub(data, cnt, buf, buflen, "OFB64");
-}
-
- void
-fb64_stream_iv(seed, stp)
- Block seed;
- register struct stinfo *stp;
-{
-
- bcopy((void *)seed, (void *)stp->str_iv, sizeof(Block));
- bcopy((void *)seed, (void *)stp->str_output, sizeof(Block));
-
- des_key_sched(stp->str_ikey, stp->str_sched);
-
- stp->str_index = sizeof(Block);
-}
-
- void
-fb64_stream_key(key, stp)
- Block key;
- register struct stinfo *stp;
-{
- bcopy((void *)key, (void *)stp->str_ikey, sizeof(Block));
- des_key_sched(key, stp->str_sched);
-
- bcopy((void *)stp->str_iv, (void *)stp->str_output, sizeof(Block));
-
- stp->str_index = sizeof(Block);
-}
-
-/*
- * DES 64 bit Cipher Feedback
- *
- * key --->+-----+
- * +->| DES |--+
- * | +-----+ |
- * | v
- * INPUT --(--------->(+)+---> DATA
- * | |
- * +-------------+
- *
- *
- * Given:
- * iV: Initial vector, 64 bits (8 bytes) long.
- * Dn: the nth chunk of 64 bits (8 bytes) of data to encrypt (decrypt).
- * On: the nth chunk of 64 bits (8 bytes) of encrypted (decrypted) output.
- *
- * V0 = DES(iV, key)
- * On = Dn ^ Vn
- * V(n+1) = DES(On, key)
- */
-
- void
-cfb64_encrypt(s, c)
- register unsigned char *s;
- int c;
-{
- register struct stinfo *stp = &fb[CFB].streams[DIR_ENCRYPT-1];
- register int index;
-
- index = stp->str_index;
- while (c-- > 0) {
- if (index == sizeof(Block)) {
- Block b;
- des_ecb_encrypt(stp->str_output, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
- index = 0;
- }
-
- /* On encryption, we store (feed ^ data) which is cypher */
- *s = stp->str_output[index] = (stp->str_feed[index] ^ *s);
- s++;
- index++;
- }
- stp->str_index = index;
-}
-
- int
-cfb64_decrypt(data)
- int data;
-{
- register struct stinfo *stp = &fb[CFB].streams[DIR_DECRYPT-1];
- int index;
-
- if (data == -1) {
- /*
- * Back up one byte. It is assumed that we will
- * never back up more than one byte. If we do, this
- * may or may not work.
- */
- if (stp->str_index)
- --stp->str_index;
- return(0);
- }
-
- index = stp->str_index++;
- if (index == sizeof(Block)) {
- Block b;
- des_ecb_encrypt(stp->str_output, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
- stp->str_index = 1; /* Next time will be 1 */
- index = 0; /* But now use 0 */
- }
-
- /* On decryption we store (data) which is cypher. */
- stp->str_output[index] = data;
- return(data ^ stp->str_feed[index]);
-}
-
-/*
- * DES 64 bit Output Feedback
- *
- * key --->+-----+
- * +->| DES |--+
- * | +-----+ |
- * +-----------+
- * v
- * INPUT -------->(+) ----> DATA
- *
- * Given:
- * iV: Initial vector, 64 bits (8 bytes) long.
- * Dn: the nth chunk of 64 bits (8 bytes) of data to encrypt (decrypt).
- * On: the nth chunk of 64 bits (8 bytes) of encrypted (decrypted) output.
- *
- * V0 = DES(iV, key)
- * V(n+1) = DES(Vn, key)
- * On = Dn ^ Vn
- */
- void
-ofb64_encrypt(s, c)
- register unsigned char *s;
- int c;
-{
- register struct stinfo *stp = &fb[OFB].streams[DIR_ENCRYPT-1];
- register int index;
-
- index = stp->str_index;
- while (c-- > 0) {
- if (index == sizeof(Block)) {
- Block b;
- des_ecb_encrypt(stp->str_feed, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
- index = 0;
- }
- *s++ ^= stp->str_feed[index];
- index++;
- }
- stp->str_index = index;
-}
-
- int
-ofb64_decrypt(data)
- int data;
-{
- register struct stinfo *stp = &fb[OFB].streams[DIR_DECRYPT-1];
- int index;
-
- if (data == -1) {
- /*
- * Back up one byte. It is assumed that we will
- * never back up more than one byte. If we do, this
- * may or may not work.
- */
- if (stp->str_index)
- --stp->str_index;
- return(0);
- }
-
- index = stp->str_index++;
- if (index == sizeof(Block)) {
- Block b;
- des_ecb_encrypt(stp->str_feed, b, stp->str_sched, 1);
- bcopy((void *)b, (void *)stp->str_feed, sizeof(Block));
- stp->str_index = 1; /* Next time will be 1 */
- index = 0; /* But now use 0 */
- }
-
- return(data ^ stp->str_feed[index]);
-}
-# endif /* DES_ENCRYPTION */
-# endif /* AUTHENTICATION */
-#endif /* ENCRYPTION */
diff --git a/lib/libtelnet/encrypt.c b/lib/libtelnet/encrypt.c
deleted file mode 100644
index 8662473..0000000
--- a/lib/libtelnet/encrypt.c
+++ /dev/null
@@ -1,999 +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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)encrypt.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#ifdef ENCRYPTION
-
-#define ENCRYPT_NAMES
-#include <arpa/telnet.h>
-
-#include "encrypt.h"
-#include "misc.h"
-
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-/*
- * These functions pointers point to the current routines
- * for encrypting and decrypting data.
- */
-void (*encrypt_output) P((unsigned char *, int));
-int (*decrypt_input) P((int));
-
-int encrypt_debug_mode = 0;
-static int decrypt_mode = 0;
-static int encrypt_mode = 0;
-static int encrypt_verbose = 0;
-static int autoencrypt = 0;
-static int autodecrypt = 0;
-static int havesessionkey = 0;
-static int Server = 0;
-static char *Name = "Noname";
-
-#define typemask(x) ((x) > 0 ? 1 << ((x)-1) : 0)
-
-static long i_support_encrypt = typemask(ENCTYPE_DES_CFB64)
- | typemask(ENCTYPE_DES_OFB64);
-static long i_support_decrypt = typemask(ENCTYPE_DES_CFB64)
- | typemask(ENCTYPE_DES_OFB64);
-static long i_wont_support_encrypt = 0;
-static long i_wont_support_decrypt = 0;
-#define I_SUPPORT_ENCRYPT (i_support_encrypt & ~i_wont_support_encrypt)
-#define I_SUPPORT_DECRYPT (i_support_decrypt & ~i_wont_support_decrypt)
-
-static long remote_supports_encrypt = 0;
-static long remote_supports_decrypt = 0;
-
-static Encryptions encryptions[] = {
-#ifdef DES_ENCRYPTION
- { "DES_CFB64", ENCTYPE_DES_CFB64,
- cfb64_encrypt,
- cfb64_decrypt,
- cfb64_init,
- cfb64_start,
- cfb64_is,
- cfb64_reply,
- cfb64_session,
- cfb64_keyid,
- cfb64_printsub },
- { "DES_OFB64", ENCTYPE_DES_OFB64,
- ofb64_encrypt,
- ofb64_decrypt,
- ofb64_init,
- ofb64_start,
- ofb64_is,
- ofb64_reply,
- ofb64_session,
- ofb64_keyid,
- ofb64_printsub },
-#endif /* DES_ENCRYPTION */
- { 0, },
-};
-
-static unsigned char str_send[64] = { IAC, SB, TELOPT_ENCRYPT,
- ENCRYPT_SUPPORT };
-static unsigned char str_suplen = 0;
-static unsigned char str_start[72] = { IAC, SB, TELOPT_ENCRYPT };
-static unsigned char str_end[] = { IAC, SB, TELOPT_ENCRYPT, 0, IAC, SE };
-
- Encryptions *
-findencryption(type)
- int type;
-{
- Encryptions *ep = encryptions;
-
- if (!(I_SUPPORT_ENCRYPT & remote_supports_decrypt & typemask(type)))
- return(0);
- while (ep->type && ep->type != type)
- ++ep;
- return(ep->type ? ep : 0);
-}
-
- Encryptions *
-finddecryption(type)
- int type;
-{
- Encryptions *ep = encryptions;
-
- if (!(I_SUPPORT_DECRYPT & remote_supports_encrypt & typemask(type)))
- return(0);
- while (ep->type && ep->type != type)
- ++ep;
- return(ep->type ? ep : 0);
-}
-
-#define MAXKEYLEN 64
-
-static struct key_info {
- unsigned char keyid[MAXKEYLEN];
- int keylen;
- int dir;
- int *modep;
- Encryptions *(*getcrypt)();
-} ki[2] = {
- { { 0 }, 0, DIR_ENCRYPT, &encrypt_mode, findencryption },
- { { 0 }, 0, DIR_DECRYPT, &decrypt_mode, finddecryption },
-};
-
- void
-encrypt_init(name, server)
- char *name;
- int server;
-{
- Encryptions *ep = encryptions;
-
- Name = name;
- Server = server;
- i_support_encrypt = i_support_decrypt = 0;
- remote_supports_encrypt = remote_supports_decrypt = 0;
- encrypt_mode = 0;
- decrypt_mode = 0;
- encrypt_output = 0;
- decrypt_input = 0;
-#ifdef notdef
- encrypt_verbose = !server;
-#endif
-
- str_suplen = 4;
-
- while (ep->type) {
- if (encrypt_debug_mode)
- printf(">>>%s: I will support %s\r\n",
- Name, ENCTYPE_NAME(ep->type));
- i_support_encrypt |= typemask(ep->type);
- i_support_decrypt |= typemask(ep->type);
- if ((i_wont_support_decrypt & typemask(ep->type)) == 0)
- if ((str_send[str_suplen++] = ep->type) == IAC)
- str_send[str_suplen++] = IAC;
- if (ep->init)
- (*ep->init)(Server);
- ++ep;
- }
- str_send[str_suplen++] = IAC;
- str_send[str_suplen++] = SE;
-}
-
- void
-encrypt_list_types()
-{
- Encryptions *ep = encryptions;
-
- printf("Valid encryption types:\n");
- while (ep->type) {
- printf("\t%s (%d)\r\n", ENCTYPE_NAME(ep->type), ep->type);
- ++ep;
- }
-}
-
- int
-EncryptEnable(type, mode)
- char *type, *mode;
-{
- if (isprefix(type, "help") || isprefix(type, "?")) {
- printf("Usage: encrypt enable <type> [input|output]\n");
- encrypt_list_types();
- return(0);
- }
- if (EncryptType(type, mode))
- return(EncryptStart(mode));
- return(0);
-}
-
- int
-EncryptDisable(type, mode)
- char *type, *mode;
-{
- register Encryptions *ep;
- int ret = 0;
-
- if (isprefix(type, "help") || isprefix(type, "?")) {
- printf("Usage: encrypt disable <type> [input|output]\n");
- encrypt_list_types();
- } else if ((ep = (Encryptions *)genget(type, encryptions,
- sizeof(Encryptions))) == 0) {
- printf("%s: invalid encryption type\n", type);
- } else if (Ambiguous(ep)) {
- printf("Ambiguous type '%s'\n", type);
- } else {
- if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) {
- if (decrypt_mode == ep->type)
- EncryptStopInput();
- i_wont_support_decrypt |= typemask(ep->type);
- ret = 1;
- }
- if ((mode == 0) || (isprefix(mode, "output"))) {
- if (encrypt_mode == ep->type)
- EncryptStopOutput();
- i_wont_support_encrypt |= typemask(ep->type);
- ret = 1;
- }
- if (ret == 0)
- printf("%s: invalid encryption mode\n", mode);
- }
- return(ret);
-}
-
- int
-EncryptType(type, mode)
- char *type;
- char *mode;
-{
- register Encryptions *ep;
- int ret = 0;
-
- if (isprefix(type, "help") || isprefix(type, "?")) {
- printf("Usage: encrypt type <type> [input|output]\n");
- encrypt_list_types();
- } else if ((ep = (Encryptions *)genget(type, encryptions,
- sizeof(Encryptions))) == 0) {
- printf("%s: invalid encryption type\n", type);
- } else if (Ambiguous(ep)) {
- printf("Ambiguous type '%s'\n", type);
- } else {
- if ((mode == 0) || isprefix(mode, "input")) {
- decrypt_mode = ep->type;
- i_wont_support_decrypt &= ~typemask(ep->type);
- ret = 1;
- }
- if ((mode == 0) || isprefix(mode, "output")) {
- encrypt_mode = ep->type;
- i_wont_support_encrypt &= ~typemask(ep->type);
- ret = 1;
- }
- if (ret == 0)
- printf("%s: invalid encryption mode\n", mode);
- }
- return(ret);
-}
-
- int
-EncryptStart(mode)
- char *mode;
-{
- register int ret = 0;
- if (mode) {
- if (isprefix(mode, "input"))
- return(EncryptStartInput());
- if (isprefix(mode, "output"))
- return(EncryptStartOutput());
- if (isprefix(mode, "help") || isprefix(mode, "?")) {
- printf("Usage: encrypt start [input|output]\n");
- return(0);
- }
- printf("%s: invalid encryption mode 'encrypt start ?' for help\n", mode);
- return(0);
- }
- ret += EncryptStartInput();
- ret += EncryptStartOutput();
- return(ret);
-}
-
- int
-EncryptStartInput()
-{
- if (decrypt_mode) {
- encrypt_send_request_start();
- return(1);
- }
- printf("No previous decryption mode, decryption not enabled\r\n");
- return(0);
-}
-
- int
-EncryptStartOutput()
-{
- if (encrypt_mode) {
- encrypt_start_output(encrypt_mode);
- return(1);
- }
- printf("No previous encryption mode, encryption not enabled\r\n");
- return(0);
-}
-
- int
-EncryptStop(mode)
- char *mode;
-{
- int ret = 0;
- if (mode) {
- if (isprefix(mode, "input"))
- return(EncryptStopInput());
- if (isprefix(mode, "output"))
- return(EncryptStopOutput());
- if (isprefix(mode, "help") || isprefix(mode, "?")) {
- printf("Usage: encrypt stop [input|output]\n");
- return(0);
- }
- printf("%s: invalid encryption mode 'encrypt stop ?' for help\n", mode);
- return(0);
- }
- ret += EncryptStopInput();
- ret += EncryptStopOutput();
- return(ret);
-}
-
- int
-EncryptStopInput()
-{
- encrypt_send_request_end();
- return(1);
-}
-
- int
-EncryptStopOutput()
-{
- encrypt_send_end();
- return(1);
-}
-
- void
-encrypt_display()
-{
- if (encrypt_output)
- printf("Currently encrypting output with %s\r\n",
- ENCTYPE_NAME(encrypt_mode));
- if (decrypt_input)
- printf("Currently decrypting input with %s\r\n",
- ENCTYPE_NAME(decrypt_mode));
-}
-
- int
-EncryptStatus()
-{
- if (encrypt_output)
- printf("Currently encrypting output with %s\r\n",
- ENCTYPE_NAME(encrypt_mode));
- else if (encrypt_mode) {
- printf("Currently output is clear text.\r\n");
- printf("Last encryption mode was %s\r\n",
- ENCTYPE_NAME(encrypt_mode));
- }
- if (decrypt_input) {
- printf("Currently decrypting input with %s\r\n",
- ENCTYPE_NAME(decrypt_mode));
- } else if (decrypt_mode) {
- printf("Currently input is clear text.\r\n");
- printf("Last decryption mode was %s\r\n",
- ENCTYPE_NAME(decrypt_mode));
- }
- return 1;
-}
-
- void
-encrypt_send_support()
-{
- if (str_suplen) {
- /*
- * If the user has requested that decryption start
- * immediatly, then send a "REQUEST START" before
- * we negotiate the type.
- */
- if (!Server && autodecrypt)
- encrypt_send_request_start();
- net_write(str_send, str_suplen);
- printsub('>', &str_send[2], str_suplen - 2);
- str_suplen = 0;
- }
-}
-
- int
-EncryptDebug(on)
- int on;
-{
- if (on < 0)
- encrypt_debug_mode ^= 1;
- else
- encrypt_debug_mode = on;
- printf("Encryption debugging %s\r\n",
- encrypt_debug_mode ? "enabled" : "disabled");
- return(1);
-}
-
- int
-EncryptVerbose(on)
- int on;
-{
- if (on < 0)
- encrypt_verbose ^= 1;
- else
- encrypt_verbose = on;
- printf("Encryption %s verbose\r\n",
- encrypt_verbose ? "is" : "is not");
- return(1);
-}
-
- int
-EncryptAutoEnc(on)
- int on;
-{
- encrypt_auto(on);
- printf("Automatic encryption of output is %s\r\n",
- autoencrypt ? "enabled" : "disabled");
- return(1);
-}
-
- int
-EncryptAutoDec(on)
- int on;
-{
- decrypt_auto(on);
- printf("Automatic decryption of input is %s\r\n",
- autodecrypt ? "enabled" : "disabled");
- return(1);
-}
-
-/*
- * Called when ENCRYPT SUPPORT is received.
- */
- void
-encrypt_support(typelist, cnt)
- unsigned char *typelist;
- int cnt;
-{
- register int type, use_type = 0;
- Encryptions *ep;
-
- /*
- * Forget anything the other side has previously told us.
- */
- remote_supports_decrypt = 0;
-
- while (cnt-- > 0) {
- type = *typelist++;
- if (encrypt_debug_mode)
- printf(">>>%s: He is supporting %s (%d)\r\n",
- Name,
- ENCTYPE_NAME(type), type);
- if ((type < ENCTYPE_CNT) &&
- (I_SUPPORT_ENCRYPT & typemask(type))) {
- remote_supports_decrypt |= typemask(type);
- if (use_type == 0)
- use_type = type;
- }
- }
- if (use_type) {
- ep = findencryption(use_type);
- if (!ep)
- return;
- type = ep->start ? (*ep->start)(DIR_ENCRYPT, Server) : 0;
- if (encrypt_debug_mode)
- printf(">>>%s: (*ep->start)() returned %d\r\n",
- Name, type);
- if (type < 0)
- return;
- encrypt_mode = use_type;
- if (type == 0)
- encrypt_start_output(use_type);
- }
-}
-
- void
-encrypt_is(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Encryptions *ep;
- register int type, ret;
-
- if (--cnt < 0)
- return;
- type = *data++;
- if (type < ENCTYPE_CNT)
- remote_supports_encrypt |= typemask(type);
- if (!(ep = finddecryption(type))) {
- if (encrypt_debug_mode)
- printf(">>>%s: Can't find type %s (%d) for initial negotiation\r\n",
- Name,
- ENCTYPE_NAME_OK(type)
- ? ENCTYPE_NAME(type) : "(unknown)",
- type);
- return;
- }
- if (!ep->is) {
- if (encrypt_debug_mode)
- printf(">>>%s: No initial negotiation needed for type %s (%d)\r\n",
- Name,
- ENCTYPE_NAME_OK(type)
- ? ENCTYPE_NAME(type) : "(unknown)",
- type);
- ret = 0;
- } else {
- ret = (*ep->is)(data, cnt);
- if (encrypt_debug_mode)
- printf("(*ep->is)(%x, %d) returned %s(%d)\n", data, cnt,
- (ret < 0) ? "FAIL " :
- (ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);
- }
- if (ret < 0) {
- autodecrypt = 0;
- } else {
- decrypt_mode = type;
- if (ret == 0 && autodecrypt)
- encrypt_send_request_start();
- }
-}
-
- void
-encrypt_reply(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Encryptions *ep;
- register int ret, type;
-
- if (--cnt < 0)
- return;
- type = *data++;
- if (!(ep = findencryption(type))) {
- if (encrypt_debug_mode)
- printf(">>>%s: Can't find type %s (%d) for initial negotiation\r\n",
- Name,
- ENCTYPE_NAME_OK(type)
- ? ENCTYPE_NAME(type) : "(unknown)",
- type);
- return;
- }
- if (!ep->reply) {
- if (encrypt_debug_mode)
- printf(">>>%s: No initial negotiation needed for type %s (%d)\r\n",
- Name,
- ENCTYPE_NAME_OK(type)
- ? ENCTYPE_NAME(type) : "(unknown)",
- type);
- ret = 0;
- } else {
- ret = (*ep->reply)(data, cnt);
- if (encrypt_debug_mode)
- printf("(*ep->reply)(%x, %d) returned %s(%d)\n",
- data, cnt,
- (ret < 0) ? "FAIL " :
- (ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);
- }
- if (encrypt_debug_mode)
- printf(">>>%s: encrypt_reply returned %d\n", Name, ret);
- if (ret < 0) {
- autoencrypt = 0;
- } else {
- encrypt_mode = type;
- if (ret == 0 && autoencrypt)
- encrypt_start_output(type);
- }
-}
-
-/*
- * Called when a ENCRYPT START command is received.
- */
- void
-encrypt_start(data, cnt)
- unsigned char *data;
- int cnt;
-{
- Encryptions *ep;
-
- if (!decrypt_mode) {
- /*
- * Something is wrong. We should not get a START
- * command without having already picked our
- * decryption scheme. Send a REQUEST-END to
- * attempt to clear the channel...
- */
- printf("%s: Warning, Cannot decrypt input stream!!!\r\n", Name);
- encrypt_send_request_end();
- return;
- }
-
- if (ep = finddecryption(decrypt_mode)) {
- decrypt_input = ep->input;
- if (encrypt_verbose)
- printf("[ Input is now decrypted with type %s ]\r\n",
- ENCTYPE_NAME(decrypt_mode));
- if (encrypt_debug_mode)
- printf(">>>%s: Start to decrypt input with type %s\r\n",
- Name, ENCTYPE_NAME(decrypt_mode));
- } else {
- printf("%s: Warning, Cannot decrypt type %s (%d)!!!\r\n",
- Name,
- ENCTYPE_NAME_OK(decrypt_mode)
- ? ENCTYPE_NAME(decrypt_mode)
- : "(unknown)",
- decrypt_mode);
- encrypt_send_request_end();
- }
-}
-
- void
-encrypt_session_key(key, server)
- Session_Key *key;
- int server;
-{
- Encryptions *ep = encryptions;
-
- havesessionkey = 1;
-
- while (ep->type) {
- if (ep->session)
- (*ep->session)(key, server);
-#ifdef notdef
- if (!encrypt_output && autoencrypt && !server)
- encrypt_start_output(ep->type);
- if (!decrypt_input && autodecrypt && !server)
- encrypt_send_request_start();
-#endif
- ++ep;
- }
-}
-
-/*
- * Called when ENCRYPT END is received.
- */
- void
-encrypt_end()
-{
- decrypt_input = 0;
- if (encrypt_debug_mode)
- printf(">>>%s: Input is back to clear text\r\n", Name);
- if (encrypt_verbose)
- printf("[ Input is now clear text ]\r\n");
-}
-
-/*
- * Called when ENCRYPT REQUEST-END is received.
- */
- void
-encrypt_request_end()
-{
- encrypt_send_end();
-}
-
-/*
- * Called when ENCRYPT REQUEST-START is received. If we receive
- * this before a type is picked, then that indicates that the
- * other side wants us to start encrypting data as soon as we
- * can.
- */
- void
-encrypt_request_start(data, cnt)
- unsigned char *data;
- int cnt;
-{
- if (encrypt_mode == 0) {
- if (Server)
- autoencrypt = 1;
- return;
- }
- encrypt_start_output(encrypt_mode);
-}
-
-static unsigned char str_keyid[(MAXKEYLEN*2)+5] = { IAC, SB, TELOPT_ENCRYPT };
-
-encrypt_enc_keyid(keyid, len)
- unsigned char *keyid;
- int len;
-{
- encrypt_keyid(&ki[1], keyid, len);
-}
-
-encrypt_dec_keyid(keyid, len)
- unsigned char *keyid;
- int len;
-{
- encrypt_keyid(&ki[0], keyid, len);
-}
-
-encrypt_keyid(kp, keyid, len)
- struct key_info *kp;
- unsigned char *keyid;
- int len;
-{
- Encryptions *ep;
- unsigned char *strp, *cp;
- int dir = kp->dir;
- register int ret = 0;
-
- if (!(ep = (*kp->getcrypt)(*kp->modep))) {
- if (len == 0)
- return;
- kp->keylen = 0;
- } else if (len == 0) {
- /*
- * Empty option, indicates a failure.
- */
- if (kp->keylen == 0)
- return;
- kp->keylen = 0;
- if (ep->keyid)
- (void)(*ep->keyid)(dir, kp->keyid, &kp->keylen);
-
- } else if ((len != kp->keylen) || (bcmp(keyid, kp->keyid, len) != 0)) {
- /*
- * Length or contents are different
- */
- kp->keylen = len;
- bcopy(keyid, kp->keyid, len);
- if (ep->keyid)
- (void)(*ep->keyid)(dir, kp->keyid, &kp->keylen);
- } else {
- if (ep->keyid)
- ret = (*ep->keyid)(dir, kp->keyid, &kp->keylen);
- if ((ret == 0) && (dir == DIR_ENCRYPT) && autoencrypt)
- encrypt_start_output(*kp->modep);
- return;
- }
-
- encrypt_send_keyid(dir, kp->keyid, kp->keylen, 0);
-}
-
- void
-encrypt_send_keyid(dir, keyid, keylen, saveit)
- int dir;
- unsigned char *keyid;
- int keylen;
- int saveit;
-{
- unsigned char *strp;
-
- str_keyid[3] = (dir == DIR_ENCRYPT)
- ? ENCRYPT_ENC_KEYID : ENCRYPT_DEC_KEYID;
- if (saveit) {
- struct key_info *kp = &ki[(dir == DIR_ENCRYPT) ? 0 : 1];
- bcopy(keyid, kp->keyid, keylen);
- kp->keylen = keylen;
- }
-
- for (strp = &str_keyid[4]; keylen > 0; --keylen) {
- if ((*strp++ = *keyid++) == IAC)
- *strp++ = IAC;
- }
- *strp++ = IAC;
- *strp++ = SE;
- net_write(str_keyid, strp - str_keyid);
- printsub('>', &str_keyid[2], strp - str_keyid - 2);
-}
-
- void
-encrypt_auto(on)
- int on;
-{
- if (on < 0)
- autoencrypt ^= 1;
- else
- autoencrypt = on ? 1 : 0;
-}
-
- void
-decrypt_auto(on)
- int on;
-{
- if (on < 0)
- autodecrypt ^= 1;
- else
- autodecrypt = on ? 1 : 0;
-}
-
- void
-encrypt_start_output(type)
- int type;
-{
- Encryptions *ep;
- register unsigned char *p;
- register int i;
-
- if (!(ep = findencryption(type))) {
- if (encrypt_debug_mode) {
- printf(">>>%s: Can't encrypt with type %s (%d)\r\n",
- Name,
- ENCTYPE_NAME_OK(type)
- ? ENCTYPE_NAME(type) : "(unknown)",
- type);
- }
- return;
- }
- if (ep->start) {
- i = (*ep->start)(DIR_ENCRYPT, Server);
- if (encrypt_debug_mode) {
- printf(">>>%s: Encrypt start: %s (%d) %s\r\n",
- Name,
- (i < 0) ? "failed" :
- "initial negotiation in progress",
- i, ENCTYPE_NAME(type));
- }
- if (i)
- return;
- }
- p = str_start + 3;
- *p++ = ENCRYPT_START;
- for (i = 0; i < ki[0].keylen; ++i) {
- if ((*p++ = ki[0].keyid[i]) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- net_write(str_start, p - str_start);
- net_encrypt();
- printsub('>', &str_start[2], p - &str_start[2]);
- /*
- * If we are already encrypting in some mode, then
- * encrypt the ring (which includes our request) in
- * the old mode, mark it all as "clear text" and then
- * switch to the new mode.
- */
- encrypt_output = ep->output;
- encrypt_mode = type;
- if (encrypt_debug_mode)
- printf(">>>%s: Started to encrypt output with type %s\r\n",
- Name, ENCTYPE_NAME(type));
- if (encrypt_verbose)
- printf("[ Output is now encrypted with type %s ]\r\n",
- ENCTYPE_NAME(type));
-}
-
- void
-encrypt_send_end()
-{
- if (!encrypt_output)
- return;
-
- str_end[3] = ENCRYPT_END;
- net_write(str_end, sizeof(str_end));
- net_encrypt();
- printsub('>', &str_end[2], sizeof(str_end) - 2);
- /*
- * Encrypt the output buffer now because it will not be done by
- * netflush...
- */
- encrypt_output = 0;
- if (encrypt_debug_mode)
- printf(">>>%s: Output is back to clear text\r\n", Name);
- if (encrypt_verbose)
- printf("[ Output is now clear text ]\r\n");
-}
-
- void
-encrypt_send_request_start()
-{
- register unsigned char *p;
- register int i;
-
- p = &str_start[3];
- *p++ = ENCRYPT_REQSTART;
- for (i = 0; i < ki[1].keylen; ++i) {
- if ((*p++ = ki[1].keyid[i]) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- net_write(str_start, p - str_start);
- printsub('>', &str_start[2], p - &str_start[2]);
- if (encrypt_debug_mode)
- printf(">>>%s: Request input to be encrypted\r\n", Name);
-}
-
- void
-encrypt_send_request_end()
-{
- str_end[3] = ENCRYPT_REQEND;
- net_write(str_end, sizeof(str_end));
- printsub('>', &str_end[2], sizeof(str_end) - 2);
-
- if (encrypt_debug_mode)
- printf(">>>%s: Request input to be clear text\r\n", Name);
-}
-
- void
-encrypt_wait()
-{
- register int encrypt, decrypt;
- if (encrypt_debug_mode)
- printf(">>>%s: in encrypt_wait\r\n", Name);
- if (!havesessionkey || !(I_SUPPORT_ENCRYPT & remote_supports_decrypt))
- return;
- while (autoencrypt && !encrypt_output)
- if (telnet_spin())
- return;
-}
-
- void
-encrypt_debug(mode)
- int mode;
-{
- encrypt_debug_mode = mode;
-}
-
- void
-encrypt_gen_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- char tbuf[16], *cp;
-
- cnt -= 2;
- data += 2;
- buf[buflen-1] = '\0';
- buf[buflen-2] = '*';
- buflen -= 2;;
- for (; cnt > 0; cnt--, data++) {
- sprintf(tbuf, " %d", *data);
- for (cp = tbuf; *cp && buflen > 0; --buflen)
- *buf++ = *cp++;
- if (buflen <= 0)
- return;
- }
- *buf = '\0';
-}
-
- void
-encrypt_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- Encryptions *ep;
- register int type = data[1];
-
- for (ep = encryptions; ep->type && ep->type != type; ep++)
- ;
-
- if (ep->printsub)
- (*ep->printsub)(data, cnt, buf, buflen);
- else
- encrypt_gen_printsub(data, cnt, buf, buflen);
-}
-#endif /* ENCRYPTION */
diff --git a/lib/libtelnet/encrypt.h b/lib/libtelnet/encrypt.h
deleted file mode 100644
index e0ae385..0000000
--- a/lib/libtelnet/encrypt.h
+++ /dev/null
@@ -1,108 +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.
- *
- * @(#)encrypt.h 8.1 (Berkeley) 6/4/93
- */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#ifdef ENCRYPTION
-# ifndef __ENCRYPTION__
-# define __ENCRYPTION__
-
-#define DIR_DECRYPT 1
-#define DIR_ENCRYPT 2
-
-typedef unsigned char Block[8];
-typedef unsigned char *BlockT;
-typedef struct { Block _; } Schedule[16];
-
-#define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \
- key[4] | key[5] | key[6] | key[7])
-
-#define SAMEKEY(k1, k2) (!bcmp((void *)k1, (void *)k2, sizeof(Block)))
-
-typedef struct {
- short type;
- int length;
- unsigned char *data;
-} Session_Key;
-
-# if !defined(P)
-# ifdef __STDC__
-# define P(x) x
-# else
-# define P(x) ()
-# endif
-# endif
-
-typedef struct {
- char *name;
- int type;
- void (*output) P((unsigned char *, int));
- int (*input) P((int));
- void (*init) P((int));
- int (*start) P((int, int));
- int (*is) P((unsigned char *, int));
- int (*reply) P((unsigned char *, int));
- void (*session) P((Session_Key *, int));
- int (*keyid) P((int, unsigned char *, int *));
- void (*printsub) P((unsigned char *, int, unsigned char *, int));
-} Encryptions;
-
-#define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */
-
-#include "enc-proto.h"
-
-extern int encrypt_debug_mode;
-extern int (*decrypt_input) P((int));
-extern void (*encrypt_output) P((unsigned char *, int));
-# endif /* __ENCRYPTION__ */
-#endif /* ENCRYPTION */
diff --git a/lib/libtelnet/kerberos.c b/lib/libtelnet/kerberos.c
deleted file mode 100644
index aa9b418..0000000
--- a/lib/libtelnet/kerberos.c
+++ /dev/null
@@ -1,554 +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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)kerberos.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#ifdef KRB4
-#include <sys/types.h>
-#include <arpa/telnet.h>
-#include <stdio.h>
-#include <des.h> /* BSD wont include this in krb.h, so we do it here */
-#include <krb.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-#include "encrypt.h"
-#include "auth.h"
-#include "misc.h"
-
-int kerberos4_cksum P((unsigned char *, int));
-int krb_mk_req P((KTEXT, char *, char *, char *, u_long));
-int krb_rd_req P((KTEXT, char *, char *, u_long, AUTH_DAT *, char *));
-int krb_kntoln P((AUTH_DAT *, char *));
-int krb_get_cred P((char *, char *, char *, CREDENTIALS *));
-int krb_get_lrealm P((char *, int));
-int kuserok P((AUTH_DAT *, char *));
-
-extern auth_debug_mode;
-
-static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
- AUTHTYPE_KERBEROS_V4, };
-static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
- TELQUAL_NAME, };
-
-#define KRB_AUTH 0 /* Authentication data follows */
-#define KRB_REJECT 1 /* Rejected (reason might follow) */
-#define KRB_ACCEPT 2 /* Accepted */
-#define KRB_CHALLENGE 3 /* Challenge for mutual auth. */
-#define KRB_RESPONSE 4 /* Response for mutual auth. */
-
-#define KRB_SERVICE_NAME "rcmd"
-
-static KTEXT_ST auth;
-static char name[ANAME_SZ];
-static AUTH_DAT adat = { 0 };
-#ifdef ENCRYPTION
-static Block session_key = { 0 };
-static Schedule sched;
-static Block challenge = { 0 };
-#endif /* ENCRYPTION */
-
- static int
-Data(ap, type, d, c)
- Authenticator *ap;
- int type;
- void *d;
- int c;
-{
- unsigned char *p = str_data + 4;
- unsigned char *cd = (unsigned char *)d;
-
- if (c == -1)
- c = strlen((char *)cd);
-
- if (auth_debug_mode) {
- printf("%s:%d: [%d] (%d)",
- str_data[3] == TELQUAL_IS ? ">>>IS" : ">>>REPLY",
- str_data[3],
- type, c);
- printd(d, c);
- printf("\r\n");
- }
- *p++ = ap->type;
- *p++ = ap->way;
- *p++ = type;
- while (c-- > 0) {
- if ((*p++ = *cd++) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- if (str_data[3] == TELQUAL_IS)
- printsub('>', &str_data[2], p - (&str_data[2]));
- return(net_write(str_data, p - str_data));
-}
-
- int
-kerberos4_init(ap, server)
- Authenticator *ap;
- int server;
-{
- FILE *fp;
-
- if (server) {
- str_data[3] = TELQUAL_REPLY;
- if ((fp = fopen(KEYFILE, "r")) == NULL)
- return(0);
- fclose(fp);
- } else {
- str_data[3] = TELQUAL_IS;
- }
- return(1);
-}
-
-char dst_realm_buf[REALM_SZ], *dest_realm = NULL;
-int dst_realm_sz = REALM_SZ;
-
- int
-kerberos4_send(ap)
- Authenticator *ap;
-{
- KTEXT_ST auth;
-#ifdef ENCRYPTION
- Block enckey;
-#endif /* ENCRYPTION */
- char instance[INST_SZ];
- char *realm;
- char *krb_realmofhost();
- char *krb_get_phost();
- CREDENTIALS cred;
- int r;
-
- printf("[ Trying KERBEROS4 ... ]\n");
- if (!UserNameRequested) {
- if (auth_debug_mode) {
- printf("Kerberos V4: no user name supplied\r\n");
- }
- return(0);
- }
-
- bzero(instance, sizeof(instance));
-
- if (realm = krb_get_phost(RemoteHostName))
- strncpy(instance, realm, sizeof(instance));
-
- instance[sizeof(instance)-1] = '\0';
-
- realm = dest_realm ? dest_realm : krb_realmofhost(RemoteHostName);
-
- if (!realm) {
- printf("Kerberos V4: no realm for %s\r\n", RemoteHostName);
- return(0);
- }
- if (r = krb_mk_req(&auth, KRB_SERVICE_NAME, instance, realm, 0L)) {
- printf("mk_req failed: %s\r\n", krb_err_txt[r]);
- return(0);
- }
- if (r = krb_get_cred(KRB_SERVICE_NAME, instance, realm, &cred)) {
- printf("get_cred failed: %s\r\n", krb_err_txt[r]);
- return(0);
- }
- if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) {
- if (auth_debug_mode)
- printf("Not enough room for user name\r\n");
- return(0);
- }
- if (auth_debug_mode)
- printf("Sent %d bytes of authentication data\r\n", auth.length);
- if (!Data(ap, KRB_AUTH, (void *)auth.dat, auth.length)) {
- if (auth_debug_mode)
- printf("Not enough room for authentication data\r\n");
- return(0);
- }
-#ifdef ENCRYPTION
- /*
- * If we are doing mutual authentication, get set up to send
- * the challenge, and verify it when the response comes back.
- */
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
- register int i;
-
- des_key_sched(cred.session, sched);
- des_set_random_generator_seed(cred.session);
- des_new_random_key(challenge);
- des_ecb_encrypt(challenge, session_key, sched, 1);
- /*
- * Increment the challenge by 1, and encrypt it for
- * later comparison.
- */
- for (i = 7; i >= 0; --i) {
- register int x;
- x = (unsigned int)challenge[i] + 1;
- challenge[i] = x; /* ignore overflow */
- if (x < 256) /* if no overflow, all done */
- break;
- }
- des_ecb_encrypt(challenge, challenge, sched, 1);
- }
-#endif /* ENCRYPTION */
-
- if (auth_debug_mode) {
- printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length));
- printd(auth.dat, auth.length);
- printf("\r\n");
- printf("Sent Kerberos V4 credentials to server\r\n");
- }
- return(1);
-}
-
- void
-kerberos4_is(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
-#ifdef ENCRYPTION
- Session_Key skey;
- Block datablock;
-#endif /* ENCRYPTION */
- char realm[REALM_SZ];
- char instance[INST_SZ];
- int r;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case KRB_AUTH:
- if (krb_get_lrealm(realm, 1) != KSUCCESS) {
- Data(ap, KRB_REJECT, (void *)"No local V4 Realm.", -1);
- auth_finished(ap, AUTH_REJECT);
- if (auth_debug_mode)
- printf("No local realm\r\n");
- return;
- }
- bcopy((void *)data, (void *)auth.dat, auth.length = cnt);
- if (auth_debug_mode) {
- printf("Got %d bytes of authentication data\r\n", cnt);
- printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length));
- printd(auth.dat, auth.length);
- printf("\r\n");
- }
- instance[0] = '*'; instance[1] = 0;
- if (r = krb_rd_req(&auth, KRB_SERVICE_NAME,
- instance, 0, &adat, "")) {
- if (auth_debug_mode)
- printf("Kerberos failed him as %s\r\n", name);
- Data(ap, KRB_REJECT, (void *)krb_err_txt[r], -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-#ifdef ENCRYPTION
- bcopy((void *)adat.session, (void *)session_key, sizeof(Block));
-#endif /* ENCRYPTION */
- krb_kntoln(&adat, name);
-
- if (UserNameRequested && !kuserok(&adat, UserNameRequested))
- Data(ap, KRB_ACCEPT, (void *)0, 0);
- else
- Data(ap, KRB_REJECT,
- (void *)"user is not authorized", -1);
- auth_finished(ap, AUTH_USER);
- break;
-
- case KRB_CHALLENGE:
-#ifndef ENCRYPTION
- Data(ap, KRB_RESPONSE, (void *)0, 0);
-#else /* ENCRYPTION */
- if (!VALIDKEY(session_key)) {
- /*
- * We don't have a valid session key, so just
- * send back a response with an empty session
- * key.
- */
- Data(ap, KRB_RESPONSE, (void *)0, 0);
- break;
- }
-
- des_key_sched(session_key, sched);
- bcopy((void *)data, (void *)datablock, sizeof(Block));
- /*
- * Take the received encrypted challenge, and encrypt
- * it again to get a unique session_key for the
- * ENCRYPT option.
- */
- des_ecb_encrypt(datablock, session_key, sched, 1);
- skey.type = SK_DES;
- skey.length = 8;
- skey.data = session_key;
- encrypt_session_key(&skey, 1);
- /*
- * Now decrypt the received encrypted challenge,
- * increment by one, re-encrypt it and send it back.
- */
- des_ecb_encrypt(datablock, challenge, sched, 0);
- for (r = 7; r >= 0; r++) {
- register int t;
- t = (unsigned int)challenge[r] + 1;
- challenge[r] = t; /* ignore overflow */
- if (t < 256) /* if no overflow, all done */
- break;
- }
- des_ecb_encrypt(challenge, challenge, sched, 1);
- Data(ap, KRB_RESPONSE, (void *)challenge, sizeof(challenge));
-#endif /* ENCRYPTION */
- break;
-
- default:
- if (auth_debug_mode)
- printf("Unknown Kerberos option %d\r\n", data[-1]);
- Data(ap, KRB_REJECT, 0, 0);
- break;
- }
-}
-
- void
-kerberos4_reply(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
-#ifdef ENCRYPTION
- Session_Key skey;
-#endif /* ENCRYPTION */
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case KRB_REJECT:
- if (cnt > 0) {
- printf("[ Kerberos V4 refuses authentication because %.*s ]\r\n",
- cnt, data);
- } else
- printf("[ Kerberos V4 refuses authentication ]\r\n");
- auth_send_retry();
- return;
- case KRB_ACCEPT:
- printf("[ Kerberos V4 accepts you ]\n");
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
- /*
- * Send over the encrypted challenge.
- */
-#ifndef ENCRYPTION
- Data(ap, KRB_CHALLENGE, (void *)0, 0);
-#else /* ENCRYPTION */
- Data(ap, KRB_CHALLENGE, (void *)session_key,
- sizeof(session_key));
- des_ecb_encrypt(session_key, session_key, sched, 1);
- skey.type = SK_DES;
- skey.length = 8;
- skey.data = session_key;
- encrypt_session_key(&skey, 0);
-#endif /* ENCRYPTION */
- return;
- }
- auth_finished(ap, AUTH_USER);
- return;
- case KRB_RESPONSE:
-#ifdef ENCRYPTION
- /*
- * Verify that the response to the challenge is correct.
- */
- if ((cnt != sizeof(Block)) ||
- (0 != memcmp((void *)data, (void *)challenge,
- sizeof(challenge))))
- {
-#endif /* ENCRYPTION */
- printf("[ Kerberos V4 challenge failed!!! ]\r\n");
- auth_send_retry();
- return;
-#ifdef ENCRYPTION
- }
- printf("[ Kerberos V4 challenge successful ]\r\n");
- auth_finished(ap, AUTH_USER);
-#endif /* ENCRYPTION */
- break;
- default:
- if (auth_debug_mode)
- printf("Unknown Kerberos option %d\r\n", data[-1]);
- return;
- }
-}
-
- int
-kerberos4_status(ap, name, level)
- Authenticator *ap;
- char *name;
- int level;
-{
- if (level < AUTH_USER)
- return(level);
-
- if (UserNameRequested && !kuserok(&adat, UserNameRequested)) {
- strcpy(name, UserNameRequested);
- return(AUTH_VALID);
- } else
- return(AUTH_USER);
-}
-
-#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
-#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
-
- void
-kerberos4_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- char lbuf[32];
- register int i;
-
- buf[buflen-1] = '\0'; /* make sure its NULL terminated */
- buflen -= 1;
-
- switch(data[3]) {
- case KRB_REJECT: /* Rejected (reason might follow) */
- strncpy((char *)buf, " REJECT ", buflen);
- goto common;
-
- case KRB_ACCEPT: /* Accepted (name might follow) */
- strncpy((char *)buf, " ACCEPT ", buflen);
- common:
- BUMP(buf, buflen);
- if (cnt <= 4)
- break;
- ADDC(buf, buflen, '"');
- for (i = 4; i < cnt; i++)
- ADDC(buf, buflen, data[i]);
- ADDC(buf, buflen, '"');
- ADDC(buf, buflen, '\0');
- break;
-
- case KRB_AUTH: /* Authentication data follows */
- strncpy((char *)buf, " AUTH", buflen);
- goto common2;
-
- case KRB_CHALLENGE:
- strncpy((char *)buf, " CHALLENGE", buflen);
- goto common2;
-
- case KRB_RESPONSE:
- strncpy((char *)buf, " RESPONSE", buflen);
- goto common2;
-
- default:
- sprintf(lbuf, " %d (unknown)", data[3]);
- strncpy((char *)buf, lbuf, buflen);
- common2:
- BUMP(buf, buflen);
- for (i = 4; i < cnt; i++) {
- sprintf(lbuf, " %d", data[i]);
- strncpy((char *)buf, lbuf, buflen);
- BUMP(buf, buflen);
- }
- break;
- }
-}
-
- int
-kerberos4_cksum(d, n)
- unsigned char *d;
- int n;
-{
- int ck = 0;
-
- /*
- * A comment is probably needed here for those not
- * well versed in the "C" language. Yes, this is
- * supposed to be a "switch" with the body of the
- * "switch" being a "while" statement. The whole
- * purpose of the switch is to allow us to jump into
- * the middle of the while() loop, and then not have
- * to do any more switch()s.
- *
- * Some compilers will spit out a warning message
- * about the loop not being entered at the top.
- */
- switch (n&03)
- while (n > 0) {
- case 0:
- ck ^= (int)*d++ << 24;
- --n;
- case 3:
- ck ^= (int)*d++ << 16;
- --n;
- case 2:
- ck ^= (int)*d++ << 8;
- --n;
- case 1:
- ck ^= (int)*d++;
- --n;
- }
- return(ck);
-}
-#endif
-
-#ifdef notdef
-
-prkey(msg, key)
- char *msg;
- unsigned char *key;
-{
- register int i;
- printf("%s:", msg);
- for (i = 0; i < 8; i++)
- printf(" %3d", key[i]);
- printf("\r\n");
-}
-#endif
diff --git a/lib/libtelnet/kerberos5.c b/lib/libtelnet/kerberos5.c
deleted file mode 100644
index d57fba3..0000000
--- a/lib/libtelnet/kerberos5.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/*
- * $Source: /mit/krb5/.cvsroot/src/appl/telnet/libtelnet/kerberos5.c,v $
- * $Author: tytso $
- * $Id: kerberos5.c,v 5.3 1993/09/01 03:00:12 tytso Exp $
- */
-
-#if !defined(lint) && !defined(SABER)
-static
-#ifdef __STDC__
-const
-#endif
-char rcsid_kerberos5_c[] = "$Id: kerberos5.c,v 5.3 1993/09/01 03:00:12 tytso Exp $";
-#endif /* lint */
-
-/*-
- * 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)kerberos5.c 8.2 (Berkeley) 12/15/93";
-#endif /* not lint */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America may
- * require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-
-#ifdef KRB5
-#include <arpa/telnet.h>
-#include <stdio.h>
-#include <krb5/krb5.h>
-#include <krb5/asn1.h>
-#include <krb5/crc-32.h>
-#include <krb5/los-proto.h>
-#include <krb5/ext-proto.h>
-#include <com_err.h>
-#include <netdb.h>
-#include <ctype.h>
-
-/* kerberos 5 include files (ext-proto.h) will get an appropriate stdlib.h
- and string.h/strings.h */
-
-#include "encrypt.h"
-#include "auth.h"
-#include "misc.h"
-
-extern auth_debug_mode;
-
-#ifdef FORWARD
-int forward_flags = 0; /* Flags get set in telnet/main.c on -f and -F */
-
-/* These values need to be the same as those defined in telnet/main.c. */
-/* Either define them in both places, or put in some common header file. */
-#define OPTS_FORWARD_CREDS 0x00000002
-#define OPTS_FORWARDABLE_CREDS 0x00000001
-
-void kerberos5_forward();
-
-#endif /* FORWARD */
-
-static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
- AUTHTYPE_KERBEROS_V5, };
-/*static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
- TELQUAL_NAME, };*/
-
-#define KRB_AUTH 0 /* Authentication data follows */
-#define KRB_REJECT 1 /* Rejected (reason might follow) */
-#define KRB_ACCEPT 2 /* Accepted */
-#define KRB_RESPONSE 3 /* Response for mutual auth. */
-
-#ifdef FORWARD
-#define KRB_FORWARD 4 /* Forwarded credentials follow */
-#define KRB_FORWARD_ACCEPT 5 /* Forwarded credentials accepted */
-#define KRB_FORWARD_REJECT 6 /* Forwarded credentials rejected */
-#endif /* FORWARD */
-
-static krb5_data auth;
- /* telnetd gets session key from here */
-static krb5_tkt_authent *authdat = NULL;
-/* telnet matches the AP_REQ and AP_REP with this */
-static krb5_authenticator authenticator;
-
-/* some compilers can't hack void *, so we use the Kerberos krb5_pointer,
- which is either void * or char *, depending on the compiler. */
-
-#define Voidptr krb5_pointer
-
-Block session_key;
-
- static int
-Data(ap, type, d, c)
- Authenticator *ap;
- int type;
- Voidptr d;
- int c;
-{
- unsigned char *p = str_data + 4;
- unsigned char *cd = (unsigned char *)d;
-
- if (c == -1)
- c = strlen((char *)cd);
-
- if (auth_debug_mode) {
- printf("%s:%d: [%d] (%d)",
- str_data[3] == TELQUAL_IS ? ">>>IS" : ">>>REPLY",
- str_data[3],
- type, c);
- printd(d, c);
- printf("\r\n");
- }
- *p++ = ap->type;
- *p++ = ap->way;
- *p++ = type;
- while (c-- > 0) {
- if ((*p++ = *cd++) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- if (str_data[3] == TELQUAL_IS)
- printsub('>', &str_data[2], p - &str_data[2]);
- return(net_write(str_data, p - str_data));
-}
-
- int
-kerberos5_init(ap, server)
- Authenticator *ap;
- int server;
-{
- if (server)
- str_data[3] = TELQUAL_REPLY;
- else
- str_data[3] = TELQUAL_IS;
- krb5_init_ets();
- return(1);
-}
-
- int
-kerberos5_send(ap)
- Authenticator *ap;
-{
- char **realms;
- char *name;
- char *p1, *p2;
- krb5_checksum ksum;
- krb5_octet sum[CRC32_CKSUM_LENGTH];
- krb5_principal server;
- krb5_error_code r;
- krb5_ccache ccache;
- krb5_creds creds; /* telnet gets session key from here */
- extern krb5_flags krb5_kdc_default_options;
- int ap_opts;
-
-#ifdef ENCRYPTION
- krb5_keyblock *newkey = 0;
-#endif /* ENCRYPTION */
-
- ksum.checksum_type = CKSUMTYPE_CRC32;
- ksum.contents = sum;
- ksum.length = sizeof(sum);
- bzero((Voidptr )sum, sizeof(sum));
-
- if (!UserNameRequested) {
- if (auth_debug_mode) {
- printf("Kerberos V5: no user name supplied\r\n");
- }
- return(0);
- }
-
- if (r = krb5_cc_default(&ccache)) {
- if (auth_debug_mode) {
- printf("Kerberos V5: could not get default ccache\r\n");
- }
- return(0);
- }
-
- if ((name = malloc(strlen(RemoteHostName)+1)) == NULL) {
- if (auth_debug_mode)
- printf("Out of memory for hostname in Kerberos V5\r\n");
- return(0);
- }
-
- if (r = krb5_get_host_realm(RemoteHostName, &realms)) {
- if (auth_debug_mode)
- printf("Kerberos V5: no realm for %s\r\n", RemoteHostName);
- free(name);
- return(0);
- }
-
- p1 = RemoteHostName;
- p2 = name;
-
- while (*p2 = *p1++) {
- if (isupper(*p2))
- *p2 |= 040;
- ++p2;
- }
-
- if (r = krb5_build_principal_ext(&server,
- strlen(realms[0]), realms[0],
- 4, "host",
- p2 - name, name,
- 0)) {
- if (auth_debug_mode) {
- printf("Kerberos V5: failure setting up principal (%s)\r\n",
- error_message(r));
- }
- free(name);
- krb5_free_host_realm(realms);
- return(0);
- }
-
-
- bzero((char *)&creds, sizeof(creds));
- creds.server = server;
-
- if (r = krb5_cc_get_principal(ccache, &creds.client)) {
- if (auth_debug_mode) {
- printf("Kerberos V5: failure on principal (%s)\r\n",
- error_message(r));
- }
- free(name);
- krb5_free_principal(server);
- krb5_free_host_realm(realms);
- return(0);
- }
-
- if (r = krb5_get_credentials(krb5_kdc_default_options, ccache, &creds)) {
- if (auth_debug_mode) {
- printf("Kerberos V5: failure on credentials(%d)\r\n",r);
- }
- free(name);
- krb5_free_host_realm(realms);
- krb5_free_principal(server);
- return(0);
- }
-
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL)
- ap_opts = AP_OPTS_MUTUAL_REQUIRED;
- else
- ap_opts = 0;
-
- r = krb5_mk_req_extended(ap_opts, &ksum, krb5_kdc_default_options, 0,
-#ifdef ENCRYPTION
- &newkey,
-#else /* ENCRYPTION */
- 0,
-#endif /* ENCRYPTION */
- ccache, &creds, &authenticator, &auth);
- /* don't let the key get freed if we clean up the authenticator */
- authenticator.subkey = 0;
-
- free(name);
- krb5_free_host_realm(realms);
- krb5_free_principal(server);
-#ifdef ENCRYPTION
- if (newkey) {
- /* keep the key in our private storage, but don't use it
- yet---see kerberos5_reply() below */
- if (newkey->keytype != KEYTYPE_DES) {
- if (creds.keyblock.keytype == KEYTYPE_DES)
- /* use the session key in credentials instead */
- memcpy((char *)session_key,
- (char *)creds.keyblock.contents, sizeof(Block));
- else
- /* XXX ? */;
- } else {
- memcpy((char *)session_key, (char *)newkey->contents,
- sizeof(Block));
- }
- krb5_free_keyblock(newkey);
- }
-#endif /* ENCRYPTION */
- if (r) {
- if (auth_debug_mode) {
- printf("Kerberos V5: mk_req failed (%s)\r\n",
- error_message(r));
- }
- return(0);
- }
-
- if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) {
- if (auth_debug_mode)
- printf("Not enough room for user name\r\n");
- return(0);
- }
- if (!Data(ap, KRB_AUTH, auth.data, auth.length)) {
- if (auth_debug_mode)
- printf("Not enough room for authentication data\r\n");
- return(0);
- }
- if (auth_debug_mode) {
- printf("Sent Kerberos V5 credentials to server\r\n");
- }
- return(1);
-}
-
- void
-kerberos5_is(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- int r;
- struct hostent *hp;
- char *p1, *p2;
- static char *realm = NULL;
- krb5_principal server;
- krb5_ap_rep_enc_part reply;
- krb5_data outbuf;
-#ifdef ENCRYPTION
- Session_Key skey;
-#endif /* ENCRYPTION */
- char *name;
- char *getenv();
- krb5_data inbuf;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case KRB_AUTH:
- auth.data = (char *)data;
- auth.length = cnt;
-
- if (!(hp = gethostbyname(LocalHostName))) {
- if (auth_debug_mode)
- printf("Cannot resolve local host name\r\n");
- Data(ap, KRB_REJECT, "Unknown local hostname.", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-
- if (!realm && (krb5_get_default_realm(&realm))) {
- if (auth_debug_mode)
- printf("Could not get default realm\r\n");
- Data(ap, KRB_REJECT, "Could not get default realm.", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-
- if ((name = malloc(strlen(hp->h_name)+1)) == NULL) {
- if (auth_debug_mode)
- printf("Out of memory for hostname in Kerberos V5\r\n");
- Data(ap, KRB_REJECT, "Out of memory.", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-
- p1 = hp->h_name;
- p2 = name;
-
- while (*p2 = *p1++) {
- if (isupper(*p2))
- *p2 |= 040;
- ++p2;
- }
-
- if (authdat)
- krb5_free_tkt_authent(authdat);
-
- r = krb5_build_principal_ext(&server,
- strlen(realm), realm,
- 4, "host",
- p2 - name, name,
- 0);
- if (!r) {
- r = krb5_rd_req_simple(&auth, server, 0, &authdat);
- krb5_free_principal(server);
- }
- if (r) {
- char errbuf[128];
-
- errout:
- authdat = 0;
- (void) strcpy(errbuf, "Read req failed: ");
- (void) strcat(errbuf, error_message(r));
- Data(ap, KRB_REJECT, errbuf, -1);
- if (auth_debug_mode)
- printf("%s\r\n", errbuf);
- return;
- }
- free(name);
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
- /* do ap_rep stuff here */
- reply.ctime = authdat->authenticator->ctime;
- reply.cusec = authdat->authenticator->cusec;
- reply.subkey = 0; /* use the one he gave us, so don't
- need to return one here */
- reply.seq_number = 0; /* we don't do seq #'s. */
-
- if (r = krb5_mk_rep(&reply,
- authdat->authenticator->subkey ?
- authdat->authenticator->subkey :
- authdat->ticket->enc_part2->session,
- &outbuf)) {
- goto errout;
- }
- Data(ap, KRB_RESPONSE, outbuf.data, outbuf.length);
- }
- if (krb5_unparse_name(authdat->ticket->enc_part2 ->client,
- &name))
- name = 0;
- Data(ap, KRB_ACCEPT, name, name ? -1 : 0);
- if (auth_debug_mode) {
- printf("Kerberos5 identifies him as ``%s''\r\n",
- name ? name : "");
- }
- auth_finished(ap, AUTH_USER);
-
- free(name);
- if (authdat->authenticator->subkey &&
- authdat->authenticator->subkey->keytype == KEYTYPE_DES) {
- bcopy((Voidptr )authdat->authenticator->subkey->contents,
- (Voidptr )session_key, sizeof(Block));
- } else if (authdat->ticket->enc_part2->session->keytype ==
- KEYTYPE_DES) {
- bcopy((Voidptr )authdat->ticket->enc_part2->session->contents,
- (Voidptr )session_key, sizeof(Block));
- } else
- break;
-
-#ifdef ENCRYPTION
- skey.type = SK_DES;
- skey.length = 8;
- skey.data = session_key;
- encrypt_session_key(&skey, 1);
-#endif /* ENCRYPTION */
- break;
-#ifdef FORWARD
- case KRB_FORWARD:
- inbuf.data = (char *)data;
- inbuf.length = cnt;
- if (r = rd_and_store_for_creds(&inbuf, authdat->ticket,
- UserNameRequested)) {
- char errbuf[128];
-
- (void) strcpy(errbuf, "Read forwarded creds failed: ");
- (void) strcat(errbuf, error_message(r));
- Data(ap, KRB_FORWARD_REJECT, errbuf, -1);
- if (auth_debug_mode)
- printf("Could not read forwarded credentials\r\n");
- }
- else
- Data(ap, KRB_FORWARD_ACCEPT, 0, 0);
- if (auth_debug_mode)
- printf("Forwarded credentials obtained\r\n");
- break;
-#endif /* FORWARD */
- default:
- if (auth_debug_mode)
- printf("Unknown Kerberos option %d\r\n", data[-1]);
- Data(ap, KRB_REJECT, 0, 0);
- break;
- }
-}
-
- void
-kerberos5_reply(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
- static int mutual_complete = 0;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case KRB_REJECT:
- if (cnt > 0) {
- printf("[ Kerberos V5 refuses authentication because %.*s ]\r\n",
- cnt, data);
- } else
- printf("[ Kerberos V5 refuses authentication ]\r\n");
- auth_send_retry();
- return;
- case KRB_ACCEPT:
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL &&
- !mutual_complete) {
- printf("[ Kerberos V5 accepted you, but didn't provide mutual authentication! ]\n");
- auth_send_retry();
- return;
- }
- if (cnt)
- printf("[ Kerberos V5 accepts you as ``%.*s'' ]\n", cnt, data);
- else
- printf("[ Kerberos V5 accepts you ]\n");
- auth_finished(ap, AUTH_USER);
-#ifdef FORWARD
- if (forward_flags & OPTS_FORWARD_CREDS)
- kerberos5_forward(ap);
-#endif /* FORWARD */
- break;
- case KRB_RESPONSE:
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
- /* the rest of the reply should contain a krb_ap_rep */
- krb5_ap_rep_enc_part *reply;
- krb5_data inbuf;
- krb5_error_code r;
- krb5_keyblock tmpkey;
-
- inbuf.length = cnt;
- inbuf.data = (char *)data;
-
- tmpkey.keytype = KEYTYPE_DES;
- tmpkey.contents = session_key;
- tmpkey.length = sizeof(Block);
-
- if (r = krb5_rd_rep(&inbuf, &tmpkey, &reply)) {
- printf("[ Mutual authentication failed: %s ]\n",
- error_message(r));
- auth_send_retry();
- return;
- }
- if (reply->ctime != authenticator.ctime ||
- reply->cusec != authenticator.cusec) {
- printf("[ Mutual authentication failed (mismatched KRB_AP_REP) ]\n");
- auth_send_retry();
- return;
- }
- krb5_free_ap_rep_enc_part(reply);
-#ifdef ENCRYPTION
- skey.type = SK_DES;
- skey.length = 8;
- skey.data = session_key;
- encrypt_session_key(&skey, 0);
-#endif /* ENCRYPTION */
- mutual_complete = 1;
- }
- return;
-#ifdef FORWARD
- case KRB_FORWARD_ACCEPT:
- printf("[ Kerberos V5 accepted forwarded credentials ]\n");
- return;
- case KRB_FORWARD_REJECT:
- printf("[ Kerberos V5 refuses forwarded credentials because %.*s ]\r\n",
- cnt, data);
- return;
-#endif /* FORWARD */
- default:
- if (auth_debug_mode)
- printf("Unknown Kerberos option %d\r\n", data[-1]);
- return;
- }
-}
-
- int
-kerberos5_status(ap, name, level)
- Authenticator *ap;
- char *name;
- int level;
-{
- if (level < AUTH_USER)
- return(level);
-
- if (UserNameRequested &&
- krb5_kuserok(authdat->ticket->enc_part2->client, UserNameRequested))
- {
- strcpy(name, UserNameRequested);
- return(AUTH_VALID);
- } else
- return(AUTH_USER);
-}
-
-#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
-#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
-
- void
-kerberos5_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- char lbuf[32];
- register int i;
-
- buf[buflen-1] = '\0'; /* make sure its NULL terminated */
- buflen -= 1;
-
- switch(data[3]) {
- case KRB_REJECT: /* Rejected (reason might follow) */
- strncpy((char *)buf, " REJECT ", buflen);
- goto common;
-
- case KRB_ACCEPT: /* Accepted (name might follow) */
- strncpy((char *)buf, " ACCEPT ", buflen);
- common:
- BUMP(buf, buflen);
- if (cnt <= 4)
- break;
- ADDC(buf, buflen, '"');
- for (i = 4; i < cnt; i++)
- ADDC(buf, buflen, data[i]);
- ADDC(buf, buflen, '"');
- ADDC(buf, buflen, '\0');
- break;
-
-
- case KRB_AUTH: /* Authentication data follows */
- strncpy((char *)buf, " AUTH", buflen);
- goto common2;
-
- case KRB_RESPONSE:
- strncpy((char *)buf, " RESPONSE", buflen);
- goto common2;
-
-#ifdef FORWARD
- case KRB_FORWARD: /* Forwarded credentials follow */
- strncpy((char *)buf, " FORWARD", buflen);
- goto common2;
-
- case KRB_FORWARD_ACCEPT: /* Forwarded credentials accepted */
- strncpy((char *)buf, " FORWARD_ACCEPT", buflen);
- goto common2;
-
- case KRB_FORWARD_REJECT: /* Forwarded credentials rejected */
- /* (reason might follow) */
- strncpy((char *)buf, " FORWARD_REJECT", buflen);
- goto common2;
-#endif /* FORWARD */
-
- default:
- sprintf(lbuf, " %d (unknown)", data[3]);
- strncpy((char *)buf, lbuf, buflen);
- common2:
- BUMP(buf, buflen);
- for (i = 4; i < cnt; i++) {
- sprintf(lbuf, " %d", data[i]);
- strncpy((char *)buf, lbuf, buflen);
- BUMP(buf, buflen);
- }
- break;
- }
-}
-
-#ifdef FORWARD
- void
-kerberos5_forward(ap)
- Authenticator *ap;
-{
- struct hostent *hp;
- krb5_creds *local_creds;
- krb5_error_code r;
- krb5_data forw_creds;
- extern krb5_cksumtype krb5_kdc_req_sumtype;
- krb5_ccache ccache;
- int i;
-
- if (!(local_creds = (krb5_creds *)
- calloc(1, sizeof(*local_creds)))) {
- if (auth_debug_mode)
- printf("Kerberos V5: could not allocate memory for credentials\r\n");
- return;
- }
-
- if (r = krb5_sname_to_principal(RemoteHostName, "host", 1,
- &local_creds->server)) {
- if (auth_debug_mode)
- printf("Kerberos V5: could not build server name - %s\r\n",
- error_message(r));
- krb5_free_creds(local_creds);
- return;
- }
-
- if (r = krb5_cc_default(&ccache)) {
- if (auth_debug_mode)
- printf("Kerberos V5: could not get default ccache - %s\r\n",
- error_message(r));
- krb5_free_creds(local_creds);
- return;
- }
-
- if (r = krb5_cc_get_principal(ccache, &local_creds->client)) {
- if (auth_debug_mode)
- printf("Kerberos V5: could not get default principal - %s\r\n",
- error_message(r));
- krb5_free_creds(local_creds);
- return;
- }
-
- /* Get ticket from credentials cache */
- if (r = krb5_get_credentials(KRB5_GC_CACHED, ccache, local_creds)) {
- if (auth_debug_mode)
- printf("Kerberos V5: could not obtain credentials - %s\r\n",
- error_message(r));
- krb5_free_creds(local_creds);
- return;
- }
-
- if (r = get_for_creds(ETYPE_DES_CBC_CRC,
- krb5_kdc_req_sumtype,
- RemoteHostName,
- local_creds->client,
- &local_creds->keyblock,
- forward_flags & OPTS_FORWARDABLE_CREDS,
- &forw_creds)) {
- if (auth_debug_mode)
- printf("Kerberos V5: error getting forwarded creds - %s\r\n",
- error_message(r));
- krb5_free_creds(local_creds);
- return;
- }
-
- /* Send forwarded credentials */
- if (!Data(ap, KRB_FORWARD, forw_creds.data, forw_creds.length)) {
- if (auth_debug_mode)
- printf("Not enough room for authentication data\r\n");
- }
- else {
- if (auth_debug_mode)
- printf("Forwarded local Kerberos V5 credentials to server\r\n");
- }
-
- krb5_free_creds(local_creds);
-}
-#endif /* FORWARD */
-
-#endif /* KRB5 */
diff --git a/lib/libtelnet/key-proto.h b/lib/libtelnet/key-proto.h
deleted file mode 100644
index 9668a77..0000000
--- a/lib/libtelnet/key-proto.h
+++ /dev/null
@@ -1,71 +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.
- *
- * @(#)key-proto.h 8.1 (Berkeley) 6/4/93
- */
-
-/*
- * Copyright (C) 1990 by the Massachusetts Institute of Technology
- *
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, 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 copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#ifndef __KEY_PROTO__
-#define __KEY_PROTO__
-
-#if !defined(P)
-#ifdef __STDC__
-#define P(x) x
-#else
-#define P(x) ()
-#endif
-#endif
-
-int key_file_exists P((void));
-void key_lookup P((unsigned char *, Block));
-void key_stream_init P((Block, Block, int));
-unsigned char key_stream P((int, int));
-#endif
diff --git a/lib/libtelnet/krb4encpwd.c b/lib/libtelnet/krb4encpwd.c
deleted file mode 100644
index 0f75d4d..0000000
--- a/lib/libtelnet/krb4encpwd.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)krb4encpwd.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-
-#ifdef KRB4_ENCPWD
-/*
- * COPYRIGHT (C) 1990 DIGITAL EQUIPMENT CORPORATION
- * ALL RIGHTS RESERVED
- *
- * "Digital Equipment Corporation authorizes the reproduction,
- * distribution and modification of this software subject to the following
- * restrictions:
- *
- * 1. Any partial or whole copy of this software, or any modification
- * thereof, must include this copyright notice in its entirety.
- *
- * 2. This software is supplied "as is" with no warranty of any kind,
- * expressed or implied, for any purpose, including any warranty of fitness
- * or merchantibility. DIGITAL assumes no responsibility for the use or
- * reliability of this software, nor promises to provide any form of
- * support for it on any basis.
- *
- * 3. Distribution of this software is authorized only if no profit or
- * remuneration of any kind is received in exchange for such distribution.
- *
- * 4. This software produces public key authentication certificates
- * bearing an expiration date established by DIGITAL and RSA Data
- * Security, Inc. It may cease to generate certificates after the expiration
- * date. Any modification of this software that changes or defeats
- * the expiration date or its effect is unauthorized.
- *
- * 5. Software that will renew or extend the expiration date of
- * authentication certificates produced by this software may be obtained
- * from RSA Data Security, Inc., 10 Twin Dolphin Drive, Redwood City, CA
- * 94065, (415)595-8782, or from DIGITAL"
- *
- */
-
-#include <sys/types.h>
-#include <arpa/telnet.h>
-#include <pwd.h>
-#include <stdio.h>
-
-#include <des.h>
-#include <krb.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-#include "encrypt.h"
-#include "auth.h"
-#include "misc.h"
-
-int krb_mk_encpwd_req P((KTEXT, char *, char *, char *, char *, char *, char *));
-int krb_rd_encpwd_req P((KTEXT, char *, char *, u_long, AUTH_DAT *, char *, char *, char *, char *));
-
-extern auth_debug_mode;
-
-static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
- AUTHTYPE_KRB4_ENCPWD, };
-static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
- TELQUAL_NAME, };
-
-#define KRB4_ENCPWD_AUTH 0 /* Authentication data follows */
-#define KRB4_ENCPWD_REJECT 1 /* Rejected (reason might follow) */
-#define KRB4_ENCPWD_ACCEPT 2 /* Accepted */
-#define KRB4_ENCPWD_CHALLENGE 3 /* Challenge for mutual auth. */
-#define KRB4_ENCPWD_ACK 4 /* Acknowledge */
-
-#define KRB_SERVICE_NAME "rcmd"
-
-static KTEXT_ST auth;
-static char name[ANAME_SZ];
-static char user_passwd[ANAME_SZ];
-static AUTH_DAT adat = { 0 };
-#ifdef ENCRYPTION
-static Block session_key = { 0 };
-#endif /* ENCRYPTION */
-static Schedule sched;
-static char challenge[REALM_SZ];
-
- static int
-Data(ap, type, d, c)
- Authenticator *ap;
- int type;
- void *d;
- int c;
-{
- unsigned char *p = str_data + 4;
- unsigned char *cd = (unsigned char *)d;
-
- if (c == -1)
- c = strlen((char *)cd);
-
- if (0) {
- printf("%s:%d: [%d] (%d)",
- str_data[3] == TELQUAL_IS ? ">>>IS" : ">>>REPLY",
- str_data[3],
- type, c);
- printd(d, c);
- printf("\r\n");
- }
- *p++ = ap->type;
- *p++ = ap->way;
- *p++ = type;
- while (c-- > 0) {
- if ((*p++ = *cd++) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- if (str_data[3] == TELQUAL_IS)
- printsub('>', &str_data[2], p - (&str_data[2]));
- return(net_write(str_data, p - str_data));
-}
-
- int
-krb4encpwd_init(ap, server)
- Authenticator *ap;
- int server;
-{
- char hostname[80], *cp, *realm;
- C_Block skey;
-
- if (server) {
- str_data[3] = TELQUAL_REPLY;
- } else {
- str_data[3] = TELQUAL_IS;
- gethostname(hostname, sizeof(hostname));
- realm = krb_realmofhost(hostname);
- cp = index(hostname, '.');
- if (*cp != NULL) *cp = NULL;
- if (read_service_key(KRB_SERVICE_NAME, hostname, realm, 0,
- KEYFILE, (char *)skey)) {
- return(0);
- }
- }
- return(1);
-}
-
- int
-krb4encpwd_send(ap)
- Authenticator *ap;
-{
-
- printf("[ Trying KRB4ENCPWD ... ]\n");
- if (!UserNameRequested) {
- return(0);
- }
- if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) {
- return(0);
- }
-
- if (!Data(ap, KRB4_ENCPWD_ACK, (void *)NULL, 0)) {
- return(0);
- }
-
- return(1);
-}
-
- void
-krb4encpwd_is(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
- Block datablock;
- char r_passwd[ANAME_SZ], r_user[ANAME_SZ];
- char lhostname[ANAME_SZ], *cp;
- int r;
- time_t now;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case KRB4_ENCPWD_AUTH:
- bcopy((void *)data, (void *)auth.dat, auth.length = cnt);
-
- gethostname(lhostname, sizeof(lhostname));
- if ((cp = index(lhostname, '.')) != 0) *cp = '\0';
-
- if (r = krb_rd_encpwd_req(&auth, KRB_SERVICE_NAME, lhostname, 0, &adat, NULL, challenge, r_user, r_passwd)) {
- Data(ap, KRB4_ENCPWD_REJECT, (void *)"Auth failed", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
- auth_encrypt_userpwd(r_passwd);
- if (passwdok(UserNameRequested, UserPassword) == 0) {
- /*
- * illegal username and password
- */
- Data(ap, KRB4_ENCPWD_REJECT, (void *)"Illegal password", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-
- bcopy((void *)adat.session, (void *)session_key, sizeof(Block));
- Data(ap, KRB4_ENCPWD_ACCEPT, (void *)0, 0);
- auth_finished(ap, AUTH_USER);
- break;
-
- case KRB4_ENCPWD_CHALLENGE:
- /*
- * Take the received random challenge text and save
- * for future authentication.
- */
- bcopy((void *)data, (void *)challenge, sizeof(Block));
- break;
-
-
- case KRB4_ENCPWD_ACK:
- /*
- * Receive ack, if mutual then send random challenge
- */
-
- /*
- * If we are doing mutual authentication, get set up to send
- * the challange, and verify it when the response comes back.
- */
-
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
- register int i;
-
- time(&now);
- sprintf(challenge, "%x", now);
- Data(ap, KRB4_ENCPWD_CHALLENGE, (void *)challenge, strlen(challenge));
- }
- break;
-
- default:
- Data(ap, KRB4_ENCPWD_REJECT, 0, 0);
- break;
- }
-}
-
-
- void
-krb4encpwd_reply(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
- KTEXT_ST krb_token;
- Block enckey;
- CREDENTIALS cred;
- int r;
- char randchal[REALM_SZ], instance[ANAME_SZ], *cp;
- char hostname[80], *realm;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case KRB4_ENCPWD_REJECT:
- if (cnt > 0) {
- printf("[ KRB4_ENCPWD refuses authentication because %.*s ]\r\n",
- cnt, data);
- } else
- printf("[ KRB4_ENCPWD refuses authentication ]\r\n");
- auth_send_retry();
- return;
- case KRB4_ENCPWD_ACCEPT:
- printf("[ KRB4_ENCPWD accepts you ]\n");
- auth_finished(ap, AUTH_USER);
- return;
- case KRB4_ENCPWD_CHALLENGE:
- /*
- * Verify that the response to the challenge is correct.
- */
-
- gethostname(hostname, sizeof(hostname));
- realm = krb_realmofhost(hostname);
- bcopy((void *)data, (void *)challenge, cnt);
- bzero(user_passwd, sizeof(user_passwd));
- local_des_read_pw_string(user_passwd, sizeof(user_passwd)-1, "Password: ", 0);
- UserPassword = user_passwd;
- Challenge = challenge;
- strcpy(instance, RemoteHostName);
- if ((cp = index(instance, '.')) != 0) *cp = '\0';
-
- if (r = krb_mk_encpwd_req(&krb_token, KRB_SERVICE_NAME, instance, realm, Challenge, UserNameRequested, user_passwd)) {
- krb_token.length = 0;
- }
-
- if (!Data(ap, KRB4_ENCPWD_AUTH, (void *)krb_token.dat, krb_token.length)) {
- return;
- }
-
- break;
-
- default:
- return;
- }
-}
-
- int
-krb4encpwd_status(ap, name, level)
- Authenticator *ap;
- char *name;
- int level;
-{
-
- if (level < AUTH_USER)
- return(level);
-
- if (UserNameRequested && passwdok(UserNameRequested, UserPassword)) {
- strcpy(name, UserNameRequested);
- return(AUTH_VALID);
- } else {
- return(AUTH_USER);
- }
-}
-
-#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
-#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
-
- void
-krb4encpwd_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- char lbuf[32];
- register int i;
-
- buf[buflen-1] = '\0'; /* make sure its NULL terminated */
- buflen -= 1;
-
- switch(data[3]) {
- case KRB4_ENCPWD_REJECT: /* Rejected (reason might follow) */
- strncpy((char *)buf, " REJECT ", buflen);
- goto common;
-
- case KRB4_ENCPWD_ACCEPT: /* Accepted (name might follow) */
- strncpy((char *)buf, " ACCEPT ", buflen);
- common:
- BUMP(buf, buflen);
- if (cnt <= 4)
- break;
- ADDC(buf, buflen, '"');
- for (i = 4; i < cnt; i++)
- ADDC(buf, buflen, data[i]);
- ADDC(buf, buflen, '"');
- ADDC(buf, buflen, '\0');
- break;
-
- case KRB4_ENCPWD_AUTH: /* Authentication data follows */
- strncpy((char *)buf, " AUTH", buflen);
- goto common2;
-
- case KRB4_ENCPWD_CHALLENGE:
- strncpy((char *)buf, " CHALLENGE", buflen);
- goto common2;
-
- case KRB4_ENCPWD_ACK:
- strncpy((char *)buf, " ACK", buflen);
- goto common2;
-
- default:
- sprintf(lbuf, " %d (unknown)", data[3]);
- strncpy((char *)buf, lbuf, buflen);
- common2:
- BUMP(buf, buflen);
- for (i = 4; i < cnt; i++) {
- sprintf(lbuf, " %d", data[i]);
- strncpy((char *)buf, lbuf, buflen);
- BUMP(buf, buflen);
- }
- break;
- }
-}
-
-int passwdok(name, passwd)
-char *name, *passwd;
-{
- char *crypt();
- char *salt, *p;
- struct passwd *pwd;
- int passwdok_status = 0;
-
- if (pwd = getpwnam(name))
- salt = pwd->pw_passwd;
- else salt = "xx";
-
- p = crypt(passwd, salt);
-
- if (pwd && !strcmp(p, pwd->pw_passwd)) {
- passwdok_status = 1;
- } else passwdok_status = 0;
- return(passwdok_status);
-}
-
-#endif
-
-#ifdef notdef
-
-prkey(msg, key)
- char *msg;
- unsigned char *key;
-{
- register int i;
- printf("%s:", msg);
- for (i = 0; i < 8; i++)
- printf(" %3d", key[i]);
- printf("\r\n");
-}
-#endif
diff --git a/lib/libtelnet/read_password.c b/lib/libtelnet/read_password.c
deleted file mode 100644
index 7644d9a..0000000
--- a/lib/libtelnet/read_password.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)read_password.c 8.2 (Berkeley) 12/15/93";
-#endif /* not lint */
-
-/*
- * $Source: /mit/kerberos/src/lib/des/RCS/read_password.c,v $
- * $Author: jon $
- *
- * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
- * of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * This routine prints the supplied string to standard
- * output as a prompt, and reads a password string without
- * echoing.
- */
-
-#if defined(RSA_ENCPWD) || defined(KRB4_ENCPWD)
-
-#include <stdio.h>
-#include <strings.h>
-#include <sys/ioctl.h>
-#include <signal.h>
-#include <setjmp.h>
-
-static jmp_buf env;
-
-/*** Routines ****************************************************** */
-/*
- * This version just returns the string, doesn't map to key.
- *
- * Returns 0 on success, non-zero on failure.
- */
-
-int
-local_des_read_pw_string(s,max,prompt,verify)
- char *s;
- int max;
- char *prompt;
- int verify;
-{
- int ok = 0;
- char *ptr;
-
- jmp_buf old_env;
- struct sgttyb tty_state;
- char key_string[BUFSIZ];
-
- if (max > BUFSIZ) {
- return -1;
- }
-
- /* XXX assume jmp_buf is typedef'ed to an array */
- bcopy((char *)old_env, (char *)env, sizeof(env));
- if (setjmp(env))
- goto lose;
-
- /* save terminal state*/
- if (ioctl(0,TIOCGETP,(char *)&tty_state) == -1)
- return -1;
-/*
- push_signals();
-*/
- /* Turn off echo */
- tty_state.sg_flags &= ~ECHO;
- if (ioctl(0,TIOCSETP,(char *)&tty_state) == -1)
- return -1;
- while (!ok) {
- (void) printf(prompt);
- (void) fflush(stdout);
- while (!fgets(s, max, stdin));
-
- if ((ptr = index(s, '\n')))
- *ptr = '\0';
- if (verify) {
- printf("\nVerifying, please re-enter %s",prompt);
- (void) fflush(stdout);
- if (!fgets(key_string, sizeof(key_string), stdin)) {
- clearerr(stdin);
- continue;
- }
- if ((ptr = index(key_string, '\n')))
- *ptr = '\0';
- if (strcmp(s,key_string)) {
- printf("\n\07\07Mismatch - try again\n");
- (void) fflush(stdout);
- continue;
- }
- }
- ok = 1;
- }
-
-lose:
- if (!ok)
- bzero(s, max);
- printf("\n");
- /* turn echo back on */
- tty_state.sg_flags |= ECHO;
- if (ioctl(0,TIOCSETP,(char *)&tty_state))
- ok = 0;
-/*
- pop_signals();
-*/
- bcopy((char *)env, (char *)old_env, sizeof(env));
- if (verify)
- bzero(key_string, sizeof (key_string));
- s[max-1] = 0; /* force termination */
- return !ok; /* return nonzero if not okay */
-}
-#endif /* defined(RSA_ENCPWD) || defined(KRB4_ENCPWD) */
diff --git a/lib/libtelnet/rsaencpwd.c b/lib/libtelnet/rsaencpwd.c
deleted file mode 100644
index eda70fe..0000000
--- a/lib/libtelnet/rsaencpwd.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)rsaencpwd.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-
-#ifdef RSA_ENCPWD
-/*
- * COPYRIGHT (C) 1990 DIGITAL EQUIPMENT CORPORATION
- * ALL RIGHTS RESERVED
- *
- * "Digital Equipment Corporation authorizes the reproduction,
- * distribution and modification of this software subject to the following
- * restrictions:
- *
- * 1. Any partial or whole copy of this software, or any modification
- * thereof, must include this copyright notice in its entirety.
- *
- * 2. This software is supplied "as is" with no warranty of any kind,
- * expressed or implied, for any purpose, including any warranty of fitness
- * or merchantibility. DIGITAL assumes no responsibility for the use or
- * reliability of this software, nor promises to provide any form of
- * support for it on any basis.
- *
- * 3. Distribution of this software is authorized only if no profit or
- * remuneration of any kind is received in exchange for such distribution.
- *
- * 4. This software produces public key authentication certificates
- * bearing an expiration date established by DIGITAL and RSA Data
- * Security, Inc. It may cease to generate certificates after the expiration
- * date. Any modification of this software that changes or defeats
- * the expiration date or its effect is unauthorized.
- *
- * 5. Software that will renew or extend the expiration date of
- * authentication certificates produced by this software may be obtained
- * from RSA Data Security, Inc., 10 Twin Dolphin Drive, Redwood City, CA
- * 94065, (415)595-8782, or from DIGITAL"
- *
- */
-
-#include <sys/types.h>
-#include <arpa/telnet.h>
-#include <pwd.h>
-#include <stdio.h>
-
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-#include "encrypt.h"
-#include "auth.h"
-#include "misc.h"
-#include "cdc.h"
-
-extern auth_debug_mode;
-
-static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
- AUTHTYPE_RSA_ENCPWD, };
-static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
- TELQUAL_NAME, };
-
-#define RSA_ENCPWD_AUTH 0 /* Authentication data follows */
-#define RSA_ENCPWD_REJECT 1 /* Rejected (reason might follow) */
-#define RSA_ENCPWD_ACCEPT 2 /* Accepted */
-#define RSA_ENCPWD_CHALLENGEKEY 3 /* Challenge and public key */
-
-#define NAME_SZ 40
-#define CHAL_SZ 20
-#define PWD_SZ 40
-
-static KTEXT_ST auth;
-static char name[NAME_SZ];
-static char user_passwd[PWD_SZ];
-static char key_file[2*NAME_SZ];
-static char lhostname[NAME_SZ];
-static char challenge[CHAL_SZ];
-static int challenge_len;
-
- static int
-Data(ap, type, d, c)
- Authenticator *ap;
- int type;
- void *d;
- int c;
-{
- unsigned char *p = str_data + 4;
- unsigned char *cd = (unsigned char *)d;
-
- if (c == -1)
- c = strlen((char *)cd);
-
- if (0) {
- printf("%s:%d: [%d] (%d)",
- str_data[3] == TELQUAL_IS ? ">>>IS" : ">>>REPLY",
- str_data[3],
- type, c);
- printd(d, c);
- printf("\r\n");
- }
- *p++ = ap->type;
- *p++ = ap->way;
- if (type != NULL) *p++ = type;
- while (c-- > 0) {
- if ((*p++ = *cd++) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- if (str_data[3] == TELQUAL_IS)
- printsub('>', &str_data[2], p - (&str_data[2]));
- return(net_write(str_data, p - str_data));
-}
-
- int
-rsaencpwd_init(ap, server)
- Authenticator *ap;
- int server;
-{
- char *cp;
- FILE *fp;
-
- if (server) {
- str_data[3] = TELQUAL_REPLY;
- bzero(key_file, sizeof(key_file));
- gethostname(lhostname, sizeof(lhostname));
- if ((cp = index(lhostname, '.')) != 0) *cp = '\0';
- strcpy(key_file, "/etc/.");
- strcat(key_file, lhostname);
- strcat(key_file, "_privkey");
- if ((fp=fopen(key_file, "r"))==NULL) return(0);
- fclose(fp);
- } else {
- str_data[3] = TELQUAL_IS;
- }
- return(1);
-}
-
- int
-rsaencpwd_send(ap)
- Authenticator *ap;
-{
-
- printf("[ Trying RSAENCPWD ... ]\n");
- if (!UserNameRequested) {
- return(0);
- }
- if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) {
- return(0);
- }
- if (!Data(ap, NULL, (void *)NULL, 0)) {
- return(0);
- }
-
-
- return(1);
-}
-
- void
-rsaencpwd_is(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
- Block datablock;
- char r_passwd[PWD_SZ], r_user[NAME_SZ];
- char *cp, key[160];
- char chalkey[160], *ptr;
- FILE *fp;
- int r, i, j, chalkey_len, len;
- time_t now;
-
- cnt--;
- switch (*data++) {
- case RSA_ENCPWD_AUTH:
- bcopy((void *)data, (void *)auth.dat, auth.length = cnt);
-
- if ((fp=fopen(key_file, "r"))==NULL) {
- Data(ap, RSA_ENCPWD_REJECT, (void *)"Auth failed", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
- /*
- * get privkey
- */
- fscanf(fp, "%x;", &len);
- for (i=0;i<len;i++) {
- j = getc(fp); key[i]=j;
- }
- fclose(fp);
-
- r = accept_rsa_encpwd(&auth, key, challenge,
- challenge_len, r_passwd);
- if (r < 0) {
- Data(ap, RSA_ENCPWD_REJECT, (void *)"Auth failed", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
- auth_encrypt_userpwd(r_passwd);
- if (rsaencpwd_passwdok(UserNameRequested, UserPassword) == 0) {
- /*
- * illegal username and password
- */
- Data(ap, RSA_ENCPWD_REJECT, (void *)"Illegal password", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-
- Data(ap, RSA_ENCPWD_ACCEPT, (void *)0, 0);
- auth_finished(ap, AUTH_USER);
- break;
-
-
- case IAC:
-
- /*
- * If we are doing mutual authentication, get set up to send
- * the challange, and verify it when the response comes back.
- */
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_ONE_WAY) {
- register int i;
-
-
- time(&now);
- if ((now % 2) == 0) {
- sprintf(challenge, "%x", now);
- challenge_len = strlen(challenge);
- } else {
- strcpy(challenge, "randchal");
- challenge_len = 8;
- }
-
- if ((fp=fopen(key_file, "r"))==NULL) {
- Data(ap, RSA_ENCPWD_REJECT, (void *)"Auth failed", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
- /*
- * skip privkey
- */
- fscanf(fp, "%x;", &len);
- for (i=0;i<len;i++) {
- j = getc(fp);
- }
- /*
- * get pubkey
- */
- fscanf(fp, "%x;", &len);
- for (i=0;i<len;i++) {
- j = getc(fp); key[i]=j;
- }
- fclose(fp);
- chalkey[0] = 0x30;
- ptr = (char *) &chalkey[1];
- chalkey_len = 1+NumEncodeLengthOctets(i)+i+1+NumEncodeLengthOctets(challenge_len)+challenge_len;
- EncodeLength(ptr, chalkey_len);
- ptr +=NumEncodeLengthOctets(chalkey_len);
- *ptr++ = 0x04; /* OCTET STRING */
- *ptr++ = challenge_len;
- bcopy(challenge, ptr, challenge_len);
- ptr += challenge_len;
- *ptr++ = 0x04; /* OCTET STRING */
- EncodeLength(ptr, i);
- ptr += NumEncodeLengthOctets(i);
- bcopy(key, ptr, i);
- chalkey_len = 1+NumEncodeLengthOctets(chalkey_len)+chalkey_len;
- Data(ap, RSA_ENCPWD_CHALLENGEKEY, (void *)chalkey, chalkey_len);
- }
- break;
-
- default:
- Data(ap, RSA_ENCPWD_REJECT, 0, 0);
- break;
- }
-}
-
-
- void
-rsaencpwd_reply(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
- KTEXT_ST token;
- Block enckey;
- int r, pubkey_len;
- char randchal[CHAL_SZ], *cp;
- char chalkey[160], pubkey[128], *ptr;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case RSA_ENCPWD_REJECT:
- if (cnt > 0) {
- printf("[ RSA_ENCPWD refuses authentication because %.*s ]\r\n",
- cnt, data);
- } else
- printf("[ RSA_ENCPWD refuses authentication ]\r\n");
- auth_send_retry();
- return;
- case RSA_ENCPWD_ACCEPT:
- printf("[ RSA_ENCPWD accepts you ]\n");
- auth_finished(ap, AUTH_USER);
- return;
- case RSA_ENCPWD_CHALLENGEKEY:
- /*
- * Verify that the response to the challenge is correct.
- */
-
- bcopy((void *)data, (void *)chalkey, cnt);
- ptr = (char *) &chalkey[0];
- ptr += DecodeHeaderLength(chalkey);
- if (*ptr != 0x04) {
- return;
- }
- *ptr++;
- challenge_len = DecodeValueLength(ptr);
- ptr += NumEncodeLengthOctets(challenge_len);
- bcopy(ptr, challenge, challenge_len);
- ptr += challenge_len;
- if (*ptr != 0x04) {
- return;
- }
- *ptr++;
- pubkey_len = DecodeValueLength(ptr);
- ptr += NumEncodeLengthOctets(pubkey_len);
- bcopy(ptr, pubkey, pubkey_len);
- bzero(user_passwd, sizeof(user_passwd));
- local_des_read_pw_string(user_passwd, sizeof(user_passwd)-1, "Password: ", 0);
- UserPassword = user_passwd;
- Challenge = challenge;
- r = init_rsa_encpwd(&token, user_passwd, challenge, challenge_len, pubkey);
- if (r < 0) {
- token.length = 1;
- }
-
- if (!Data(ap, RSA_ENCPWD_AUTH, (void *)token.dat, token.length)) {
- return;
- }
-
- break;
-
- default:
- return;
- }
-}
-
- int
-rsaencpwd_status(ap, name, level)
- Authenticator *ap;
- char *name;
- int level;
-{
-
- if (level < AUTH_USER)
- return(level);
-
- if (UserNameRequested && rsaencpwd_passwdok(UserNameRequested, UserPassword)) {
- strcpy(name, UserNameRequested);
- return(AUTH_VALID);
- } else {
- return(AUTH_USER);
- }
-}
-
-#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
-#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
-
- void
-rsaencpwd_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- char lbuf[32];
- register int i;
-
- buf[buflen-1] = '\0'; /* make sure its NULL terminated */
- buflen -= 1;
-
- switch(data[3]) {
- case RSA_ENCPWD_REJECT: /* Rejected (reason might follow) */
- strncpy((char *)buf, " REJECT ", buflen);
- goto common;
-
- case RSA_ENCPWD_ACCEPT: /* Accepted (name might follow) */
- strncpy((char *)buf, " ACCEPT ", buflen);
- common:
- BUMP(buf, buflen);
- if (cnt <= 4)
- break;
- ADDC(buf, buflen, '"');
- for (i = 4; i < cnt; i++)
- ADDC(buf, buflen, data[i]);
- ADDC(buf, buflen, '"');
- ADDC(buf, buflen, '\0');
- break;
-
- case RSA_ENCPWD_AUTH: /* Authentication data follows */
- strncpy((char *)buf, " AUTH", buflen);
- goto common2;
-
- case RSA_ENCPWD_CHALLENGEKEY:
- strncpy((char *)buf, " CHALLENGEKEY", buflen);
- goto common2;
-
- default:
- sprintf(lbuf, " %d (unknown)", data[3]);
- strncpy((char *)buf, lbuf, buflen);
- common2:
- BUMP(buf, buflen);
- for (i = 4; i < cnt; i++) {
- sprintf(lbuf, " %d", data[i]);
- strncpy((char *)buf, lbuf, buflen);
- BUMP(buf, buflen);
- }
- break;
- }
-}
-
-int rsaencpwd_passwdok(name, passwd)
-char *name, *passwd;
-{
- char *crypt();
- char *salt, *p;
- struct passwd *pwd;
- int passwdok_status = 0;
-
- if (pwd = getpwnam(name))
- salt = pwd->pw_passwd;
- else salt = "xx";
-
- p = crypt(passwd, salt);
-
- if (pwd && !strcmp(p, pwd->pw_passwd)) {
- passwdok_status = 1;
- } else passwdok_status = 0;
- return(passwdok_status);
-}
-
-#endif
-
-#ifdef notdef
-
-prkey(msg, key)
- char *msg;
- unsigned char *key;
-{
- register int i;
- printf("%s:", msg);
- for (i = 0; i < 8; i++)
- printf(" %3d", key[i]);
- printf("\r\n");
-}
-#endif
diff --git a/lib/libtelnet/spx.c b/lib/libtelnet/spx.c
deleted file mode 100644
index b4634d0..0000000
--- a/lib/libtelnet/spx.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)spx.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#ifdef SPX
-/*
- * COPYRIGHT (C) 1990 DIGITAL EQUIPMENT CORPORATION
- * ALL RIGHTS RESERVED
- *
- * "Digital Equipment Corporation authorizes the reproduction,
- * distribution and modification of this software subject to the following
- * restrictions:
- *
- * 1. Any partial or whole copy of this software, or any modification
- * thereof, must include this copyright notice in its entirety.
- *
- * 2. This software is supplied "as is" with no warranty of any kind,
- * expressed or implied, for any purpose, including any warranty of fitness
- * or merchantibility. DIGITAL assumes no responsibility for the use or
- * reliability of this software, nor promises to provide any form of
- * support for it on any basis.
- *
- * 3. Distribution of this software is authorized only if no profit or
- * remuneration of any kind is received in exchange for such distribution.
- *
- * 4. This software produces public key authentication certificates
- * bearing an expiration date established by DIGITAL and RSA Data
- * Security, Inc. It may cease to generate certificates after the expiration
- * date. Any modification of this software that changes or defeats
- * the expiration date or its effect is unauthorized.
- *
- * 5. Software that will renew or extend the expiration date of
- * authentication certificates produced by this software may be obtained
- * from RSA Data Security, Inc., 10 Twin Dolphin Drive, Redwood City, CA
- * 94065, (415)595-8782, or from DIGITAL"
- *
- */
-
-#include <sys/types.h>
-#include <arpa/telnet.h>
-#include <stdio.h>
-#include "gssapi_defs.h"
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
-#include <string.h>
-#endif
-
-#include <pwd.h>
-#include "encrypt.h"
-#include "auth.h"
-#include "misc.h"
-
-extern auth_debug_mode;
-
-static unsigned char str_data[1024] = { IAC, SB, TELOPT_AUTHENTICATION, 0,
- AUTHTYPE_SPX, };
-static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
- TELQUAL_NAME, };
-
-#define SPX_AUTH 0 /* Authentication data follows */
-#define SPX_REJECT 1 /* Rejected (reason might follow) */
-#define SPX_ACCEPT 2 /* Accepted */
-
-#ifdef ENCRYPTION
-static Block session_key = { 0 };
-#endif /* ENCRYPTION */
-static Schedule sched;
-static Block challenge = { 0 };
-
-
-/*******************************************************************/
-
-gss_OID_set actual_mechs;
-gss_OID actual_mech_type, output_name_type;
-int major_status, status, msg_ctx = 0, new_status;
-int req_flags = 0, ret_flags, lifetime_rec;
-gss_cred_id_t gss_cred_handle;
-gss_ctx_id_t actual_ctxhandle, context_handle;
-gss_buffer_desc output_token, input_token, input_name_buffer;
-gss_buffer_desc status_string;
-gss_name_t desired_targname, src_name;
-gss_channel_bindings input_chan_bindings;
-char lhostname[GSS_C_MAX_PRINTABLE_NAME];
-char targ_printable[GSS_C_MAX_PRINTABLE_NAME];
-int to_addr=0, from_addr=0;
-char *address;
-gss_buffer_desc fullname_buffer;
-gss_OID fullname_type;
-gss_cred_id_t gss_delegated_cred_handle;
-
-/*******************************************************************/
-
-
-
- static int
-Data(ap, type, d, c)
- Authenticator *ap;
- int type;
- void *d;
- int c;
-{
- unsigned char *p = str_data + 4;
- unsigned char *cd = (unsigned char *)d;
-
- if (c == -1)
- c = strlen((char *)cd);
-
- if (0) {
- printf("%s:%d: [%d] (%d)",
- str_data[3] == TELQUAL_IS ? ">>>IS" : ">>>REPLY",
- str_data[3],
- type, c);
- printd(d, c);
- printf("\r\n");
- }
- *p++ = ap->type;
- *p++ = ap->way;
- *p++ = type;
- while (c-- > 0) {
- if ((*p++ = *cd++) == IAC)
- *p++ = IAC;
- }
- *p++ = IAC;
- *p++ = SE;
- if (str_data[3] == TELQUAL_IS)
- printsub('>', &str_data[2], p - (&str_data[2]));
- return(net_write(str_data, p - str_data));
-}
-
- int
-spx_init(ap, server)
- Authenticator *ap;
- int server;
-{
- gss_cred_id_t tmp_cred_handle;
-
- if (server) {
- str_data[3] = TELQUAL_REPLY;
- gethostname(lhostname, sizeof(lhostname));
- strcpy(targ_printable, "SERVICE:rcmd@");
- strcat(targ_printable, lhostname);
- input_name_buffer.length = strlen(targ_printable);
- input_name_buffer.value = targ_printable;
- major_status = gss_import_name(&status,
- &input_name_buffer,
- GSS_C_NULL_OID,
- &desired_targname);
- major_status = gss_acquire_cred(&status,
- desired_targname,
- 0,
- GSS_C_NULL_OID_SET,
- GSS_C_ACCEPT,
- &tmp_cred_handle,
- &actual_mechs,
- &lifetime_rec);
- if (major_status != GSS_S_COMPLETE) return(0);
- } else {
- str_data[3] = TELQUAL_IS;
- }
- return(1);
-}
-
- int
-spx_send(ap)
- Authenticator *ap;
-{
- Block enckey;
- int r;
-
- gss_OID actual_mech_type, output_name_type;
- int msg_ctx = 0, new_status, status;
- int req_flags = 0, ret_flags, lifetime_rec, major_status;
- gss_buffer_desc output_token, input_token, input_name_buffer;
- gss_buffer_desc output_name_buffer, status_string;
- gss_name_t desired_targname;
- gss_channel_bindings input_chan_bindings;
- char targ_printable[GSS_C_MAX_PRINTABLE_NAME];
- int from_addr=0, to_addr=0, myhostlen, j;
- int deleg_flag=1, mutual_flag=0, replay_flag=0, seq_flag=0;
- char *address;
-
- printf("[ Trying SPX ... ]\n");
- strcpy(targ_printable, "SERVICE:rcmd@");
- strcat(targ_printable, RemoteHostName);
-
- input_name_buffer.length = strlen(targ_printable);
- input_name_buffer.value = targ_printable;
-
- if (!UserNameRequested) {
- return(0);
- }
-
- major_status = gss_import_name(&status,
- &input_name_buffer,
- GSS_C_NULL_OID,
- &desired_targname);
-
-
- major_status = gss_display_name(&status,
- desired_targname,
- &output_name_buffer,
- &output_name_type);
-
- printf("target is '%s'\n", output_name_buffer.value); fflush(stdout);
-
- major_status = gss_release_buffer(&status, &output_name_buffer);
-
- input_chan_bindings = (gss_channel_bindings)
- malloc(sizeof(gss_channel_bindings_desc));
-
- input_chan_bindings->initiator_addrtype = GSS_C_AF_INET;
- input_chan_bindings->initiator_address.length = 4;
- address = (char *) malloc(4);
- input_chan_bindings->initiator_address.value = (char *) address;
- address[0] = ((from_addr & 0xff000000) >> 24);
- address[1] = ((from_addr & 0xff0000) >> 16);
- address[2] = ((from_addr & 0xff00) >> 8);
- address[3] = (from_addr & 0xff);
- input_chan_bindings->acceptor_addrtype = GSS_C_AF_INET;
- input_chan_bindings->acceptor_address.length = 4;
- address = (char *) malloc(4);
- input_chan_bindings->acceptor_address.value = (char *) address;
- address[0] = ((to_addr & 0xff000000) >> 24);
- address[1] = ((to_addr & 0xff0000) >> 16);
- address[2] = ((to_addr & 0xff00) >> 8);
- address[3] = (to_addr & 0xff);
- input_chan_bindings->application_data.length = 0;
-
- req_flags = 0;
- if (deleg_flag) req_flags = req_flags | 1;
- if (mutual_flag) req_flags = req_flags | 2;
- if (replay_flag) req_flags = req_flags | 4;
- if (seq_flag) req_flags = req_flags | 8;
-
- major_status = gss_init_sec_context(&status, /* minor status */
- GSS_C_NO_CREDENTIAL, /* cred handle */
- &actual_ctxhandle, /* ctx handle */
- desired_targname, /* target name */
- GSS_C_NULL_OID, /* mech type */
- req_flags, /* req flags */
- 0, /* time req */
- input_chan_bindings, /* chan binding */
- GSS_C_NO_BUFFER, /* input token */
- &actual_mech_type, /* actual mech */
- &output_token, /* output token */
- &ret_flags, /* ret flags */
- &lifetime_rec); /* time rec */
-
- if ((major_status != GSS_S_COMPLETE) &&
- (major_status != GSS_S_CONTINUE_NEEDED)) {
- gss_display_status(&new_status,
- status,
- GSS_C_MECH_CODE,
- GSS_C_NULL_OID,
- &msg_ctx,
- &status_string);
- printf("%s\n", status_string.value);
- return(0);
- }
-
- if (!auth_sendname(UserNameRequested, strlen(UserNameRequested))) {
- return(0);
- }
-
- if (!Data(ap, SPX_AUTH, (void *)output_token.value, output_token.length)) {
- return(0);
- }
-
- return(1);
-}
-
- void
-spx_is(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
- Block datablock;
- int r;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case SPX_AUTH:
- input_token.length = cnt;
- input_token.value = (char *) data;
-
- gethostname(lhostname, sizeof(lhostname));
-
- strcpy(targ_printable, "SERVICE:rcmd@");
- strcat(targ_printable, lhostname);
-
- input_name_buffer.length = strlen(targ_printable);
- input_name_buffer.value = targ_printable;
-
- major_status = gss_import_name(&status,
- &input_name_buffer,
- GSS_C_NULL_OID,
- &desired_targname);
-
- major_status = gss_acquire_cred(&status,
- desired_targname,
- 0,
- GSS_C_NULL_OID_SET,
- GSS_C_ACCEPT,
- &gss_cred_handle,
- &actual_mechs,
- &lifetime_rec);
-
- major_status = gss_release_name(&status, desired_targname);
-
- input_chan_bindings = (gss_channel_bindings)
- malloc(sizeof(gss_channel_bindings_desc));
-
- input_chan_bindings->initiator_addrtype = GSS_C_AF_INET;
- input_chan_bindings->initiator_address.length = 4;
- address = (char *) malloc(4);
- input_chan_bindings->initiator_address.value = (char *) address;
- address[0] = ((from_addr & 0xff000000) >> 24);
- address[1] = ((from_addr & 0xff0000) >> 16);
- address[2] = ((from_addr & 0xff00) >> 8);
- address[3] = (from_addr & 0xff);
- input_chan_bindings->acceptor_addrtype = GSS_C_AF_INET;
- input_chan_bindings->acceptor_address.length = 4;
- address = (char *) malloc(4);
- input_chan_bindings->acceptor_address.value = (char *) address;
- address[0] = ((to_addr & 0xff000000) >> 24);
- address[1] = ((to_addr & 0xff0000) >> 16);
- address[2] = ((to_addr & 0xff00) >> 8);
- address[3] = (to_addr & 0xff);
- input_chan_bindings->application_data.length = 0;
-
- major_status = gss_accept_sec_context(&status,
- &context_handle,
- gss_cred_handle,
- &input_token,
- input_chan_bindings,
- &src_name,
- &actual_mech_type,
- &output_token,
- &ret_flags,
- &lifetime_rec,
- &gss_delegated_cred_handle);
-
-
- if (major_status != GSS_S_COMPLETE) {
-
- major_status = gss_display_name(&status,
- src_name,
- &fullname_buffer,
- &fullname_type);
- Data(ap, SPX_REJECT, (void *)"auth failed", -1);
- auth_finished(ap, AUTH_REJECT);
- return;
- }
-
- major_status = gss_display_name(&status,
- src_name,
- &fullname_buffer,
- &fullname_type);
-
-
- Data(ap, SPX_ACCEPT, (void *)output_token.value, output_token.length);
- auth_finished(ap, AUTH_USER);
- break;
-
- default:
- Data(ap, SPX_REJECT, 0, 0);
- break;
- }
-}
-
-
- void
-spx_reply(ap, data, cnt)
- Authenticator *ap;
- unsigned char *data;
- int cnt;
-{
- Session_Key skey;
-
- if (cnt-- < 1)
- return;
- switch (*data++) {
- case SPX_REJECT:
- if (cnt > 0) {
- printf("[ SPX refuses authentication because %.*s ]\r\n",
- cnt, data);
- } else
- printf("[ SPX refuses authentication ]\r\n");
- auth_send_retry();
- return;
- case SPX_ACCEPT:
- printf("[ SPX accepts you ]\n");
- if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
- /*
- * Send over the encrypted challenge.
- */
- input_token.value = (char *) data;
- input_token.length = cnt;
-
- major_status = gss_init_sec_context(&status, /* minor stat */
- GSS_C_NO_CREDENTIAL, /* cred handle */
- &actual_ctxhandle, /* ctx handle */
- desired_targname, /* target name */
- GSS_C_NULL_OID, /* mech type */
- req_flags, /* req flags */
- 0, /* time req */
- input_chan_bindings, /* chan binding */
- &input_token, /* input token */
- &actual_mech_type, /* actual mech */
- &output_token, /* output token */
- &ret_flags, /* ret flags */
- &lifetime_rec); /* time rec */
-
- if (major_status != GSS_S_COMPLETE) {
- gss_display_status(&new_status,
- status,
- GSS_C_MECH_CODE,
- GSS_C_NULL_OID,
- &msg_ctx,
- &status_string);
- printf("[ SPX mutual response fails ... '%s' ]\r\n",
- status_string.value);
- auth_send_retry();
- return;
- }
- }
- auth_finished(ap, AUTH_USER);
- return;
-
- default:
- return;
- }
-}
-
- int
-spx_status(ap, name, level)
- Authenticator *ap;
- char *name;
- int level;
-{
-
- gss_buffer_desc fullname_buffer, acl_file_buffer;
- gss_OID fullname_type;
- char acl_file[160], fullname[160];
- int major_status, status = 0;
- struct passwd *pwd;
-
- /*
- * hard code fullname to
- * "SPX:/C=US/O=Digital/OU=LKG/OU=Sphinx/OU=Users/CN=Kannan Alagappan"
- * and acl_file to "~kannan/.sphinx"
- */
-
- pwd = getpwnam(UserNameRequested);
- if (pwd == NULL) {
- return(AUTH_USER); /* not authenticated */
- }
-
- strcpy(acl_file, pwd->pw_dir);
- strcat(acl_file, "/.sphinx");
- acl_file_buffer.value = acl_file;
- acl_file_buffer.length = strlen(acl_file);
-
- major_status = gss_display_name(&status,
- src_name,
- &fullname_buffer,
- &fullname_type);
-
- if (level < AUTH_USER)
- return(level);
-
- major_status = gss__check_acl(&status, &fullname_buffer,
- &acl_file_buffer);
-
- if (major_status == GSS_S_COMPLETE) {
- strcpy(name, UserNameRequested);
- return(AUTH_VALID);
- } else {
- return(AUTH_USER);
- }
-
-}
-
-#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}
-#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}
-
- void
-spx_printsub(data, cnt, buf, buflen)
- unsigned char *data, *buf;
- int cnt, buflen;
-{
- char lbuf[32];
- register int i;
-
- buf[buflen-1] = '\0'; /* make sure its NULL terminated */
- buflen -= 1;
-
- switch(data[3]) {
- case SPX_REJECT: /* Rejected (reason might follow) */
- strncpy((char *)buf, " REJECT ", buflen);
- goto common;
-
- case SPX_ACCEPT: /* Accepted (name might follow) */
- strncpy((char *)buf, " ACCEPT ", buflen);
- common:
- BUMP(buf, buflen);
- if (cnt <= 4)
- break;
- ADDC(buf, buflen, '"');
- for (i = 4; i < cnt; i++)
- ADDC(buf, buflen, data[i]);
- ADDC(buf, buflen, '"');
- ADDC(buf, buflen, '\0');
- break;
-
- case SPX_AUTH: /* Authentication data follows */
- strncpy((char *)buf, " AUTH", buflen);
- goto common2;
-
- default:
- sprintf(lbuf, " %d (unknown)", data[3]);
- strncpy((char *)buf, lbuf, buflen);
- common2:
- BUMP(buf, buflen);
- for (i = 4; i < cnt; i++) {
- sprintf(lbuf, " %d", data[i]);
- strncpy((char *)buf, lbuf, buflen);
- BUMP(buf, buflen);
- }
- break;
- }
-}
-
-#endif
-
-#ifdef notdef
-
-prkey(msg, key)
- char *msg;
- unsigned char *key;
-{
- register int i;
- printf("%s:", msg);
- for (i = 0; i < 8; i++)
- printf(" %3d", key[i]);
- printf("\r\n");
-}
-#endif
diff --git a/lib/libterm/TEST/tc1.c b/lib/libterm/TEST/tc1.c
deleted file mode 100644
index fd0870a..0000000
--- a/lib/libterm/TEST/tc1.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)tc1.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * tc1 [term]
- * dummy program to test termlib.
- * gets entry, counts it, and prints it.
- */
-#include <stdio.h>
-char buf[1024];
-char *getenv();
-
-main(argc, argv) char **argv; {
- char *p;
- int rc;
-
- if (argc < 2)
- p = getenv("TERM");
- else
- p = argv[1];
- rc = tgetent(buf,p);
- printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf);
-}
diff --git a/lib/libterm/TEST/tc2.c b/lib/libterm/TEST/tc2.c
deleted file mode 100644
index 1db9d00..0000000
--- a/lib/libterm/TEST/tc2.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)tc2.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * tc2 [term]
- * Dummy program to test out termlib.
- * Commands are "tcc\n" where t is type (s for string, f for flag,
- * or n for number) and cc is the name of the capability.
- */
-#include <stdio.h>
-char buf[1024];
-char *getenv(), *tgetstr();
-
-main(argc, argv) char **argv; {
- char *p, *q;
- int rc;
- char b[3], c;
- char area[200];
-
- if (argc < 2)
- p = getenv("TERM");
- else
- p = argv[1];
- rc = tgetent(buf,p);
- for (;;) {
- c = getchar();
- if (c < 0)
- exit(0);
- b[0] = getchar();
- if (b[0] < ' ')
- exit(0);
- b[1] = getchar();
- b[2] = 0;
- getchar();
- switch(c) {
- case 'f':
- printf("%s: %d\n",b,tgetflag(b));
- break;
- case 'n':
- printf("%s: %d\n",b,tgetnum(b));
- break;
- case 's':
- q = area;
- printf("%s: %s\n",b,tgetstr(b,&q));
- break;
- default:
- exit(0);
- }
- }
-}
diff --git a/lib/libterm/TEST/tc3.c b/lib/libterm/TEST/tc3.c
deleted file mode 100644
index 3935e10..0000000
--- a/lib/libterm/TEST/tc3.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)tc3.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * tc3 [term]
- * Dummy program to test out termlib. Input two numbers (row and col)
- * and it prints out the tgoto string generated.
- */
-#include <stdio.h>
-char buf[1024];
-char *getenv(), *tgetstr();
-char *rdchar();
-char *tgoto();
-char *CM;
-char cmbuff[30];
-char *x;
-char *UP;
-char *tgout;
-
-main(argc, argv) char **argv; {
- char *p;
- int rc;
- int row, col;
-
- if (argc < 2)
- p = getenv("TERM");
- else
- p = argv[1];
- rc = tgetent(buf,p);
- x = cmbuff;
- UP = tgetstr("up", &x);
- printf("UP = %x = ", UP); pr(UP); printf("\n");
- if (UP && *UP==0)
- UP = 0;
- CM = tgetstr("cm", &x);
- printf("CM = "); pr(CM); printf("\n");
- for (;;) {
- if (scanf("%d %d", &row, &col) < 2)
- exit(0);
- tgout = tgoto(CM, col, row);
- pr(tgout);
- printf("\n");
- }
-}
-
-pr(p)
-register char *p;
-{
- for (; *p; p++)
- printf("%s", rdchar(*p));
-}
-
-/*
- * rdchar() returns a readable representation of an ASCII character
- * using ^ for control, ' for meta.
- */
-#include <ctype.h>
-char *rdchar(c)
-char c;
-{
- static char ret[4];
- register char *p = ret;
-
- if ((c&0377) > 0177)
- *p++ = '\'';
- c &= 0177;
- if (!isprint(c))
- *p++ = '^';
- *p++ = (isprint(c) ? c : c^0100);
- *p = 0;
- return (ret);
-}
diff --git a/lib/libterm/pathnames.h b/lib/libterm/pathnames.h
deleted file mode 100644
index db3ccf7..0000000
--- a/lib/libterm/pathnames.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/4/93
- */
-
-#define _PATH_DEF ".termcap /usr/share/misc/termcap"
diff --git a/lib/libterm/termcap.3 b/lib/libterm/termcap.3
deleted file mode 100644
index 08173cd..0000000
--- a/lib/libterm/termcap.3
+++ /dev/null
@@ -1,254 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)termcap.3 8.2 (Berkeley) 12/11/93
-.\"
-.Dd December 11, 1993
-.Dt TERMCAP 3
-.Os BSD 4
-.Sh NAME
-.Nm tgetent ,
-.Nm tgetnum ,
-.Nm tgetflag ,
-.Nm tgetstr ,
-.Nm tgoto ,
-.Nm tputs
-.Nd terminal independent operation routines
-.Sh SYNOPSIS
-.Vt char PC;
-.Vt char *BC;
-.Vt char *UP;
-.Vt short ospeed;
-.Fn tgetent "char *bp" "char *name"
-.Fn tgetnum "char *id"
-.Fn tgetflag "char *id"
-.Ft char *
-.Fn tgetstr "char *id" "char **area"
-.Ft char *
-.Fn tgoto "char *cm" destcol destline
-.Fn tputs "register char *cp" "int affcnt" "int (*outc)()"
-.Sh DESCRIPTION
-These functions extract and use capabilities from a terminal capability data
-base, usually
-.Pa /usr/share/misc/termcap ,
-the format of which is described in
-.Xr termcap 5 .
-These are low level routines;
-see
-.Xr curses 3
-for a higher level package.
-.Pp
-The
-.Fn tgetent
-function
-extracts the entry for terminal
-.Fa name
-into the buffer at
-.Fa bp .
-The
-.Fa bp
-argument
-should be a character buffer of size
-1024 and must be retained through all subsequent calls to
-.Fn tgetnum ,
-.Fn tgetflag ,
-and
-.Fn tgetstr .
-The
-.Fn tgetent
-function
-returns \-1 if none of the
-.Nm termcap
-data base files could be opened,
-0 if the terminal name given does not have an entry,
-and 1 if all goes well.
-It will look in the environment for a
-.Ev TERMCAP
-variable.
-If found, and the value does not begin with a slash,
-and the terminal type
-.Fa name
-is the same as the environment string
-.Ev TERM ,
-the
-.Ev TERMCAP
-string is used instead of reading a
-.Nm termcap
-file.
-If it does begin with a slash, the string is used as a path name
-of the
-.Nm termcap
-file to search.
-If
-.Ev TERMCAP
-does not begin with a slash and
-.Fa name
-is different from
-.Ev TERM ,
-.Fn tgetent
-searches the files
-.Pa $HOME/.termcap
-and
-.Pa /usr/share/misc/termcap ,
-in that order, unless the environment variable
-.Ev TERMPATH
-exists,
-in which case it specifies a list of file pathnames
-(separated by spaces or colons) to be searched instead.
-Whenever multiple files are searched and a
-.Sy tc
-field occurs in the requested entry, the entry it names must be found
-in the same file or one of the succeeding files.
-This can speed up entry into programs that call
-.Fn tgetent ,
-as well as help debug new terminal descriptions
-or make one for your terminal if you can't write the file
-.Pa /usr/share/misc/termcap .
-.Pp
-The
-.Fn tgetnum
-function
-gets the numeric value of capability
-.Fa id ,
-returning \-1 if it is not given for the terminal.
-The
-.Fn tgetflag
-function
-returns 1 if the specified capability is present in
-the terminal's entry, 0 if it is not.
-The
-.Fn tgetstr
-function
-returns the string value of the capability
-.Fa id ,
-places it in the buffer at
-.Fa area ,
-and advances the
-.Fa area
-pointer.
-It decodes the abbreviations for this field described in
-.Xr termcap 5 ,
-except for cursor addressing and padding information.
-The
-.Fn tgetstr
-function
-returns
-.Dv NULL
-if the capability was not found.
-.Pp
-The
-.Fn tgoto
-function
-returns a cursor addressing string decoded from
-.Fa cm
-to go to column
-.Fa destcol
-in line
-.Fa destline .
-It uses the external variables
-.Va UP
-(from the
-.Sy up
-capability)
-and
-.Va BC
-(if
-.Sy bc
-is given rather than
-.Sy bs )
-if necessary to avoid placing
-.Sy \en ,
-.Sy ^D
-or
-.Sy ^@
-in
-the returned string.
-(Programs which call
-.Fn tgoto
-should be sure to turn off the
-.Dv XTABS
-bit(s),
-since
-.Fn tgoto
-may now output a tab.
-Note that programs using termcap should in general turn off
-.Dv XTABS
-anyway since some terminals use control-I for other functions,
-such as nondestructive space.)
-If a
-.Sy %
-sequence is given which is not understood, then
-.Fn tgoto
-returns
-.Pq Dv OOPS .
-.Pp
-The
-.Fn tputs
-function
-decodes the leading padding information of the string
-.Fa cp ;
-.Fa affcnt
-gives the number of lines affected by the operation, or 1 if this is
-not applicable,
-.Fa outc
-is a routine which is called with each character in turn.
-The external variable
-.Va ospeed
-should contain the output speed of the terminal as encoded by
-.Xr stty 3 .
-The external variable
-.Va PC
-should contain a pad character to be used (from the
-.SY pc
-capability)
-if a null
-.Pq Sy ^@
-is inappropriate.
-.Sh FILES
-.Bl -tag -width /usr/share/misc/termcap -compact
-.It Pa /usr/lib/libtermcap.a
-.Fl l Ar ltermcap
-library (also known as
-.Fl l Ar ltermlib )
-.It Pa /usr/share/misc/termcap
-standard terminal capability data base
-.It Pa $HOME/.termcap
-user's terminal capability data base
-.El
-.Sh SEE ALSO
-.Xr ex 1 ,
-.Xr curses 3 ,
-.Xr termcap 5
-.Sh HISTORY
-The
-.Nm
-functions appeared in
-.Bx 4.0 .
diff --git a/lib/libterm/termcap.c b/lib/libterm/termcap.c
deleted file mode 100644
index 708ccfa..0000000
--- a/lib/libterm/termcap.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 1980, 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#define PBUFSIZ 512 /* max length of filename path */
-#define PVECSIZ 32 /* max number of names in path */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include "pathnames.h"
-
-/*
- * termcap - routines for dealing with the terminal capability data base
- *
- * BUG: Should use a "last" pointer in tbuf, so that searching
- * for capabilities alphabetically would not be a n**2/2
- * process when large numbers of capabilities are given.
- * Note: If we add a last pointer now we will screw up the
- * tc capability. We really should compile termcap.
- *
- * Essentially all the work here is scanning and decoding escapes
- * in string capabilities. We don't use stdio because the editor
- * doesn't, and because living w/o it is not hard.
- */
-
-static char *tbuf; /* termcap buffer */
-
-/*
- * Get an entry for terminal name in buffer bp from the termcap file.
- */
-int
-tgetent(bp, name)
- char *bp, *name;
-{
- register char *p;
- register char *cp;
- char *dummy;
- char **fname;
- char *home;
- int i;
- char pathbuf[PBUFSIZ]; /* holds raw path of filenames */
- char *pathvec[PVECSIZ]; /* to point to names in pathbuf */
- char **pvec; /* holds usable tail of path vector */
- char *termpath;
-
- fname = pathvec;
- pvec = pathvec;
- tbuf = bp;
- p = pathbuf;
- cp = getenv("TERMCAP");
- /*
- * TERMCAP can have one of two things in it. It can be the
- * name of a file to use instead of /etc/termcap. In this
- * case it better start with a "/". Or it can be an entry to
- * use so we don't have to read the file. In this case it
- * has to already have the newlines crunched out. If TERMCAP
- * does not hold a file name then a path of names is searched
- * instead. The path is found in the TERMPATH variable, or
- * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
- */
- if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */
- if (termpath = getenv("TERMPATH"))
- strncpy(pathbuf, termpath, PBUFSIZ);
- else {
- if (home = getenv("HOME")) { /* set up default */
- p += strlen(home); /* path, looking in */
- strcpy(pathbuf, home); /* $HOME first */
- *p++ = '/';
- } /* if no $HOME look in current directory */
- strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));
- }
- }
- else /* user-defined name in TERMCAP */
- strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */
-
- *fname++ = pathbuf; /* tokenize path into vector of names */
- while (*++p)
- if (*p == ' ' || *p == ':') {
- *p = '\0';
- while (*++p)
- if (*p != ' ' && *p != ':')
- break;
- if (*p == '\0')
- break;
- *fname++ = p;
- if (fname >= pathvec + PVECSIZ) {
- fname--;
- break;
- }
- }
- *fname = (char *) 0; /* mark end of vector */
- if (cp && *cp && *cp != '/')
- if (cgetset(cp) < 0)
- return(-2);
-
- i = cgetent(&dummy, pathvec, name);
-
- if (i == 0)
- strcpy(bp, dummy);
-
- if (dummy)
- free(dummy);
- /* no tc reference loop return code in libterm XXX */
- if (i == -3)
- return(-1);
- return(i + 1);
-}
-
-/*
- * Return the (numeric) option id.
- * Numeric options look like
- * li#80
- * i.e. the option string is separated from the numeric value by
- * a # character. If the option is not found we return -1.
- * Note that we handle octal numbers beginning with 0.
- */
-int
-tgetnum(id)
- char *id;
-{
- long num;
-
- if (cgetnum(tbuf, id, &num) == 0)
- return(num);
- else
- return(-1);
-}
-
-/*
- * Handle a flag option.
- * Flag options are given "naked", i.e. followed by a : or the end
- * of the buffer. Return 1 if we find the option, or 0 if it is
- * not given.
- */
-int
-tgetflag(id)
- char *id;
-{
- return(cgetcap(tbuf, id, ':') != NULL);
-}
-
-/*
- * Get a string valued option.
- * These are given as
- * cl=^Z
- * Much decoding is done on the strings, and the strings are
- * placed in area, which is a ref parameter which is updated.
- * No checking on area overflow.
- */
-char *
-tgetstr(id, area)
- char *id, **area;
-{
- char ids[3];
- char *s;
- int i;
-
- /*
- * XXX
- * This is for all the boneheaded programs that relied on tgetstr
- * to look only at the first 2 characters of the string passed...
- */
- *ids = *id;
- ids[1] = id[1];
- ids[2] = '\0';
-
- if ((i = cgetstr(tbuf, ids, &s)) < 0)
- return NULL;
-
- strcpy(*area, s);
- *area += i + 1;
- return(s);
-}
diff --git a/lib/libterm/tgoto.c b/lib/libterm/tgoto.c
deleted file mode 100644
index f0e4cc4..0000000
--- a/lib/libterm/tgoto.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 1980, 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)tgoto.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#define CTRL(c) ((c) & 037)
-
-#define MAXRETURNSIZE 64
-
-char *UP;
-char *BC;
-
-/*
- * Routine to perform cursor addressing.
- * CM is a string containing printf type escapes to allow
- * cursor addressing. We start out ready to print the destination
- * line, and switch each time we print row or column.
- * The following escapes are defined for substituting row/column:
- *
- * %d as in printf
- * %2 like %2d
- * %3 like %3d
- * %. gives %c hacking special case characters
- * %+x like %c but adding x first
- *
- * The codes below affect the state but don't use up a value.
- *
- * %>xy if value > x add y
- * %r reverses row/column
- * %i increments row/column (for one origin indexing)
- * %% gives %
- * %B BCD (2 decimal digits encoded in one byte)
- * %D Delta Data (backwards bcd)
- *
- * all other characters are ``self-inserting''.
- */
-char *
-tgoto(CM, destcol, destline)
- char *CM;
- int destcol, destline;
-{
- static char result[MAXRETURNSIZE];
- static char added[10];
- char *cp = CM;
- register char *dp = result;
- register int c;
- int oncol = 0;
- register int which = destline;
-
- if (cp == 0) {
-toohard:
- /*
- * ``We don't do that under BOZO's big top''
- */
- return ("OOPS");
- }
- added[0] = 0;
- while (c = *cp++) {
- if (c != '%') {
- *dp++ = c;
- continue;
- }
- switch (c = *cp++) {
-
-#ifdef CM_N
- case 'n':
- destcol ^= 0140;
- destline ^= 0140;
- goto setwhich;
-#endif
-
- case 'd':
- if (which < 10)
- goto one;
- if (which < 100)
- goto two;
- /* fall into... */
-
- case '3':
- *dp++ = (which / 100) | '0';
- which %= 100;
- /* fall into... */
-
- case '2':
-two:
- *dp++ = which / 10 | '0';
-one:
- *dp++ = which % 10 | '0';
-swap:
- oncol = 1 - oncol;
-setwhich:
- which = oncol ? destcol : destline;
- continue;
-
-#ifdef CM_GT
- case '>':
- if (which > *cp++)
- which += *cp++;
- else
- cp++;
- continue;
-#endif
-
- case '+':
- which += *cp++;
- /* fall into... */
-
- case '.':
-casedot:
- /*
- * This code is worth scratching your head at for a
- * while. The idea is that various weird things can
- * happen to nulls, EOT's, tabs, and newlines by the
- * tty driver, arpanet, and so on, so we don't send
- * them if we can help it.
- *
- * Tab is taken out to get Ann Arbors to work, otherwise
- * when they go to column 9 we increment which is wrong
- * because bcd isn't continuous. We should take out
- * the rest too, or run the thing through more than
- * once until it doesn't make any of these, but that
- * would make termlib (and hence pdp-11 ex) bigger,
- * and also somewhat slower. This requires all
- * programs which use termlib to stty tabs so they
- * don't get expanded. They should do this anyway
- * because some terminals use ^I for other things,
- * like nondestructive space.
- */
- if (which == 0 || which == CTRL('d') || /* which == '\t' || */ which == '\n') {
- if (oncol || UP) /* Assumption: backspace works */
- /*
- * Loop needed because newline happens
- * to be the successor of tab.
- */
- do {
- strcat(added, oncol ? (BC ? BC : "\b") : UP);
- which++;
- } while (which == '\n');
- }
- *dp++ = which;
- goto swap;
-
- case 'r':
- oncol = 1;
- goto setwhich;
-
- case 'i':
- destcol++;
- destline++;
- which++;
- continue;
-
- case '%':
- *dp++ = c;
- continue;
-
-#ifdef CM_B
- case 'B':
- which = (which/10 << 4) + which%10;
- continue;
-#endif
-
-#ifdef CM_D
- case 'D':
- which = which - 2 * (which%16);
- continue;
-#endif
-
- default:
- goto toohard;
- }
- }
- strcpy(dp, added);
- return (result);
-}
diff --git a/lib/libterm/tputs.c b/lib/libterm/tputs.c
deleted file mode 100644
index 857147d..0000000
--- a/lib/libterm/tputs.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 1980, 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)tputs.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sgtty.h>
-#include <ctype.h>
-
-/*
- * The following array gives the number of tens of milliseconds per
- * character for each speed as returned by gtty. Thus since 300
- * baud returns a 7, there are 33.3 milliseconds per char at 300 baud.
- */
-static
-short tmspc10[] = {
- 0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5
-};
-
-short ospeed;
-char PC;
-
-/*
- * Put the character string cp out, with padding.
- * The number of affected lines is affcnt, and the routine
- * used to output one character is outc.
- */
-tputs(cp, affcnt, outc)
- register char *cp;
- int affcnt;
- int (*outc)();
-{
- register int i = 0;
- register int mspc10;
-
- if (cp == 0)
- return;
-
- /*
- * Convert the number representing the delay.
- */
- if (isdigit(*cp)) {
- do
- i = i * 10 + *cp++ - '0';
- while (isdigit(*cp));
- }
- i *= 10;
- if (*cp == '.') {
- cp++;
- if (isdigit(*cp))
- i += *cp - '0';
- /*
- * Only one digit to the right of the decimal point.
- */
- while (isdigit(*cp))
- cp++;
- }
-
- /*
- * If the delay is followed by a `*', then
- * multiply by the affected lines count.
- */
- if (*cp == '*')
- cp++, i *= affcnt;
-
- /*
- * The guts of the string.
- */
- while (*cp)
- (*outc)(*cp++);
-
- /*
- * If no delay needed, or output speed is
- * not comprehensible, then don't try to delay.
- */
- if (i == 0)
- return;
- if (ospeed <= 0 || ospeed >= (sizeof tmspc10 / sizeof tmspc10[0]))
- return;
-
- /*
- * Round up by a half a character frame,
- * and then do the delay.
- * Too bad there are no user program accessible programmed delays.
- * Transmitting pad characters slows many
- * terminals down and also loads the system.
- */
- mspc10 = tmspc10[ospeed];
- i += mspc10 / 2;
- for (i /= mspc10; i > 0; i--)
- (*outc)(PC);
-}
diff --git a/libexec/bugfiler/bug.h b/libexec/bugfiler/bug.h
deleted file mode 100644
index 69ea986..0000000
--- a/libexec/bugfiler/bug.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)bug.h 8.1 (Berkeley) 6/4/93
- */
-
-#define BUGS_HOME "owner-bugs@ucbvax.Berkeley.EDU"
-#define BUGS_ID "bugs"
-
-/*
- * the METOO definition has the bugfiler exit with an error (-1) status
- * if there's a problem. This causes sendmail to send off a copy of the
- * report (as failed mail) to the "owner" of the mail alias that executed
- * the bugfiler. This is great if you would have otherwise lost the bug
- * report. It's not so great if you get a whole bunch of mail that you
- * really don't want.
- */
-#define METOO
-
-/* files */
-#define ACK_FILE "bug:ack" /* acknowledge file */
-#define DIST_FILE "bug:redist" /* redistribution file */
-#define ERROR_FILE "log" /* error file */
-#define LOCK_FILE "bug:lock" /* lock file name */
-#define SUMMARY_FILE "summary" /* summary file */
-#define TMP_BUG "errors/BUG_XXXXXX" /* tmp bug report */
-#define TMP_DIR "errors" /* tmp directory */
-
-#define CHN (char *)NULL /* null arg string */
-#define COMMENT '#' /* comment in redist file */
-#define EOS (char)NULL /* end of string */
-#define ERR -1 /* error return */
-#define MAXLINELEN 200 /* max line length in message */
-#define NO 0 /* no/false */
-#define OK 0 /* okay return */
-#define YES 1 /* yes/true */
-
-typedef struct {
- short found, /* line number if found */
- redist; /* if part of redist headers */
- int (*valid)(); /* validation routine */
- short len; /* length of tag */
- char *tag, /* leading tag */
- *line; /* actual line */
-} HEADER;
-extern HEADER mailhead[];
-
-#define DATE_TAG 0 /* "Date:" offset */
-#define FROM_TAG 1 /* "From " offset */
-#define CFROM_TAG 2 /* "From:" offset */
-#define INDX_TAG 3 /* "Index:" offset */
-#define MSG_TAG 4 /* "Message-Id:" offset */
-#define RPLY_TAG 5 /* "Reply-To:" offset */
-#define RET_TAG 6 /* "Return-Path:" offset */
-#define SUBJ_TAG 7 /* "Subject:" offset */
-#define TO_TAG 8 /* "To:" offset */
-#define APPAR_TO_TAG 9 /* "Apparently-To:" offset */
-
-/* so sizeof doesn't return 0 */
-extern char bfr[MAXBSIZE], /* general I/O buffer */
- dir[MAXNAMLEN], /* subject and folder */
- folder[MAXNAMLEN],
- tmpname[sizeof(TMP_BUG) + 5]; /* temp bug file */
diff --git a/libexec/bugfiler/bugfiler.8 b/libexec/bugfiler/bugfiler.8
deleted file mode 100644
index 1fc86d2..0000000
--- a/libexec/bugfiler/bugfiler.8
+++ /dev/null
@@ -1,290 +0,0 @@
-.\" Copyright (c) 1983, 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.
-.\"
-.\" @(#)bugfiler.8 8.2 (Berkeley) 12/11/93
-.\"
-.Dd December 11, 1993
-.Dt BUGFILER 8
-.Os BSD 4.2
-.Sh NAME
-.Nm bugfiler
-.Nd file bug reports in folders automatically
-.Sh SYNOPSIS
-.Nm bugfiler
-.Op Fl ar
-.Op Fl v Ar version
-.Sh DESCRIPTION
-.Nm Bugfiler
-is a program to automatically intercept, acknowledge,
-redistribute and store bug reports.
-.Nm Bugfiler
-is normally invoked
-by the mail delivery program with a line similar to the following in
-.Pa /etc/aliases .
-.Bd -literal -offset indent
-bugs: "|bugfiler"
-.Ed
-.Pp
-It should be noted that the login
-.Dq bugs
-must exist for the bugfiler
-to run. Unless otherwise noted all paths used by
-.Nm bugfiler
-are
-relative to the home directory of this login.
-.Nm Bugfiler
-also
-expects all of its files and directories to be owned by
-.Dq bugs .
-.Pp
-Available options.
-.Bl -tag -width Ds
-.It Fl a
-Do not send automatic mail acknowledgement to the bug report filer.
-(The default is to send the acknowledgement with the file
-.Pa ~bugs/version/bug:ack
-appended).
-.It Fl r
-Do not redistribute.
-.It Fl v Ar version
-Override the
-.Ar version
-provided within the bug report itself.
-.El
-.Pp
-For the bug report to be correctly filed, it must contain a line
-in the following format:
-.Pp
-.Bd -filled -offset indent -compact
-.Bl -column Index folder
-.It Index: Ta Em folder Ta Ar version
-.El
-.Ed
-.Pp
-The directories
-.Pa ~bugs/ Ns Ar version
-and
-.Pa ~bugs/ Ns Ar version/ Ns Em folder
-must exist before
-.Nm bugfiler
-attempts to store the bug report. Bug
-reports will be stored in files named by the concatenation of
-.Ar version ,
-.Em folder ,
-and sequential numbers, i.e. if
-.Ar version
-is
-.Dq 4.3 Tn BSD
-and
-.Em folder
-is
-.Dq ucb
-the first bug report will be placed in
-.Pa ~bugs/4.3BSD/ucb/1 .
-If
-.Em folder
-contains more than one component only
-the first one will be used, e.g. if
-.Em folder
-is
-.Dq bin/from.c
-or
-.Dq bin/adb/con.c
-it will be treated as if it were simply
-.Dq bin .
-.Pp
-.Pp
-If the
-.Fl r
-flag is not supplied, redistribution of the bug reports
-is done as specified in the file
-.Pa ~bugs/version/bug:redist .
-This file
-is in the format of the
-.Xr aliases 5
-file, including comments and
-entries requiring multiple lines, with the single exception that the
-.Em folder
-component of the
-.Dq Index:
-line replaces the name to alias.
-The special folder
-.Dq all:
-receives a redistribution of all bug reports
-sent to this
-.Ar version .
-For example, the
-.Pa bug:redist
-file
-.Pp
-.Bd -literal -offset indent -compact
-# bigbug gets a copy of everything
-all: bigbug
-# ucb folder redistribution list
-ucb: karels, kjd@coke.berkeley.edu
- ra@beno.css.gov
-.Ed
-.Pp
-will send copies of all bug reports with
-.Dq ucb
-as the
-.Em folder
-to bigbug, karels, kjd, and ra.
-.Pp
-Reports that cannot be filed, due to an invalid
-.Dq Index:
-line or
-some other error, are placed in the directory
-.Pa ~bugs/errors .
-The
-.Nm bugfiler
-maintainer should correct these bug reports and then
-run
-.Nm bugfiler ,
-with the corrected report as its standard input,
-as bug reports with errors are neither acknowledged or redistributed.
-All reports that
-.Nm bugfiler
-handles are logged in
-.Pa ~bugs/log.
-.Pp
-Valid bugs are also logged in the file
-.Pa ~bugs/version/summary.
-This file has an entry for each bug report for
-.Ar version
-in the
-format:
-.Pp
-.Bd -literal -offset indent -compact
-Filename Date
- Subject:
- Index:
- Owner: Bugs Bunny
- Status: Received
-.Ed
-.Pp
-.Li Filename
-is the concatenation of
-.Ar version ,
-.Em folder ,
-and a number
-as described above.
-.Xr Date
-is the date as reported by the system
-clock, using
-.Xr ctime 3 .
-The
-.Li Subject:
-and
-.Li Index:
-lines are
-copies of the
-.Dq Subject:
-and
-.Dq index:
-lines contained in the bug
-report. The
-.Li Owner
-and
-.Li Status
-fields are intended to provide a
-rudimentary method of tracking the status of bug reports.
-.Pp
-The file
-.Pa ~bugs/bug:lock
-is the focus of all locking for
-.Nm bugfiler .
-If you wish to manipulate any of the log or error files, rename or remove
-it and
-.Nm bugfiler
-will treat all bug reports that it receives as if
-they were incorrectly formatted, i.e. it will place them in the directory
-.Pa ~bugs/errors ,
-for later recovery by the
-.Nm bugfiler
-maintainer.
-Obviously, this file must be created when you first install
-.Nm bugfiler .
-.Pp
-All errors that occur before
-.Pa ~bugs/log
-is found are logged into the system
-log file, using
-.Xr syslog 8 .
-.Sh FILES
-.Bl -tag -width /usr/share/misc/bugformatxx -compact
-.It Pa ~bugs/bug:ack
-the acknowledgement message
-.It Pa ~bugs/bug:redist
-the redistribution list
-.It Pa ~bugs/bug:lock
-the locking file
-.It Pa ~bugs/errors/BUG_??????
-bug reports with format errors
-.It Pa ~bugs/log
-the log file
-.It Pa ~bugs/folder/summary
-the summary files
-.It Pa /usr/sbin/sendmail
-the mail delivery program
-.It Pa /usr/share/misc/bugformat
-a sample bug report format
-.El
-.Sh SEE ALSO
-.Xr sendbug 1 ,
-.Xr aliases 5 ,
-.Xr syslog 8
-.Sh BUGS
-Since mail can be forwarded in a number of different ways,
-.Nm bugfiler
-does not recognize forwarded mail and will acknowledge to the forwarder
-instead of the original sender unless there is a
-.Dq Reply-To
-field in the
-header.
-.Pp
-This version of
-.Nm bugfiler
-is not compatible with the version
-released with
-.Bx 4.3
-in that it doesn't complain to the sender about
-incorrectly formatted bug reports.
-Frankly, we got tired of the profanity, not to mention the extended
-conversations
-.Nm bugfiler
-was holding with
-.Xr vacation 1 .
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
diff --git a/libexec/bugfiler/bugfiler.c b/libexec/bugfiler/bugfiler.c
deleted file mode 100644
index 75dbef3..0000000
--- a/libexec/bugfiler/bugfiler.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 1983, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1983, 1986, 1987, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)bugfiler.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * Bug report processing program, designed to be invoked
- * through aliases(5).
- */
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "bug.h"
-#include "extern.h"
-
-char bfr[MAXBSIZE], /* general I/O buffer */
- tmpname[sizeof(TMP_BUG) + 5]; /* temp bug file */
-
-static void logit __P((void));
-static void make_copy __P((void));
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- extern char *optarg; /* getopt arguments */
- register struct passwd *pwd; /* bugs password entry */
- register int ch; /* getopts char */
- int do_ack, /* acknowledge bug report */
- do_redist; /* redistribut BR */
- char *argversion; /* folder name provided */
-
- do_ack = do_redist = YES;
- argversion = NULL;
- while ((ch = getopt(argc, argv, "av:r")) != EOF)
- switch(ch) {
- case 'a':
- do_ack = NO;
- break;
- case 'v':
- argversion = optarg;
- break;
- case 'r':
- do_redist = NO;
- break;
- case '?':
- default:
- fputs("usage: bugfiler [-ar] [-v version]\n", stderr);
- error("usage: bugfiler [-ar] [-v version]", CHN);
- }
-
- if (!(pwd = getpwnam(BUGS_ID)))
- error("can't find bugs login.", BUGS_ID);
-
- if (chdir(pwd->pw_dir)) /* change to bugs home directory */
- error("can't chdir to %s.", pwd->pw_dir);
-
- if (seteuid(pwd->pw_uid))
- error("can't set id to %s.", BUGS_ID);
-
- (void)umask(02); /* everything is 664 */
- seterr(); /* redirect to log file */
- logit(); /* log report arrival */
- make_copy(); /* save copy in case */
- gethead(do_redist);
-
- if (argversion) /* specific folder requested */
- (void)strcpy(dir, argversion);
-
- process();
-
- if (seteuid(0))
- error("can't set id to root.", CHN);
- if (do_ack)
- reply();
- if (do_redist)
- redist();
- (void)unlink(tmpname);
- exit(OK);
-}
-
-/*
- * make_copy --
- * make a copy of bug report in error folder
- */
-static void
-make_copy()
-{
- register int cnt, /* read return value */
- tfd; /* temp file descriptor */
-
- if (access(TMP_DIR, F_OK))
- (void)mkdir(TMP_DIR, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
- (void)strcpy(tmpname, TMP_BUG);
- if (tfd = mkstemp(tmpname)) {
- while ((cnt = read(fileno(stdin),
- bfr, sizeof(bfr))) != ERR && cnt)
- write(tfd, bfr, cnt);
- (void)close(tfd);
- return;
- }
- error("can't make copy using %s.", tmpname);
-}
-
-/*
- * logit --
- * log this run of the bugfiler
- */
-static void
-logit()
-{
- struct timeval tp;
- char *C1, *C2;
-
- if (gettimeofday(&tp, (struct timezone *)NULL))
- error("can't get time of day.", CHN);
- for (C1 = C2 = ctime(&tp.tv_sec); *C1 && *C1 != '\n'; ++C1);
- *C1 = EOS;
- fputs(C2, stderr);
-}
diff --git a/libexec/bugfiler/bugformat b/libexec/bugfiler/bugformat
deleted file mode 100644
index 97a767d..0000000
--- a/libexec/bugfiler/bugformat
+++ /dev/null
@@ -1,32 +0,0 @@
-Subject: Short summary of the problem (please make this meaningful!)
-Index: folder 4.4BSD-alpha
-
-Description:
- Detailed description of the problem, suggestion, or complaint.
-Repeat-By:
- Describe the sequence of events that causes the problem
- to occur.
-Fix:
- Description of how to fix the problem. If you don't know a
- fix for the problem, don't include this section.
-
--------- Remove this line and what's below it, for reference only. --------
-
-To ensure that your bug report is handled correctly by bugfiler(8),
-you must replace "folder" (on the line above starting with "Index:")
-with one of the following values:
-
- folder ::= bin | doc | etc | games | ideas | include | lib
- | local | man | misc | new | sys | ucb
- | usr.bin | usr.lib
-
-If you're not running 4.3BSD, you should also replace "4.3BSD" on
-the same line with one of the following values.
-
- version ::= 4.3BSD | 4.3BSD-tahoe | 4.3BSD-reno | net2
- | 4.4BSD-alpha
-
-For example, if your bug concerns the program "/usr/bin/file" and
-you're currently running 4.3BSD-Reno, you should replace "folder"
-with "usr.bin/file", and "4.4BSD-alpha" with "4.3BSD-Reno". The folder
-"ideas" is for suggestions.
diff --git a/libexec/bugfiler/error.c b/libexec/bugfiler/error.c
deleted file mode 100644
index bd00b2b..0000000
--- a/libexec/bugfiler/error.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)error.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-
-#include <dirent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-
-#include "bug.h"
-#include "extern.h"
-
-static short err_redir; /* stderr redirected */
-
-/*
- * seterr --
- * redirect stderr for error processing
- */
-void
-seterr()
-{
- if (!freopen(ERROR_FILE, "a", stderr))
- error("can't open error file %s.", ERROR_FILE);
- err_redir = YES;
-}
-
-/*
- * error --
- * write errors to log file and die
- */
-void
-error(fmt, arg)
- register char *fmt,
- *arg;
-{
- static char logmsg[MAXLINELEN]; /* syslog message */
-
- if (err_redir) {
- /* don't combine these, "fmt" may not require "arg" */
- fprintf(stderr, "\t%s\n\t", tmpname);
- fprintf(stderr, fmt, arg);
- fputc('\n', stderr);
- }
- else {
- sprintf(logmsg, "bugfiler: %s", fmt);
- syslog(LOG_ERR, logmsg, arg);
- }
-#ifdef METOO
- exit(ERR);
-#else
- exit(OK);
-#endif
-}
diff --git a/libexec/bugfiler/extern.h b/libexec/bugfiler/extern.h
deleted file mode 100644
index b096f3d..0000000
--- a/libexec/bugfiler/extern.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)extern.h 8.1 (Berkeley) 6/4/93
- */
-
-void error __P((char *, char *));
-void gethead __P((int));
-int process __P((void));
-void redist __P((void));
-void reply __P((void));
-void seterr __P((void));
diff --git a/libexec/bugfiler/gethead.c b/libexec/bugfiler/gethead.c
deleted file mode 100644
index ba7e361..0000000
--- a/libexec/bugfiler/gethead.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)gethead.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "pathnames.h"
-#include "bug.h"
-#include "extern.h"
-
-static int chk1 __P((char *));
-static int pbuf __P((char *));
-
-#define ENT(X) sizeof(X) - 1, X
-HEADER mailhead[] = { /* mail headers */
- { NO, YES, NULL, ENT("Date:"), },
- { NO, NO, NULL, ENT("From "), },
- { NO, YES, NULL, ENT("From:"), },
- { NO, NO, chk1, ENT("Index:"), },
- { NO, YES, NULL, ENT("Message-Id:"), },
- { NO, YES, NULL, ENT("Reply-To:"), },
- { NO, YES, NULL, ENT("Return-Path:"), },
- { NO, NO, pbuf, ENT("Subject:"), },
- { NO, YES, NULL, ENT("To:"), },
- { NO, NO, NULL, ENT("Apparently-To:"), },
- { ERR, }
-};
-
-FILE *dfp; /* distf file pointer */
-char dir[MAXNAMLEN], /* subject and folder */
- folder[MAXNAMLEN];
-
-/*
- * gethead --
- * read mail and bug headers from bug report, construct redist headers
- */
-void
-gethead(redist)
- int redist;
-{
- register HEADER *hp; /* mail header pointer */
-
- if (redist) {
- int fd;
- char *distf;
-
- distf = strdup(_PATH_TMP);
- if (!(fd = mkstemp(distf)) || !(dfp = fdopen(fd, "w+")))
- error("can't create redistribution file %s.", distf);
- /* disappear after last reference is closed */
- (void)unlink(distf);
- free(distf);
- }
- if (!freopen(tmpname, "r", stdin))
- error("can't read temporary bug file %s.", tmpname);
-
- while (fgets(bfr, sizeof(bfr), stdin)) {
- for (hp = mailhead; hp->found != ERR; ++hp)
- if (!hp->found)
- if (!strncmp(hp->tag, bfr, hp->len)) {
- if (hp->valid && !((*(hp->valid))(bfr)))
- break;
- if (!(hp->line =
- malloc((u_int)(strlen(bfr) + 1))))
- error("malloc failed.", CHN);
- (void)strcpy(hp->line, bfr);
- hp->found = YES;
- break;
- }
- if ((hp->found == ERR || hp->redist) && redist)
- fputs(bfr, dfp);
- }
-
- if (!mailhead[INDX_TAG].found)
- error("no readable \"Index:\" header in bug report.", CHN);
-}
-
-/*
- * chk1 --
- * parse the "Index:" line into folder and directory
- */
-static int
-chk1(line)
- char *line;
-{
- register char *C; /* tmp pointer */
- struct stat sbuf; /* existence check */
-
- if (sscanf(line, " Index: %s %s ", folder, dir) != 2)
- return(NO);
- if (C = strchr(folder, '/')) { /* deal with "bin/from.c" */
- if (C == folder)
- return(NO);
- *C = EOS;
- }
- if (stat(dir, &sbuf) || (sbuf.st_mode & S_IFMT) != S_IFDIR)
- return(NO);
- (void)pbuf(line);
- return(YES);
-}
-
-/*
- * pbuf --
- * kludge so that summary file looks pretty
- */
-static int
-pbuf(line)
- char *line;
-{
- register char *rp, /* tmp pointers */
- *wp;
-
- for (rp = line; *rp == ' ' || *rp == '\t'; ++rp);
- for (wp = line; *rp; ++wp) {
- if ((*wp = *rp++) != ' ' && *wp != '\t')
- continue;
- *wp = ' ';
- while (*rp == ' ' || *rp == '\t')
- ++rp;
- }
- if (wp[-1] == ' ') /* wp can't == line */
- --wp;
- *wp = EOS;
- return(YES);
-}
diff --git a/libexec/bugfiler/pathnames.h b/libexec/bugfiler/pathnames.h
deleted file mode 100644
index 7ff5ab6..0000000
--- a/libexec/bugfiler/pathnames.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/4/93
- */
-
-#define MAIL_CMD "/usr/sbin/sendmail -i -t -F \"Bugs Bunny\" -f owner-bugs"
-#undef _PATH_TMP
-#define _PATH_TMP "/tmp/BUG_XXXXXX"
diff --git a/libexec/bugfiler/process.c b/libexec/bugfiler/process.c
deleted file mode 100644
index 6d376fd..0000000
--- a/libexec/bugfiler/process.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)process.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/time.h>
-
-#include <ctype.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "bug.h"
-#include "extern.h"
-
-char pfile[MAXPATHLEN]; /* permanent file name */
-
-static int getnext __P((void));
-
-/*
- * process --
- * copy report to permanent file,
- * update summary file.
- */
-int
-process()
-{
- register int rval; /* read return value */
- struct timeval tp; /* time of day */
- int lfd; /* lock file descriptor */
-
- if (access(LOCK_FILE, R_OK) || (lfd = open(LOCK_FILE, O_RDONLY, 0)) < 0)
- error("can't find lock file %s.", LOCK_FILE);
- if (flock(lfd, LOCK_EX))
- error("can't get lock.", CHN);
- sprintf(pfile, "%s/%s/%d", dir, folder, getnext());
- fprintf(stderr, "\t%s\n", pfile);
- if (!(freopen(pfile, "w", stdout)))
- error("can't create %s.", pfile);
- rewind(stdin);
- while ((rval = read(fileno(stdin), bfr, sizeof(bfr))) != ERR && rval)
- if (write(fileno(stdout), bfr, rval) != rval)
- error("write to %s failed.", pfile);
-
- /* append information to the summary file */
- sprintf(bfr, "%s/%s", dir, SUMMARY_FILE);
- if (!(freopen(bfr, "a", stdout)))
- error("can't append to summary file %s.", bfr);
- if (gettimeofday(&tp, (struct timezone *)NULL))
- error("can't get time of day.", CHN);
- printf("\n%s\t\t%s\t%s\t%s\tOwner: Bugs Bunny\n\tStatus: Received\n",
- pfile, ctime(&tp.tv_sec), mailhead[INDX_TAG].line,
- mailhead[SUBJ_TAG].found ? mailhead[SUBJ_TAG].line : "Subject:\n");
- (void)flock(lfd, LOCK_UN);
- (void)fclose(stdout);
-}
-
-/*
- * getnext --
- * get next file name (number)
- */
-static int
-getnext()
-{
- register struct dirent *d; /* directory structure */
- register DIR *dirp; /* directory pointer */
- register int highval, newval;
- register char *p;
-
- (void)sprintf(bfr, "%s/%s", dir, folder);
- if (!(dirp = opendir(bfr)))
- error("can't read folder directory %s.", bfr);
- for (highval = -1; d = readdir(dirp);) {
- for (p = d->d_name; *p && isdigit(*p); ++p);
- if (!*p && (newval = atoi(d->d_name)) > highval)
- highval = newval;
- }
- closedir(dirp);
- return(++highval);
-}
diff --git a/libexec/bugfiler/redist.c b/libexec/bugfiler/redist.c
deleted file mode 100644
index 87a18b6..0000000
--- a/libexec/bugfiler/redist.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)redist.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-
-#include <ctype.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "bug.h"
-#include "pathnames.h"
-#include "extern.h"
-
-/*
- * redist --
- * Redistribute a bug report to those people indicated in the
- * redistribution list file.
- */
-void
-redist()
-{
- extern FILE *dfp; /* dist file fp */
- extern char pfile[]; /* permanent bug file */
- register char *C1, *C2;
- FILE *pf;
- int group;
-
- (void)sprintf(bfr, "%s/%s", dir, DIST_FILE);
- if (!freopen(bfr, "r", stdin))
- return;
- for (pf = NULL, group = 0; fgets(bfr, sizeof(bfr), stdin);) {
- if (C1 = strchr(bfr, '\n'))
- *C1 = '\0';
-nextline: if (*bfr == COMMENT ||
- isspace(*bfr) || !(C1 = index(bfr, ':')))
- continue;
- *C1 = EOS;
- if (!strcmp(bfr, folder) || !strcmp(bfr, "all")) {
- for (++C1; *C1 && (*C1 == ' ' || *C1 == '\t'); ++C1);
- if (!*C1) /* if empty list */
- continue;
- if (!pf) {
- if (!(pf = popen(MAIL_CMD, "w")))
- error("sendmail pipe failed.", CHN);
- if (mailhead[SUBJ_TAG].found)
- fprintf(pf,
- "%s", mailhead[SUBJ_TAG].line);
- else
- fprintf(pf,
- "Subject: Untitled Bug Report\n");
- if (!mailhead[TO_TAG].line) {
- if (mailhead[APPAR_TO_TAG].line)
- fprintf(pf, "To%s",
- strchr(mailhead[APPAR_TO_TAG].line,
- ':'));
- else
- fprintf(pf, "To: %s\n", BUGS_ID);
- }
- fputs("Resent-To: ", pf);
- }
- /*
- * write out first entry, then succeeding entries
- * backward compatible, handles back slashes at end
- * of line
- */
- if (group++)
- fputs(", ", pf);
- for (;;) {
- if (C2 = strchr(C1, '\\'))
- *C2 = EOS;
- fputs(C1, pf);
- if (!fgets(bfr, sizeof(bfr), stdin))
- break;
- if (C1 = strchr(bfr, '\n'))
- *C1 = '\0';
- if (*bfr != ' ' && *bfr != '\t')
- goto nextline;
- for (C1 = bfr;
- *C1 && (*C1 == ' ' || *C1 == '\t'); ++C1);
- }
- }
- }
- if (!pf)
- return;
-
- putc('\n', pf);
-
- rewind(dfp);
- /* add Reference header and copy bug report out */
- while (fgets(bfr, sizeof(bfr), dfp) && *bfr != '\n')
- fputs(bfr, pf);
- fprintf(pf, "\n%sReference: %s\n\n", mailhead[INDX_TAG].line, pfile);
- while (fgets(bfr, sizeof(bfr), dfp))
- fputs(bfr, pf);
- (void)pclose(pf);
-}
diff --git a/libexec/bugfiler/reply.c b/libexec/bugfiler/reply.c
deleted file mode 100644
index 0f99401..0000000
--- a/libexec/bugfiler/reply.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)reply.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "bug.h"
-#include "extern.h"
-#include "pathnames.h"
-
-/*
- * reply --
- * tell the user we got their silly little bug report
- */
-void
-reply()
-{
- register char *C, /* traveling pointer */
- *to; /* who we're replying to */
- register int afd, /* ack file descriptor */
- rval; /* return value */
- FILE *pf; /* pipe pointer */
-
- if (mailhead[RPLY_TAG].found) {
- for (C = mailhead[RPLY_TAG].line + mailhead[RPLY_TAG].len;
- *C != '\n' && (*C == ' ' || *C == '\t');++C);
- if (*C)
- goto gotone;
- }
- if (mailhead[FROM_TAG].found) {
- for (C = mailhead[FROM_TAG].line + mailhead[FROM_TAG].len;
- *C != '\n' && (*C == ' ' || *C == '\t');++C);
- if (*C)
- goto gotone;
- }
- if (mailhead[CFROM_TAG].found) {
- for (C = mailhead[CFROM_TAG].line + mailhead[CFROM_TAG].len;
- *C != '\n' && (*C == ' ' || *C == '\t');++C);
- if (*C)
- goto gotone;
- }
- return;
-
- /* if it's a foo <XXX>, get the XXX, else get foo (first string) */
-gotone: if (to = strchr(C, '<'))
- for (C = ++to;
- *C != '\n' && *C != ' ' && *C != '\t' && *C != '>';++C);
- else {
- to = C;
- for (to = C++;*C != '\n' && *C != ' ' && *C != '\t';++C);
- }
- *C = EOS;
-
- if (!(pf = popen(MAIL_CMD, "w")))
- error("sendmail pipe failed.", CHN);
-
- fprintf(pf, "Reply-To: %s\nFrom: %s (Bugs Bunny)\nTo: %s\n",
- BUGS_HOME, BUGS_HOME, to);
- if (mailhead[SUBJ_TAG].found)
- fprintf(pf, "Subject: Re:%s",
- mailhead[SUBJ_TAG].line + mailhead[SUBJ_TAG].len);
- else
- fputs("Subject: Bug report acknowledgement.\n", pf);
- if (mailhead[DATE_TAG].found)
- fprintf(pf, "In-Acknowledgement-Of: Your message of %s",
- mailhead[DATE_TAG].line + mailhead[DATE_TAG].len);
- if (mailhead[MSG_TAG].found)
- fprintf(pf, "\t\t%s", mailhead[MSG_TAG].line);
- fputs("Precedence: bulk\n\n", pf); /* vacation(1) uses this... */
- fflush(pf);
-
- (void)sprintf(bfr, "%s/%s", dir, ACK_FILE);
- if ((afd = open(bfr, O_RDONLY, 0)) >= 0) {
- while ((rval = read(afd, bfr, sizeof(bfr))) != ERR && rval)
- (void)write(fileno(pf), bfr, rval);
- (void)close(afd);
- }
- pclose(pf);
-}
diff --git a/libexec/bugfiler/sendbug.1 b/libexec/bugfiler/sendbug.1
deleted file mode 100644
index 31ca802..0000000
--- a/libexec/bugfiler/sendbug.1
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1983, 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.
-.\"
-.\" @(#)sendbug.1 8.1 (Berkeley) 6/4/93
-.\"
-.Dd June 4, 1993
-.Dt SENDBUG 1
-.Os BSD 4.2
-.Sh NAME
-.Nm sendbug
-.Nd mail a system bug report to 4bsd-bugs
-.Sh SYNOPSIS
-.Nm sendbug
-.Op Ar address
-.Sh DESCRIPTION
-Bug reports sent to `4bsd-bugs@Berkeley.EDU' are intercepted
-by a program which expects bug reports to conform to a standard format.
-.Nm Sendbug
-is a shell script to help the user compose and mail bug reports
-in the correct format.
-.Nm Sendbug
-works by invoking the editor specified by the environment variable
-.Ev EDITOR
-on a temporary copy of the bug report format outline. The user must fill in the
-appropriate fields and exit the editor.
-.Nm Sendbug
-then mails the completed report to `4bsd-bugs@Berkeley.EDU' or the
-.Ar address
-specified on the command line.
-.Sh ENVIRONMENT
-.Nm Sendbug
-will utilize the following environment variable if it exists:
-.Bl -tag -width EDITOR
-.It Ev EDITOR
-Specifies the preferred editor. If
-.Ev EDITOR
-is not set,
-.Nm
-defaults to
-.Xr vi 1 .
-.El
-.Sh FILES
-.Bl -tag -width /usr/share/misc/bugformat -compact
-.It Pa /usr/share/misc/bugformat
-Contains the bug report outline.
-.El
-.Sh SEE ALSO
-.Xr vi 1 ,
-.Xr environ 7 ,
-.Xr bugfiler 8 ,
-.Xr sendmail 8
-.Sh HISTORY
-The
-.Nm sendbug
-command
-appeared in
-.Bx 4.2 .
diff --git a/libexec/bugfiler/sendbug.sh b/libexec/bugfiler/sendbug.sh
deleted file mode 100644
index 911ef9d..0000000
--- a/libexec/bugfiler/sendbug.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh -
-#
-# Copyright (c) 1983, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of
-# California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)sendbug.sh 8.1 (Berkeley) 6/4/93
-#
-
-# create a bug report and mail it to '4bsd-bugs'.
-
-PATH=/bin:/sbin:/usr/sbin:/usr/bin
-export PATH
-
-TEMP=/tmp/bug$$
-FORMAT=/usr/share/misc/bugformat
-
-# uucp sites should use ": ${BUGADDR=ucbvax!4bsd-bugs}" with a suitable path.
-: ${BUGADDR=4bsd-bugs@CS.Berkeley.EDU}
-: ${EDITOR=vi}
-
-trap 'rm -f $TEMP ; exit 1' 1 2 3 13 15
-
-cp $FORMAT $TEMP
-chmod u+w $TEMP
-if $EDITOR $TEMP
-then
- if cmp -s $FORMAT $TEMP
- then
- echo "File not changed, no bug report submitted."
- exit
- fi
- case "$#" in
- 0) sendmail -t -oi $BUGADDR < $TEMP ;;
- *) sendmail -t -oi "$@" < $TEMP ;;
- esac
-fi
-
-rm -f $TEMP
diff --git a/libexec/getty/ttydefaults.c b/libexec/getty/ttydefaults.c
deleted file mode 100644
index 518f41b..0000000
--- a/libexec/getty/ttydefaults.c
+++ /dev/null
@@ -1,54 +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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)ttydefaults.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <sys/termios.h>
-
-#include "extern.h"
-
-void
-set_ttydefaults(fd)
- int fd;
-{
- struct termios term;
-
- tcgetattr(fd, &term);
- term.c_iflag = TTYDEF_IFLAG;
- term.c_oflag = TTYDEF_OFLAG;
- term.c_lflag = TTYDEF_LFLAG;
- term.c_cflag = TTYDEF_CFLAG;
- tcsetattr(fd, TCSAFLUSH, &term);
-}
diff --git a/libexec/kpasswdd/kpasswdd.8 b/libexec/kpasswdd/kpasswdd.8
deleted file mode 100644
index f6a401f..0000000
--- a/libexec/kpasswdd/kpasswdd.8
+++ /dev/null
@@ -1,60 +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.
-.\"
-.\" @(#)kpasswdd.8 8.1 (Berkeley) 6/9/93
-.\"
-.Dd June 9, 1993
-.Dt KPASSWDD 8
-.Os
-.Sh NAME
-.Nm kpasswdd
-.Nd Kerberos password changing daemon
-.Sh SYNOPSIS
-.Nm kpasswdd
-.Sh DESCRIPTION
-.Nm Kpasswdd
-is the server for the
-.Xr passwd 1
-program.
-The server provides a remote password changing facility
-with Kerberos authentication.
-A user must provide the old Kerberos password, encrypted
-in a random session key, to the server.
-.Nm Kpasswdd
-runs only on the Kerberos server, as it directly updates the
-Kerberos database.
-.Sh SEE ALSO
-.Xr kerberos 1 ,
-.Xr passwd 1
-.Sh HISTORY
-The
-.Nm kpasswdd
-utility first appeared in 4.4BSD.
diff --git a/libexec/kpasswdd/kpasswdd.c b/libexec/kpasswdd/kpasswdd.c
deleted file mode 100644
index 23ff1f8..0000000
--- a/libexec/kpasswdd/kpasswdd.c
+++ /dev/null
@@ -1,271 +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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)kpasswdd.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-/*
- * kpasswdd - update a principal's passwd field in the Kerberos
- * database. Called from inetd.
- * K. Fall
- * 12-Dec-88
- */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/signal.h>
-#include <netinet/in.h>
-#include <pwd.h>
-#include <syslog.h>
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-#include <kerberosIV/krb_db.h>
-#include <stdio.h>
-#include "kpasswd_proto.h"
-
-static struct kpasswd_data kpwd_data;
-static des_cblock master_key, key;
-static Key_schedule master_key_schedule,
- key_schedule, random_sched;
-long mkeyversion;
-AUTH_DAT kdata;
-static Principal principal_data;
-static struct update_data ud_data;
-
-char inst[INST_SZ];
-char version[9];
-KTEXT_ST ticket;
-
-char *progname; /* for the library */
-
-main()
-{
- struct sockaddr_in foreign;
- int foreign_len = sizeof(foreign);
- int rval, more;
- static char name[] = "kpasswdd";
-
- static struct rlimit rl = { 0, 0 };
-
- progname = name;
- openlog("kpasswdd", LOG_CONS | LOG_PID, LOG_AUTH);
-
- signal(SIGHUP, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
- if (setrlimit(RLIMIT_CORE, &rl) < 0) {
- syslog(LOG_ERR, "setrlimit: %m");
- exit(1);
- }
-
- if (getpeername(0, &foreign, &foreign_len) < 0) {
- syslog(LOG_ERR,"getpeername: %m");
- exit(1);
- }
-
- strcpy(inst, "*");
- rval = krb_recvauth(
- 0L, /* options--!MUTUAL */
- 0, /* file desc */
- &ticket, /* client's ticket */
- SERVICE, /* expected service */
- inst, /* expected instance */
- &foreign, /* foreign addr */
- (struct sockaddr_in *) 0, /* local addr */
- &kdata, /* returned krb data */
- "", /* service keys file */
- (bit_64 *) NULL, /* returned key schedule */
- version
- );
-
-
- if (rval != KSUCCESS) {
- syslog(LOG_NOTICE, "krb_recvauth: %s", krb_err_txt[rval]);
- cleanup();
- exit(1);
- }
-
- if (*version == '\0') {
- /* indicates error on client's side (no tickets, etc.) */
- cleanup();
- exit(0);
- } else if (strcmp(version, "KPWDV0.1") != 0) {
- syslog(LOG_NOTICE,
- "kpasswdd version conflict (recv'd %s)",
- version);
- cleanup();
- exit(1);
- }
-
-
- /* get master key */
- if (kdb_get_master_key(0, master_key, master_key_schedule) != 0) {
- syslog(LOG_ERR, "couldn't get master key");
- cleanup();
- exit(1);
- }
-
- mkeyversion = kdb_get_master_key(NULL, master_key, master_key_schedule);
-
- if (mkeyversion < 0) {
- syslog(LOG_NOTICE, "couldn't verify master key");
- cleanup();
- exit(1);
- }
-
- /* get principal info */
- rval = kerb_get_principal(
- kdata.pname,
- kdata.pinst,
- &principal_data,
- 1,
- &more
- );
-
- if (rval < 0) {
- syslog(LOG_NOTICE,
- "error retrieving principal record for %s.%s",
- kdata.pname, kdata.pinst);
- cleanup();
- exit(1);
- }
-
- if (rval != 1 || (more != 0)) {
- syslog(LOG_NOTICE, "more than 1 dbase entry for %s.%s",
- kdata.pname, kdata.pinst);
- cleanup();
- exit(1);
- }
-
- /* get the user's key */
-
- bcopy(&principal_data.key_low, key, 4);
- bcopy(&principal_data.key_high, ((long *) key) + 1, 4);
- kdb_encrypt_key(key, key, master_key, master_key_schedule,
- DECRYPT);
- key_sched(key, key_schedule);
- des_set_key(key, key_schedule);
-
-
- /* get random key and send it over {random} Kperson */
-
- random_key(kpwd_data.random_key);
- strcpy(kpwd_data.secure_msg, SECURE_STRING);
- if (des_write(0, &kpwd_data, sizeof(kpwd_data)) != sizeof(kpwd_data)) {
- syslog(LOG_NOTICE, "error writing initial data");
- cleanup();
- exit(1);
- }
-
- bzero(key, sizeof(key));
- bzero(key_schedule, sizeof(key_schedule));
-
- /* now read update info: { info }Krandom */
-
- key_sched(kpwd_data.random_key, random_sched);
- des_set_key(kpwd_data.random_key, random_sched);
- if (des_read(0, &ud_data, sizeof(ud_data)) != sizeof(ud_data)) {
- syslog(LOG_NOTICE, "update aborted");
- cleanup();
- exit(1);
- }
-
- /* validate info string by looking at the embedded string */
-
- if (strcmp(ud_data.secure_msg, SECURE_STRING) != 0) {
- syslog(LOG_NOTICE, "invalid update from %s",
- inet_ntoa(foreign.sin_addr));
- cleanup();
- exit(1);
- }
-
- /* produce the new key entry in the database { key }Kmaster */
- string_to_key(ud_data.pw, key);
- kdb_encrypt_key(key, key,
- master_key, master_key_schedule,
- ENCRYPT);
- bcopy(key, &principal_data.key_low, 4);
- bcopy(((long *) key) + 1,
- &principal_data.key_high, 4);
- bzero(key, sizeof(key));
- principal_data.key_version++;
- if (kerb_put_principal(&principal_data, 1)) {
- syslog(LOG_ERR, "couldn't write new record for %s.%s",
- principal_data.name, principal_data.instance);
- cleanup();
- exit(1);
- }
-
- syslog(LOG_NOTICE,"wrote new password field for %s.%s from %s",
- principal_data.name,
- principal_data.instance,
- inet_ntoa(foreign.sin_addr)
- );
-
- send_ack(0, "Update complete.\n");
- cleanup();
- exit(0);
-}
-
-cleanup()
-{
- bzero(&kpwd_data, sizeof(kpwd_data));
- bzero(master_key, sizeof(master_key));
- bzero(master_key_schedule, sizeof(master_key_schedule));
- bzero(key, sizeof(key));
- bzero(key_schedule, sizeof(key_schedule));
- bzero(random_sched, sizeof(random_sched));
- bzero(&principal_data, sizeof(principal_data));
- bzero(&ud_data, sizeof(ud_data));
-}
-
-send_ack(remote, msg)
- int remote;
- char *msg;
-{
- int cc;
- cc = des_write(remote, msg, strlen(msg) + 1);
- if (cc <= 0) {
- syslog(LOG_NOTICE, "error writing ack");
- cleanup();
- exit(1);
- }
-}
diff --git a/libexec/telnetd/authenc.c b/libexec/telnetd/authenc.c
deleted file mode 100644
index fcd17fc..0000000
--- a/libexec/telnetd/authenc.c
+++ /dev/null
@@ -1,91 +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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#if defined(AUTHENTICATION) || defined(ENCRYPTION)
-#include "telnetd.h"
-#include <libtelnet/misc.h>
-
- int
-net_write(str, len)
- unsigned char *str;
- int len;
-{
- if (nfrontp + len < netobuf + BUFSIZ) {
- bcopy((void *)str, (void *)nfrontp, len);
- nfrontp += len;
- return(len);
- }
- return(0);
-}
-
- void
-net_encrypt()
-{
-#ifdef ENCRYPTION
- char *s = (nclearto > nbackp) ? nclearto : nbackp;
- if (s < nfrontp && encrypt_output) {
- (*encrypt_output)((unsigned char *)s, nfrontp - s);
- }
- nclearto = nfrontp;
-#endif /* ENCRYPTION */
-}
-
- int
-telnet_spin()
-{
- ttloop();
- return(0);
-}
-
- char *
-telnet_getenv(val)
- char *val;
-{
- extern char *getenv();
- return(getenv(val));
-}
-
- char *
-telnet_gets(prompt, result, length, echo)
- char *prompt;
- char *result;
- int length;
- int echo;
-{
- return((char *)0);
-}
-#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
diff --git a/sbin/disklabel/disklabel.5.5 b/sbin/disklabel/disklabel.5.5
deleted file mode 100644
index fb6f6cd..0000000
--- a/sbin/disklabel/disklabel.5.5
+++ /dev/null
@@ -1,384 +0,0 @@
-.\" Copyright (c) 1987, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Symmetric Computer Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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.
-.\"
-.\" @(#)disklabel.5.5 8.1 (Berkeley) 6/5/93
-.\"
-.Dd June 5, 1993
-.Dt DISKLABEL 5
-.Os
-.Sh NAME
-.Nm disklabel
-.Nd disk pack label
-.Sh SYNOPSIS
-.Fd #include <sys/disklabel.h>
-.Sh DESCRIPTION
-Each disk or disk pack on a system may contain a disk label
-which provides detailed information
-about the geometry of the disk and the partitions into which the disk
-is divided.
-It should be initialized when the disk is formatted,
-and may be changed later with the
-.Xr disklabel 8
-program.
-This information is used by the system disk driver and by the bootstrap
-program to determine how to program the drive
-and where to find the filesystems on the disk partitions.
-Additional information is used by the filesystem in order
-to use the disk most efficiently and to locate important filesystem information.
-The description of each partition contains an identifier for the partition
-type (standard filesystem, swap area, etc.).
-The filesystem updates the in-core copy of the label if it contains
-incomplete information about the filesystem.
-.Pp
-The label is located in sector number
-.Dv LABELSECTOR
-of the drive, usually sector 0 where it may be found
-without any information about the disk geometry.
-It is at an offset
-.Dv LABELOFFSET
-from the beginning of the sector, to allow room for the initial bootstrap.
-The disk sector containing the label is normally made read-only
-so that it is not accidentally overwritten by pack-to-pack copies
-or swap operations;
-the
-.Dv DIOCWLABEL
-.Xr ioctl 2 ,
-which is done as needed by the
-.Xr disklabel
-program.
-.Pp
-A copy of the in-core label for a disk can be obtained with the
-.Dv DIOCGDINFO
-.Xr ioctl ;
-this works with a file descriptor for a block or character (``raw'') device
-for any partition of the disk.
-The in-core copy of the label is set by the
-.Dv DIOCSDINFO
-.Xr ioctl .
-The offset of a partition cannot generally be changed while it is open,
-nor can it be made smaller while it is open.
-One exception is that any change is allowed if no label was found
-on the disk, and the driver was able to construct only a skeletal label
-without partition information.
-Finally, the
-.Dv DIOCWDINFO
-.Xr ioctl
-operation sets the in-core label and then updates the on-disk label;
-there must be an existing label on the disk for this operation to succeed.
-Thus, the initial label for a disk or disk pack must be installed
-by writing to the raw disk.
-All of these operations are normally done using
-.Xr disklabel .
-.Pp
-The format of the disk label, as specified in
-.Aw Pa sys/disklabel.h ,
-is
-.Bd -literal
-/*
-* Disk description table, see disktab(5)
-*/
-#define DISKTAB "/etc/disktab"
-
-/*
-* Each disk has a label which includes information about the hardware
-* disk geometry, filesystem partitions, and drive specific information.
-* The label is in block 0 or 1, possibly offset from the beginning
-* to leave room for a bootstrap, etc.
-*/
-
-#ifndef LABELSECTOR
-#define LABELSECTOR 0 /* sector containing label */
-#endif
-
-#ifndef LABELOFFSET
-#define LABELOFFSET 64 /* offset of label in sector */
-#endif
-
-#define DISKMAGIC ((u_long) 0x82564557) /* The disk magic number */
-#ifndef MAXPARTITIONS
-#define MAXPARTITIONS 8
-#endif
-
-#ifndef LOCORE
-struct disklabel {
- u_long d_magic; /* the magic number */
- short d_type; /* drive type */
- short d_subtype; /* controller/d_type specific */
- char d_typename[16]; /* type name, e.g. "eagle" */
- /*
- * d_packname contains the pack identifier and is returned when
- * the disklabel is read off the disk or in-core copy.
- * d_boot0 and d_boot1 are the (optional) names of the
- * primary (block 0) and secondary (block 1-15) bootstraps
- * as found in /usr/mdec. These are returned when using
- * getdiskbyname(3)
- to retrieve the values from /etc/disktab.
- */
-#if defined(KERNEL) || defined(STANDALONE)
- char d_packname[16]; /* pack identifier */
-#else
- union {
- char un_d_packname[16]; /* pack identifier */
- struct {
- char *un_d_boot0; /* primary bootstrap name */
- char *un_d_boot1; /* secondary bootstrap name */
- } un_b;
- } d_un;
-
-#define d_packname d_un.un_d_packname
-#define d_boot0 d_un.un_b.un_d_boot0
-#define d_boot1 d_un.un_b.un_d_boot1
-#endif /* ! KERNEL or STANDALONE */
-
- /* disk geometry: */
- u_long d_secsize; /* # of bytes per sector */
- u_long d_nsectors; /* # of data sectors per track */
- u_long d_ntracks; /* # of tracks per cylinder */
- u_long d_ncylinders; /* # of data cylinders per unit */
- u_long d_secpercyl; /* # of data sectors per cylinder */
- u_long d_secperunit; /* # of data sectors per unit */
- /*
- * Spares (bad sector replacements) below
- * are not counted in d_nsectors or d_secpercyl.
- * Spare sectors are assumed to be physical sectors
- * which occupy space at the end of each track and/or cylinder.
- */
- u_short d_sparespertrack; /* # of spare sectors per track */
- u_short d_sparespercyl; /* # of spare sectors per cylinder */
- /*
- * Alternate cylinders include maintenance, replacement,
- * configuration description areas, etc.
- */
- u_long d_acylinders; /* # of alt. cylinders per unit */
-
- /* hardware characteristics: */
- /*
- * d_interleave, d_trackskew and d_cylskew describe perturbations
- * in the media format used to compensate for a slow controller.
- * Interleave is physical sector interleave, set up by the formatter
- * or controller when formatting. When interleaving is in use,
- * logically adjacent sectors are not physically contiguous,
- * but instead are separated by some number of sectors.
- * It is specified as the ratio of physical sectors traversed
- * per logical sector. Thus an interleave of 1:1 implies contiguous
- * layout, while 2:1 implies that logical sector 0 is separated
- * by one sector from logical sector 1.
- * d_trackskew is the offset of sector 0 on track N
- * relative to sector 0 on track N-1 on the same cylinder.
- * Finally, d_cylskew is the offset of sector 0 on cylinder N
- * relative to sector 0 on cylinder N-1.
- */
- u_short d_rpm; /* rotational speed */
- u_short d_interleave; /* hardware sector interleave */
- u_short d_trackskew; /* sector 0 skew, per track */
- u_short d_cylskew; /* sector 0 skew, per cylinder */
- u_long d_headswitch; /* head switch time, usec */
- u_long d_trkseek; /* track-to-track seek, usec */
- u_long d_flags; /* generic flags */
-#define NDDATA 5
- u_long d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
- u_long d_spare[NSPARE]; /* reserved for future use */
- u_long d_magic2; /* the magic number (again) */
- u_short d_checksum; /* xor of data incl. partitions */
-
- /* filesystem and partition information: */
- u_short d_npartitions; /* number of partitions in following */
- u_long d_bbsize; /* size of boot area at sn0, bytes */
- u_long d_sbsize; /* max size of fs superblock, bytes */
- struct partition { /* the partition table */
- u_long p_size; /* number of sectors in partition */
- u_long p_offset; /* starting sector */
- u_long p_fsize; /* filesystem basic fragment size */
- u_char p_fstype; /* filesystem type, see below */
- u_char p_frag; /* filesystem fragments per block */
- union {
- u_short cpg; /* UFS: FS cylinders per group */
- u_short sgs; /* LFS: FS segment shift */
- } __partition_u1;
-#define p_cpg __partition_u1.cpg
-#define p_sgs __partition_u1.sgs
- u_short p_cpg; /* filesystem cylinders per group */
- } d_partitions[MAXPARTITIONS]; /* actually may be more */
-};
-
-/* d_type values: */
-#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
-#define DTYPE_MSCP 2 /* MSCP */
-#define DTYPE_DEC 3 /* other DEC (rk, rl) */
-#define DTYPE_SCSI 4 /* SCSI */
-#define DTYPE_ESDI 5 /* ESDI interface */
-#define DTYPE_ST506 6 /* ST506 etc. */
-#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
-#define DTYPE_HPFL 8 /* HP Fiber-link */
-#define DTYPE_FLOPPY 10 /* floppy */
-
-#ifdef DKTYPENAMES
-static char *dktypenames[] = {
- "unknown",
- "SMD",
- "MSCP",
- "old DEC",
- "SCSI",
- "ESDI",
- "ST506",
- "HP-IB",
- "HP-FL",
- "type 9",
- "floppy",
- 0
-};
-#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
-#endif
-
-/*
-* Filesystem type and version.
-* Used to interpret other filesystem-specific
-* per-partition information.
-*/
-#define FS_UNUSED 0 /* unused */
-#define FS_SWAP 1 /* swap */
-#define FS_V6 2 /* Sixth Edition */
-#define FS_V7 3 /* Seventh Edition */
-#define FS_SYSV 4 /* System V */
-#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
-#define FS_V8 6 /* Eighth Edition, 4K blocks */
-#define FS_BSDFFS 7 /* 4.2BSD fast file system */
-#define FS_MSDOS 8 /* MSDOS file system */
-#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */
-#define FS_OTHER 10 /* in use, but unknown/unsupported */
-#define FS_HPFS 11 /* OS/2 high-performance file system */
-#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
-#define FS_BOOT 13 /* partition contains bootstrap */
-
-#ifdef DKTYPENAMES
-static char *fstypenames[] = {
- "unused",
- "swap",
- "Version 6",
- "Version 7",
- "System V",
- "4.1BSD",
- "Eighth Edition",
- "4.2BSD",
- "MSDOS",
- "4.4LFS",
- "unknown",
- "HPFS",
- "ISO9660",
- "boot",
- 0
-};
-#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
-#endif
-
-/*
-* flags shared by various drives:
-*/
-#define D_REMOVABLE 0x01 /* removable media */
-#define D_ECC 0x02 /* supports ECC */
-#define D_BADSECT 0x04 /* supports bad sector forw. */
-#define D_RAMDISK 0x08 /* disk emulator */
-#define D_CHAIN 0x10 /* can do back-back transfers */
-
-/*
-* Drive data for SMD.
-*/
-
-#define d_smdflags d_drivedata[0]
-#define D_SSE 0x1 /* supports skip sectoring */
-#define d_mindist d_drivedata[1]
-#define d_maxdist d_drivedata[2]
-#define d_sdist d_drivedata[3]
-
-/*
-* Drive data for ST506.
-*/
-#define d_precompcyl d_drivedata[0]
-#define d_gap3 d_drivedata[1] /* used only when formatting */
-
-/*
- * Drive data for SCSI.
- */
-#define d_blind d_drivedata[0]
-
-#ifndef LOCORE
-/*
-* Structure used to perform a format
-* or other raw operation, returning data
-* and/or register values.
-* Register identification and format
-* are device- and driver-dependent.
-*/
-struct format_op {
- char *df_buf;
- int df_count; /* value-result */
- daddr_t df_startblk;
- int df_reg[8]; /* result */
-};
-
-/*
-* Structure used internally to retrieve
-* information about a partition on a disk.
-*/
-struct partinfo {
- struct disklabel *disklab;
- struct partition *part;
-};
-
-/*
-* Disk-specific ioctls.
-*/
- /* get and set disklabel; DIOCGPART used internally */
-#define DIOCGDINFO _IOR('d', 101, struct disklabel) /* get */
-#define DIOCSDINFO _IOW('d', 102, struct disklabel) /* set */
-#define DIOCWDINFO _IOW('d', 103, struct disklabel) /* set, update disk */
-#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
-
-/* do format operation, read or write */
-#define DIOCRFORMAT _IOWR('d', 105, struct format_op)
-#define DIOCWFORMAT _IOWR('d', 106, struct format_op)
-
-#define DIOCSSTEP _IOW('d', 107, int) /* set step rate */
-#define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */
-#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */
-
-#define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */
-
-#endif LOCORE
-.Ed
-.Sh SEE ALSO
-.Xr disktab 5 ,
-.Xr disklabel 8
-.Sh HISTORY
diff --git a/sbin/fastboot/fastboot.8 b/sbin/fastboot/fastboot.8
deleted file mode 100644
index 2f6ac829..0000000
--- a/sbin/fastboot/fastboot.8
+++ /dev/null
@@ -1,69 +0,0 @@
-.\" Copyright (c) 1983, 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.
-.\"
-.\" @(#)fastboot.8 8.1 (Berkeley) 6/5/93
-.\"
-.Dd June 5, 1993
-.Dt FASTBOOT 8
-.Os BSD 4.2
-.Sh NAME
-.Nm fastboot ,
-.Nm fasthalt
-.Nd "reboot/halt the system without checking the disks"
-.Sh SYNOPSIS
-.Nm fastboot
-.Op Ar boot-options
-.Nm fasthalt
-.Op Ar halt-options
-.Sh DESCRIPTION
-.Nm Fastboot
-and
-.Nm fasthalt
-are shell scripts which reboot and halt the system without
-checking the file systems. This is done by creating a
-file
-.Pa /fastboot ,
-then invoking the
-.Xr reboot
-program. The system startup script,
-.Pa /etc/rc ,
-looks for this file and, if present, skips the normal
-invocation of
-.Xr fsck 8 .
-.Sh SEE ALSO
-.Xr halt 8 ,
-.Xr reboot 8 ,
-.Xr rc 8
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
diff --git a/sbin/scsiformat/scsiformat.c b/sbin/scsiformat/scsiformat.c
deleted file mode 100644
index a185a8e..0000000
--- a/sbin/scsiformat/scsiformat.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * @(#)scsiformat.c 5.5 (Berkeley) 4/2/94
- */
-
-#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)scsiformat.c 5.5 (Berkeley) 4/2/94";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-
-#include <dev/scsi/scsi.h>
-#include <dev/scsi/disk.h>
-#include <dev/scsi/disktape.h>
-#include <dev/scsi/scsi_ioctl.h>
-
-#define COMPAT_HPSCSI
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int fd;
-char *device;
-
-void scsi_str __P((char *, char *, int));
-void do_command __P((int, struct scsi_cdb *, void *, int));
-void do_format __P((void));
-void print_capacity __P((void));
-void print_inquiry __P((void));
-void prflags __P((int, const char *));
-u_char *print_mode_page __P((u_char *));
-void print_mode_sense __P((void));
-void usage __P((void));
-
-#define N2(c, d) (((c) << 8) | (d))
-#define N3(b, c, d) (((b) << 16) | N2(c, d))
-#define N4(a, b, c, d) (((a) << 24) | N3(b, c, d))
-
-int sense_pctl;
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- extern char *optarg;
- int ch, readonly;
-
- readonly = 0;
- sense_pctl = SCSI_MSENSE_PCTL_CUR;
- while ((ch = getopt(argc, argv, "rp:")) != EOF) {
- switch(ch) {
- case 'r':
- readonly = 1;
- break;
- case 'p': /* mode sense page control */
- switch (*optarg) {
- case 'c':
- sense_pctl = SCSI_MSENSE_PCTL_CUR;
- break;
- case 'd':
- sense_pctl = SCSI_MSENSE_PCTL_DFLT;
- break;
- case 's':
- sense_pctl = SCSI_MSENSE_PCTL_SAVED;
- break;
- case 'v':
- (void)printf(
- "*** note: for variable parameters, 1-bit means ``can write here''\n");
- sense_pctl = SCSI_MSENSE_PCTL_VAR;
- break;
- }
- /* FALLTHROUGH */
- case '?':
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 1)
- usage();
-
- device = *argv;
- fd = open(device, readonly ? O_RDONLY : O_RDWR, 0);
- if (fd < 0) {
- (void)fprintf(stderr,
- "scsiformat: %s: %s\n", device, strerror(errno));
- exit(1);
- }
- print_inquiry();
- print_capacity();
- print_mode_sense();
-
- if (!readonly)
- do_format();
- exit(0);
-}
-
-/*
- * Copy a counted string, trimming trailing blanks, and turning the
- * result into a C-style string.
- */
-void
-scsi_str(src, dst, len)
- register char *src, *dst;
- register int len;
-{
-
- while (src[len - 1] == ' ') {
- if (--len == 0) {
- *dst = 0;
- return;
- }
- }
- bcopy(src, dst, len);
- dst[len] = 0;
-}
-
-void
-print_inquiry()
-{
- register struct scsi_inq_ansi *si;
- int ver;
- struct scsi_inquiry inqbuf;
- char vendor[10], product[17], rev[5];
- static struct scsi_cdb inq = {
- CMD_INQUIRY, 0, 0, 0, sizeof(inqbuf), 0
- };
-
- do_command(fd, &inq, &inqbuf, sizeof(inqbuf));
- (void)printf("%s: ", device);
-
- ver = (inqbuf.si_version >> VER_ANSI_SHIFT) & VER_ANSI_MASK;
- if (ver != 1 && ver != 2) {
- (void)printf("type 0x%x, qual 0x%x, ver 0x%x (ansi %d)\n",
- inqbuf.si_type, inqbuf.si_qual, inqbuf.si_version, ver);
- return;
- }
- si = (struct scsi_inq_ansi *)&inqbuf;
- switch (si->si_type & TYPE_TYPE_MASK) {
-
- case TYPE_DAD:
- (void)printf("(disk)");
- break;
-
- case TYPE_WORM:
- (void)printf("(WORM)");
- break;
-
- case TYPE_ROM:
- (void)printf("(CD-ROM)");
- break;
-
- case TYPE_MO:
- (void)printf("(MO-DISK)");
- break;
-
- case TYPE_JUKEBOX:
- (void)printf("(jukebox)");
- break;
-
- default:
- (void)printf("(??)");
- break;
- }
- scsi_str(si->si_vendor, vendor, sizeof(si->si_vendor));
- scsi_str(si->si_product, product, sizeof(si->si_product));
- scsi_str(si->si_rev, rev, sizeof(si->si_rev));
- (void)printf(" %s %s rev %s:", vendor, product, rev);
-}
-
-void
-print_capacity()
-{
- struct scsi_rc rc; /* for READ CAPACITY */
- static struct scsi_cdb cap = { CMD_READ_CAPACITY };
-
- do_command(fd, &cap, &rc, sizeof(rc));
- (void)printf(" %d blocks of %d bytes each\n",
- N4(rc.rc_lbah, rc.rc_lbahm, rc.rc_lbalm, rc.rc_lbal) + 1,
- N4(rc.rc_blh, rc.rc_blhm, rc.rc_bllm, rc.rc_bll));
-}
-
-void
-print_mode_sense()
-{
- register u_char *cp, *ep;
- register struct scsi_ms_bd *bd;
- register int n, i, l, len, bdlen;
-#ifdef TEN_BYTE_SENSE
- struct {
- struct scsi_ms10 ms;
- u_char p[1023 - sizeof(struct scsi_ms10)];
- } msbuf;
- static struct scsi_cdb modesense = {
- CMD_MODE_SENSE10, SCSI_MSENSE_DBD, 0, 0, 0, 0, 0,
- sizeof(msbuf) >> 8, sizeof (msbuf), 0
- };
-
- CDB10(&modesense)->cdb_lbam = sense_pctl | SCSI_MS_PC_ALL;
- do_command(fd, &modesense, &msbuf, sizeof(msbuf));
- len = N2(msbuf.ms.ms_lenh, msbuf.ms.ms_lenl);
- bdlen = N2(msbuf.ms.ms_bdlh, msbuf.ms.ms_bdll);
-#else
- struct {
- struct scsi_ms6 ms;
- u_char p[255 - sizeof(struct scsi_ms6)];
- } msbuf;
- static struct scsi_cdb modesense = {
- CMD_MODE_SENSE6, 0, 0, 0, sizeof(msbuf), 0
- };
-
- CDB6(&modesense)->cdb_lbam = sense_pctl | SCSI_MS_PC_ALL;
- do_command(fd, &modesense, &msbuf, sizeof(msbuf));
- len = msbuf.ms.ms_len;
- bdlen = msbuf.ms.ms_bdl;
-#endif
- (void)printf("\n%d bytes of mode sense data. ", len);
- (void)printf("medium type 0x%x, %swrite protected\n",
- msbuf.ms.ms_mt, msbuf.ms.ms_dsp & SCSI_MS_DSP_WP ? "" : "not ");
- if ((n = bdlen) != 0) {
- bd = (struct scsi_ms_bd *)msbuf.p;
- for (n /= sizeof(*bd); --n >= 0; bd++) {
- (void)printf("\tdensity code 0x%x, ", bd->bd_dc);
- i = N3(bd->bd_nbh, bd->bd_nbm, bd->bd_nbl);
- l = N3(bd->bd_blh, bd->bd_blm, bd->bd_bll);
- if (i)
- (void)printf("%d blocks of length %d\n", i, l);
- else
- (void)printf("all blocks of length %d\n", l);
- }
- }
- /*
- * Sense header lengths includes the sense header, while mode page
- * lengths do not ... let's hear it for consistency!
- */
- cp = msbuf.p + bdlen;
- ep = msbuf.p + len - sizeof(msbuf.ms);
- while (cp < ep)
- cp = print_mode_page(cp);
-}
-
-void
-prflags(v, cp)
- int v;
- register const char *cp;
-{
- register const char *np;
- char f, sep;
-
- for (sep = '<'; (f = *cp++) != 0; cp = np) {
- for (np = cp; *np >= ' ';)
- np++;
- if ((v & (1 << (f - 1))) == 0)
- continue;
- printf("%c%.*s", sep, np - cp, cp);
- sep = ',';
- }
- if (sep != '<')
- putchar('>');
-}
-
-static char *
-cache_policy(x)
- int x;
-{
- static char rsvd[30];
-
- switch (x) {
-
- case SCSI_CACHE_DEFAULT:
- return ("default");
-
- case SCSI_CACHE_KEEPPF:
- return ("toss cmd data, save prefetch");
-
- case SCSI_CACHE_KEEPCMD:
- return ("toss prefetch data, save cmd");
-
- default:
- (void)sprintf(rsvd, "reserved %d", x);
- return (rsvd);
- }
- /* NOTREACHED */
-}
-
-u_char *
-print_mode_page(cp)
- u_char *cp;
-{
- register struct scsi_ms_page_hdr *mp;
- int len, code, i;
- u_char *tp;
- const char *s;
-
- mp = (struct scsi_ms_page_hdr *)cp;
- code = mp->mp_psc & SCSI_MS_PC_MASK;
- len = mp->mp_len;
- (void)printf("\npage type %d%s (%d bytes): ",
- code, mp->mp_psc & SCSI_MS_MP_SAVEABLE ? " (saveable)" : "", len);
- switch (code) {
-
- case SCSI_MS_PC_RWERRREC:
-#define rw ((struct scsi_page_rwerrrec *)(mp + 1))
- (void)printf("Read/Write Error Recovery parameters.\n");
- (void)printf("\tflags = 0x%x", rw->rw_flags);
- prflags(rw->rw_flags,
- "\10AWRE\7ARRE\6TB\5RC\4EER\3PER\2DTE\1DCR");
- (void)printf(",\n\t%d read retries, %d correction span bits,\n",
- rw->rw_read_retry, rw->rw_corr_span);
- (void)printf("\t%d head offsets, %d data strobe offsets%s\n",
- rw->rw_hd_off, rw->rw_ds_off, len > 6 ? "," : ".");
- if (len <= 6)
- break;
- (void)printf("\t%d write retries, ", rw->rw_write_retry);
- i = N2(rw->rw_rtlh, rw->rw_rtll);
- if (i != 0xffff)
- (void)printf("%d", i);
- else
- (void)printf("no");
- (void)printf(" recovery time limit.\n");
- break;
-#undef rw
-
- case SCSI_MS_PC_DR:
-#define dr ((struct scsi_page_dr *)(mp + 1))
- (void)printf("Disconnect/Reconnect control.\n");
- (void)printf("\tbuffer full ratio %d, buffer empty ratio %d,\n",
- dr->dr_full, dr->dr_empty);
- (void)printf("\ttime limits: %d bus inactivity, ",
- N2(dr->dr_inacth, dr->dr_inactl));
- (void)printf("%d disconnect, %d connect.\n",
- N2(dr->dr_disconh, dr->dr_disconl),
- N2(dr->dr_conh, dr->dr_conl));
- (void)printf("\tmaximum burst size %d,\n",
- N2(dr->dr_bursth, dr->dr_burstl));
- switch (dr->dr_dtdc & SCSI_DR_DTDC_MASK) {
- case SCSI_DR_DTDC_NONE:
- s = "never";
- break;
- case SCSI_DR_DTDC_NOTDATA:
- s = "during data transfer";
- break;
- case SCSI_DR_DTDC_RSVD:
- s = "???";
- break;
- case SCSI_DR_DTDC_NOTD2:
- s = "during and after data transfer";
- break;
- }
- (void)printf("\tsuppress disconnect %s.\n", s);
- break;
-#undef dr
-
- case SCSI_MS_PC_FMT:
-#define fmt ((struct scsi_page_fmt *)(mp + 1))
- (void)printf("Format parameters.\n");
- (void)printf("\t%d tracks/zone, %d alt.sect./zone, ",
- N2(fmt->fmt_tpzh, fmt->fmt_tpzl),
- N2(fmt->fmt_aspzh, fmt->fmt_aspzl));
- (void)printf("%d alt.tracks/zone,\n\t%d alt.tracks/vol., ",
- N2(fmt->fmt_atpzh, fmt->fmt_atpzl),
- N2(fmt->fmt_atpvh, fmt->fmt_atpvl));
- (void)printf("%d sectors/track, %d bytes/phys.sector,\n",
- N2(fmt->fmt_spth, fmt->fmt_sptl),
- N2(fmt->fmt_dbppsh, fmt->fmt_dbppsl));
- (void)printf("\tinterleave %d, track skew %d, cyl.skew %d,\n",
- N2(fmt->fmt_ilh, fmt->fmt_ill),
- N2(fmt->fmt_tsfh, fmt->fmt_tsfl),
- N2(fmt->fmt_csfh, fmt->fmt_csfl));
- (void)printf("\tdrive flags 0x%x", fmt->fmt_flags);
- prflags(fmt->fmt_flags, "\10SSEC\7HSEC\6RMB\5SURF");
- (void)printf(".\n");
- break;
-#undef fmt
-
- case SCSI_MS_PC_RDGEOM:
-#define rd ((struct scsi_page_rdgeom *)(mp + 1))
- (void)printf("Disk Geometry parameters.\n");
- (void)printf("\t%d cylinders, %d heads,\n",
- N3(rd->rd_ncylh, rd->rd_ncylm, rd->rd_ncyll),
- rd->rd_nheads);
- (void)printf("\tstart write precompensation at cyl %d,\n",
- N3(rd->rd_wpcylh, rd->rd_wpcylm, rd->rd_wpcyll));
- (void)printf("\tstart reduced write current at cyl %d,\n",
- N3(rd->rd_rwcylh, rd->rd_rwcylm, rd->rd_rwcyll));
- (void)printf("\tseek step rate %f us, landing zone cyl %d,\n",
- N2(rd->rd_steph, rd->rd_stepl) * 0.1,
- N3(rd->rd_lcylh, rd->rd_lcylm, rd->rd_lcyll));
- switch (rd->rd_rpl & SCSI_RD_RPL_MASK) {
- case SCSI_RD_RPL_NONE:
- s = "disabled or unsupported";
- break;
- case SCSI_RD_RPL_SLAVE:
- s = "slave";
- break;
- case SCSI_RD_RPL_MASTER:
- s = "master";
- break;
- case SCSI_RD_RPL_MCONTROL:
- s = "master control";
- break;
- }
- (void)printf("\trotational synch %s, offset %d/256%s\n",
- s, rd->rd_roff, len > 18 ? "," : ".");
- if (len > 18)
- (void)printf("\trotation %d rpm.\n",
- N2(rd->rd_rpmh, rd->rd_rpml));
- break;
-#undef rd
-
- case SCSI_MS_PC_VERRREC:
-#define v ((struct scsi_page_verrrec *)(mp + 1))
- (void)printf("Verify Error Recovery parameters.\n");
- (void)printf("\tflags = 0x%x", v->v_flags);
- prflags(v->v_flags, "\4EER\3PER\2DTE\1DCR");
- (void)printf(",\n\t%d verify retries, %d %s span bits,\n\t",
- v->v_verify_retry, v->v_corr_span, "correction");
- (void)printf("%d recovery time limit.\n",
- N2(v->v_rtlh, v->v_rtll));
- break;
-#undef v
-
- case SCSI_MS_PC_CACHE:
-#define cache ((struct scsi_page_cache *)(mp + 1))
- (void)printf("Caching Page.\n");
- (void)printf("\tflags = 0x%x", cache->cache_flags);
- prflags(cache->cache_flags, "\3WCE\2MF\1RCD");
- (void)printf(
- ",\n\tread retention = %s, write retention = %s,\n",
- cache_policy(SCSI_CACHE_RDPOLICY(cache->cache_reten)),
- cache_policy(SCSI_CACHE_WRPOLICY(cache->cache_reten)));
- (void)printf("\tdisable prefetch transfer length = %d,\n",
- N2(cache->cache_dptlh, cache->cache_dptll));
- (void)printf("\tmin prefetch = %d, max prefetch = %d, ",
- N2(cache->cache_minpfh, cache->cache_minpfl),
- N2(cache->cache_maxpfh, cache->cache_maxpfl));
- (void)printf("max prefetch ceiling = %d.\n",
- N2(cache->cache_mpch, cache->cache_mpcl));
- break;
-#undef cache
-
- case SCSI_MS_PC_CTLMODE:
-#define cm ((struct scsi_page_ctlmode *)(mp + 1))
- (void)printf("Control Mode Page.\n");
- (void)printf("\t%s report log-activity error conditions,\n",
- cm->cm_rlec & SCSI_CM_RLEC ? "do" : "do not");
- (void)printf("\tqueue algorithm modifier = %d, flags = 0x%x",
- SCSI_CM_QMOD(cm->cm_qctl),
- cm->cm_qctl & (SCSI_CM_QERR|SCSI_CM_DQUE));
- prflags(cm->cm_qctl, "\2QERR\1DQUE");
- (void)printf(",\n\tECA/AEN flags = 0x%x", cm->cm_ecaaen);
- prflags(cm->cm_ecaaen, "\10ECA\3RAENP\2UUAENP\1EAENP");
- (void)printf(", AEN holdoff period = %d ms.\n",
- N2(cm->cm_aenholdh, cm->cm_aenholdl));
- break;
-#undef cm
-
- /*
- * Vendor Unique, but what the heck.
- */
- case SCSI_MS_PC_CDCCACHECTL:
-#define ccm ((struct scsi_page_CDCcachectlmode *)(mp + 1))
- (void)printf("CDC-specific Cache Control Mode Page.\n");
- (void)printf("\tflags = 0x%x", ccm->ccm_flags);
- prflags(ccm->ccm_flags, "\7WIE\5ENABLE");
- (void)printf(", table size = %d, prefetch threshold = %d\n",
- SCSI_CDC_CCM_TBLSZ(ccm->ccm_flags),
- ccm->ccm_pfthresh);
- (void)printf("\tmaximum %s = %d, maximum %s = %d,\n",
- "threshold", ccm->ccm_maxthresh,
- "prefetch multiplier", ccm->ccm_maxpfmult);
- (void)printf("\tminimum %s = %d, minimum %s = %d.\n",
- "threshold", ccm->ccm_minthresh,
- "prefetch multiplier", ccm->ccm_minpfmult);
- break;
-#undef ccm
-
- default:
- (void)printf("Unknown page type.");
- for (tp = cp + sizeof(*mp), i = 0; i < len; ++i) {
- if ((i & 7) == 0)
- (void)printf("\n\t%2d: ", i);
- (void)printf(" %02x", *tp++);
- }
- (void)printf(".\n");
- break;
- }
- return (cp + sizeof(*mp) + len);
-}
-
-void
-pr_sense(fd)
- int fd;
-{
- static struct scsi_fmt_sense s;
- register struct scsi_sense *sn;
-
- if (ioctl(fd, SDIOCSENSE, &s) < 0)
- (void)fprintf(stderr,
- "scsiformat: SDIOCSENSE: %s\n", strerror(errno));
-
- (void)printf("scsi status 0x%x", s.status);
- if (s.status & STS_CHECKCOND) {
- sn = (struct scsi_sense *)s.sense;
-
- (void)printf(" sense class %d, code %d",
- SENSE_ECLASS(sn), SENSE_ECODE(sn));
- if (SENSE_ISXSENSE(sn)) {
- (void)printf(", key %d", XSENSE_KEY(sn));
- if (XSENSE_IVALID(sn))
- (void)printf(", blk %d", XSENSE_INFO(sn));
- }
- }
- (void)printf("\n");
-}
-
-void
-do_format()
-{
- struct {
- struct scsi_ms6 ms; /* mode select header */
- struct scsi_ms_bd bd; /* block descriptor */
- struct scsi_ms_page_hdr mp; /* ctl mode page hdr */
- struct scsi_page_ctlmode cm; /* ctl mode page */
- u_char pad[4]; /* ??? */
- } msel;
- u_char fmtbuf[128];
- static struct scsi_cdb modeselect = {
- CMD_MODE_SELECT6,
- SCSI_MSEL_SCSI2_DATA | SCSI_MSEL_SAVEPAGES, 0, 0,
- sizeof(msel), 0
- };
- static struct scsi_cdb format = { CMD_FORMAT_UNIT };
-
- /* want mostly 0s; set them all zero here */
- bzero(&msel, sizeof(msel));
-
- /* one block descriptor */
- msel.ms.ms_bdl = sizeof(struct scsi_ms_bd);
-
- /* block length = 512 bytes */
- msel.bd.bd_blm = 512 / 256;
- msel.bd.bd_bll = 512 % 256;
-
- /*
- * In the following, the mystery pad region is copied from
- * the original driver. I have no idea what it is for.
- * (Anyone got SCSI-2 documents?)
- */
-
- /* mode page parameters: report log-activity exception conditions */
- msel.mp.mp_psc = SCSI_MS_PC_CTLMODE;
- msel.mp.mp_len = sizeof(msel.cm) + sizeof(msel.pad);
- msel.cm.cm_rlec = SCSI_CM_RLEC;
-
- do_command(fd, &modeselect, &msel, sizeof(msel));
-
- bzero(fmtbuf, sizeof(fmtbuf));
- do_command(fd, &format, fmtbuf, sizeof(fmtbuf));
-}
-
-void
-do_command(fd, cdb, buf, len)
- int fd;
- struct scsi_cdb *cdb;
- void *buf;
- int len;
-{
- static int on = 1, off = 0;
- int user, ret;
-
- bzero(buf, len);
- if (ioctl(fd, SDIOCSFORMAT, &on) < 0) {
- (void)fprintf(stderr,
- "scsiformat: SDIOCSFORMAT (on): %s\n", strerror(errno));
- if (ioctl(fd, SDIOCGFORMAT, &user) == 0 && user != 0)
- (void)fprintf(stderr, "scsiformat: pid %d has it\n",
- user);
- return;
- }
- ret = ioctl(fd, SDIOCSCSICOMMAND, cdb);
-#ifdef COMPAT_HPSCSI
- if (ret < 0) {
- static const char scsicmdlen[8] = { 6, 10, 0, 0, 0, 12, 0, 0 };
-#define SCSICMDLEN(cmd) scsicmdlen[(cmd) >> 5]
- struct scsi_fmt_cdb {
- int len;
- u_char cdb[28];
- } sc;
-#define OSDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
-
- sc.len = SCSICMDLEN(cdb->cdb_bytes[0]);
- bcopy(cdb->cdb_bytes, sc.cdb, sc.len);
- ret = ioctl(fd, OSDIOCSCSICOMMAND, &sc);
- }
-#endif
- if (ret < 0)
- (void)fprintf(stderr,
- "scsiformat: SDIOCSCSICOMMAND: %s\n", strerror(errno));
- else if (read(fd, buf, len) < 0) {
- (void)fprintf(stderr,
- "scsiformat: read: %s\n", strerror(errno));
- pr_sense(fd);
- }
-
- if (ioctl(fd, SDIOCSFORMAT, &off) < 0)
- (void)fprintf(stderr,
- "scsiformat: SDIOCSFORMAT (off): %s\n", strerror(errno));
-}
-
-void
-usage()
-{
- (void)fprintf(stderr, "usage: scsiformat [-r] [-p c|d|s|v] device\n");
- exit(1);
-}
diff --git a/secure/usr.bin/telnet/krb4-proto.h b/secure/usr.bin/telnet/krb4-proto.h
deleted file mode 100644
index 75f6d41..0000000
--- a/secure/usr.bin/telnet/krb4-proto.h
+++ /dev/null
@@ -1,207 +0,0 @@
-#ifdef __STDC__
-# define P(s) s
-#else
-# define P(s) ()
-#endif
-
-/* add_ticket.c */
-int add_ticket P((KTEXT , int , char *, int , char *, char *, char *, int , KTEXT ));
-
-/* cr_err_reply.c */
-void cr_err_reply P((KTEXT , char *, char *, char *, u_long , u_long , char *));
-
-/* create_auth_reply.c */
-KTEXT create_auth_reply P((char *, char *, char *, long , int , unsigned long , int , KTEXT ));
-
-/* create_ciph.c */
-int create_ciph P((KTEXT , C_Block , char *, char *, char *, unsigned long , int , KTEXT , unsigned long , C_Block ));
-
-/* create_death_packet.c */
-KTEXT krb_create_death_packet P((char *));
-
-/* create_ticket.c */
-int krb_create_ticket P((KTEXT , unsigned int , char *, char *, char *, long , char *, int , long , char *, char *, C_Block ));
-
-/* debug_decl.c */
-
-/* decomp_ticket.c */
-int decomp_ticket P((KTEXT , unsigned char *, char *, char *, char *, unsigned long *, C_Block , int *, unsigned long *, char *, char *, C_Block , Key_schedule ));
-
-/* dest_tkt.c */
-int dest_tkt P((void ));
-
-/* extract_ticket.c */
-int extract_ticket P((KTEXT , int , char *, int *, int *, char *, KTEXT ));
-
-/* fgetst.c */
-int fgetst P((FILE *, char *, int ));
-
-/* get_ad_tkt.c */
-int get_ad_tkt P((char *, char *, char *, int ));
-
-/* get_admhst.c */
-int krb_get_admhst P((char *, char *, int ));
-
-/* get_cred.c */
-int krb_get_cred P((char *, char *, char *, CREDENTIALS *));
-
-/* get_in_tkt.c */
-int krb_get_pw_in_tkt P((char *, char *, char *, char *, char *, int , char *));
-int placebo_read_password P((des_cblock *, char *, int ));
-int placebo_read_pw_string P((char *, int , char *, int ));
-
-/* get_krbhst.c */
-int krb_get_krbhst P((char *, char *, int ));
-
-/* get_krbrlm.c */
-int krb_get_lrealm P((char *, int ));
-
-/* get_phost.c */
-char *krb_get_phost P((char *));
-
-/* get_pw_tkt.c */
-int get_pw_tkt P((char *, char *, char *, char *));
-
-/* get_request.c */
-int get_request P((KTEXT , int , char **, char **));
-
-/* get_svc_in_tkt.c */
-int krb_get_svc_in_tkt P((char *, char *, char *, char *, char *, int , char *));
-
-/* get_tf_fullname.c */
-int krb_get_tf_fullname P((char *, char *, char *, char *));
-
-/* get_tf_realm.c */
-int krb_get_tf_realm P((char *, char *));
-
-/* getopt.c */
-int getopt P((int , char **, char *));
-
-/* getrealm.c */
-char *krb_realmofhost P((char *));
-
-/* getst.c */
-int getst P((int , char *, int ));
-
-/* in_tkt.c */
-int in_tkt P((char *, char *));
-
-/* k_gethostname.c */
-int k_gethostname P((char *, int ));
-
-/* klog.c */
-char *klog P((int , char *, int , int , int , int , int , int , int , int , int , int ));
-int kset_logfile P((char *));
-
-/* kname_parse.c */
-int kname_parse P((char *, char *, char *, char *));
-int k_isname P((char *));
-int k_isinst P((char *));
-int k_isrealm P((char *));
-
-/* kntoln.c */
-int krb_kntoln P((AUTH_DAT *, char *));
-
-/* krb_err_txt.c */
-
-/* krb_get_in_tkt.c */
-int krb_get_in_tkt P((char *, char *, char *, char *, char *, int , int (*key_proc )(), int (*decrypt_proc )(), char *));
-
-/* kuserok.c */
-int kuserok P((AUTH_DAT *, char *));
-
-/* log.c */
-void log P((char *, int , int , int , int , int , int , int , int , int , int ));
-int set_logfile P((char *));
-int new_log P((long , char *));
-
-/* mk_err.c */
-long krb_mk_err P((u_char *, long , char *));
-
-/* mk_priv.c */
-long krb_mk_priv P((u_char *, u_char *, u_long , Key_schedule , C_Block , struct sockaddr_in *, struct sockaddr_in *));
-
-/* mk_req.c */
-int krb_mk_req P((KTEXT , char *, char *, char *, long ));
-int krb_set_lifetime P((int ));
-
-/* mk_safe.c */
-long krb_mk_safe P((u_char *, u_char *, u_long , C_Block *, struct sockaddr_in *, struct sockaddr_in *));
-
-/* month_sname.c */
-char *month_sname P((int ));
-
-/* netread.c */
-int krb_net_read P((int , char *, int ));
-
-/* netwrite.c */
-int krb_net_write P((int , char *, int ));
-
-/* one.c */
-
-/* pkt_cipher.c */
-KTEXT pkt_cipher P((KTEXT ));
-
-/* pkt_clen.c */
-int pkt_clen P((KTEXT ));
-
-/* rd_err.c */
-int krb_rd_err P((u_char *, u_long , long *, MSG_DAT *));
-
-/* rd_priv.c */
-long krb_rd_priv P((u_char *, u_long , Key_schedule , C_Block , struct sockaddr_in *, struct sockaddr_in *, MSG_DAT *));
-
-/* rd_req.c */
-int krb_set_key P((char *, int ));
-int krb_rd_req P((KTEXT , char *, char *, long , AUTH_DAT *, char *));
-
-/* rd_safe.c */
-long krb_rd_safe P((u_char *, u_long , C_Block *, struct sockaddr_in *, struct sockaddr_in *, MSG_DAT *));
-
-/* read_service_key.c */
-int read_service_key P((char *, char *, char *, int , char *, char *));
-
-/* recvauth.c */
-int krb_recvauth P((long , int , KTEXT , char *, char *, struct sockaddr_in *, struct sockaddr_in *, AUTH_DAT *, char *, Key_schedule , char *));
-
-/* save_credentials.c */
-int save_credentials P((char *, char *, char *, C_Block , int , int , KTEXT , long ));
-
-/* send_to_kdc.c */
-int send_to_kdc P((KTEXT , KTEXT , char *));
-
-/* sendauth.c */
-int krb_sendauth P((long , int , KTEXT , char *, char *, char *, u_long , MSG_DAT *, CREDENTIALS *, Key_schedule , struct sockaddr_in *, struct sockaddr_in *, char *));
-int krb_sendsvc P((int , char *));
-
-/* setenv.c */
-int setenv P((char *, char *, int ));
-void unsetenv P((char *));
-char *getenv P((char *));
-char *_findenv P((char *, int *));
-
-/* stime.c */
-char *stime P((long *));
-
-/* tf_shm.c */
-int krb_shm_create P((char *));
-int krb_is_diskless P((void ));
-int krb_shm_dest P((char *));
-
-/* tf_util.c */
-int tf_init P((char *, int ));
-int tf_get_pname P((char *));
-int tf_get_pinst P((char *));
-int tf_get_cred P((CREDENTIALS *));
-int tf_close P((void ));
-int tf_save_cred P((char *, char *, char *, C_Block , int , int , KTEXT , long ));
-
-/* tkt_string.c */
-char *tkt_string P((void ));
-void krb_set_tkt_string P((char *));
-
-/* util.c */
-int ad_print P((AUTH_DAT *));
-int placebo_cblock_print P((des_cblock ));
-
-#undef P
diff --git a/share/doc/psd/00.contents b/share/doc/psd/00.contents
deleted file mode 100644
index 3866526..0000000
--- a/share/doc/psd/00.contents
+++ /dev/null
@@ -1,191 +0,0 @@
-.\" Copyright (c) 1986, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)00.contents 8.1 (Berkeley) 6/8/93
-.\"
-.OH '''PSD Contents'
-.EH 'PSD Contents'''
-.TL
-UNIX Programmer's Supplementary Documents (PSD)
-.sp
-\s-24.4 Berkeley Software Distribution\s+2
-.sp
-\fRJune, 1993\fR
-.PP
-This volume contains documents which supplement the manual pages in
-.I
-The
-.UX
-Programmer's Reference Manual
-.R
-for the 4.4BSD system as distributed by U.C. Berkeley.
-.SH
-Documents of Historical Interest
-.IP
-.tl 'The Unix Time\-Sharing System''PSD:1'
-.QP
-Dennis Ritchie and Ken Thompson's original paper about UNIX, reprinted
-from Communications of the ACM.
-
-.IP
-.tl 'Unix Implementation''PSD:2'
-.QP
-Ken Thompson's description of the implementation of the Version 7
-kernel and file system.
-
-.IP
-.tl 'The Unix I/O System''PSD:3'
-.QP
-Dennis Ritchie's overview of the I/O System of Version 7; still helpful for
-those writing device drivers.
-
-.IP
-.tl 'Unix Programming \- Second Edition ''PSD:4'
-.QP
-Describes the programming interface to the UNIX version 7 operating
-system and the standard I/O library. Should be supplemented by
-Kernighan and Pike, ``The UNIX Programming Environment'',
-Prentice-Hall, 1984 and especially by the Programmer Reference Manual
-section 2 (system calls) and 3 (library routines).
-
-.IP
-.tl 'Berkeley Software Architecture Manual (4.4 Edition)''PSD:5'
-.QP
-A concise and terse description of the system call interface
-provided in Berkeley Unix, as revised for 4.4BSD.
-This will never be a best seller.
-
-.SH
-Languages in common use
-.IP
-.tl 'The C Programming Language \- Reference Manual''PSD:6'
-.QP
-Official statement of the syntax of C.
-Should be supplemented by ``The C Programming Language,''
-B.W. Kernighan and D.M. Ritchie, Prentice-Hall, 1978, that
-contains a tutorial introduction and many examples.
-
-.IP
-.tl 'Berkeley Pascal User\'s Manual''PSD:7'
-.QP
-An implementation of this language popular for learning to program.
-
-.IP
-.tl 'A Portable Fortran 77 Compiler''PSD:8'
-.QP
-A revised version of the document which originally appeared in
-Volume 2b of the Bell Labs documentation;
-this version reflects the work done at Berkeley.
-
-.IP
-.tl 'Introduction to the f77 I/O Library''PSD:9'
-.QP
-A description of the revised input/output library for Fortran 77,
-reflecting work carried out at Berkeley.
-
-.SH
-Programming Tools
-.IP
-.tl 'Debugging with GDB: The GNU Source-Level Debugger''PSD:10'
-.QP
-How to debug programs using the source level \fIgdb\fP debugger
-(or how to debug programs without having to know much about machine language).
-
-.IP
-.tl 'A Tutorial Introduction to ADB''PSD:11'
-.QP
-How to debug programs using the assembly-language level \fIadb\fP debugger.
-
-.IP
-.tl 'Make \- A Program for Maintaining Computer Programs''PSD:12'
-.QP
-Indispensable tool for making sure large programs are properly
-compiled with minimal effort.
-
-.IP
-.tl 'An Introduction to the Revision Control System''PSD:13'
-.QP
-RCS is a user-contributed tool for working together with other people
-without stepping on each other's toes.
-An alternative to \fIsccs\fR for controlling software changes.
-
-.IP
-.tl 'An Introduction to the Source Code Control System''PSD:14'
-.QP
-A useful introductory article for those users with
-installations licensed for SCCS.
-
-.IP
-.tl 'YACC: Yet Another Compiler-Compiler''PSD:15'
-.QP
-Converts a BNF specification of a language and semantic actions
-written in C into a compiler for that language.
-
-.IP
-.tl 'LEX \- A Lexical Analyzer Generator''PSD:16'
-.QP
-Creates a recognizer for a set of regular expressions:
-each regular expression can be followed by arbitrary C code
-to be executed upon finding the regular expression.
-
-.IP
-.tl 'The M4 Macro Processor''PSD:17'
-.QP
-M4 is a macro processor useful in its own right and as a
-front-end for C, Ratfor, and Cobol.
-
-.IP
-.tl 'gprof: a Call Graph Execution Profiler''PSD:18'
-.QP
-A program to show the call graph and execution time of a program.
-Indispensable aid for improving the running time of almost everything.
-
-.SH
-Programming Libraries
-.IP
-.tl 'Screen Updating and Cursor Movement Optimization''PSD:19'
-.QP
-Describes the \fIcurses\fP package, an aid for writing screen-oriented,
-terminal-independent programs.
-
-.SH
-General Reference
-.IP
-.tl 'An Introductory 4.4BSD Interprocess Communication Tutorial''PSD:20'
-.QP
-How to write programs that use the Interprocess Communication Facilities
-of 4.4BSD.
-
-.IP
-.tl 'An Advanced 4.4BSD Interprocess Communication Tutorial''PSD:21'
-.QP
-The reference document (with some examples) for the Interprocess Communication
-Facilities of 4.4BSD.
diff --git a/share/doc/psd/Title b/share/doc/psd/Title
deleted file mode 100644
index 2ec146c..0000000
--- a/share/doc/psd/Title
+++ /dev/null
@@ -1,131 +0,0 @@
-.\" Copyright (c) 1986, 1993 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)Title 8.2 (Berkeley) 4/19/94
-.\"
-.ps 18
-.vs 22
-.sp 2.75i
-.ft B
-.ce 3
-UNIX Programmer's Supplementary Documents
-(PSD)
-.ps 14
-.vs 16
-.sp |4i
-.ce 2
-4.4 Berkeley Software Distribution
-.sp |5.75i
-.ft R
-.pt 12
-.vs 16
-.ce
-June, 1993
-.sp |8.2i
-.ce 5
-Computer Systems Research Group
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California
-Berkeley, California 94720
-.bp
-\&
-.sp |1i
-.hy 0
-.ps 10
-.vs 12p
-Copyright 1979, 1980, 1983, 1986, 1993
-The Regents of the University of California. All rights reserved.
-.sp 2
-Other than the specific documents listed below as copyrighted by AT&T,
-redistribution and use of this manual in source and binary forms,
-with or without modification, are permitted provided that the
-following conditions are met:
-.sp 0.5
-.in +0.2i
-.ta 0.2i
-.ti -0.2i
-1) Redistributions of this manual must retain the copyright
-notices on this page, this list of conditions and the following disclaimer.
-.ti -0.2i
-2) Software or documentation that incorporates part of this manual must
-reproduce the copyright notices on this page, this list of conditions and
-the following disclaimer in the documentation and/or other materials
-provided with the distribution.
-.ti -0.2i
-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.''
-.ti -0.2i
-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.
-.in -0.2i
-.sp
-\fB\s-1THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.\s+1\fP
-.sp 2
-Documents PSD:1, 2, 3, 4, 6, 11, 15, 16, and 17
-are copyright 1979, AT&T Bell Laboratories, Incorporated.
-Document PSD:8 is a modification of an earlier document that
-is copyrighted 1979 by AT&T Bell Laboratories, Incorporated.
-Holders of \x'-1p'UNIX\v'-4p'\s-3TM\s0\v'4p'/32V,
-System III, or System V software licenses are
-permitted to copy these documents, or any portion of them,
-as necessary for licensed use of the software,
-provided this copyright notice and statement of permission
-are included.
-.sp 2
-Document PSD:10 is part of the user contributed software and is
-copyright 1992 by the Free Software Foundation, Inc.
-Permission is granted to make and distribute verbatim copies of
-this document provided the copyright notice and this permission notice
-are preserved on all copies.
-.sp 2
-Document PSD:13 is part of the user contributed software and is
-copyright 1983 by Walter F. Tichy.
-Permission to copy the RCS documentation or any portion thereof as
-necessary for licensed use of the software is granted to licensees
-of this software, provided this copyright notice is included.
-.sp 2
-The views and conclusions contained in this manual are those of the
-authors and should not be interpreted as representing official policies,
-either expressed or implied, of the Regents of the University of California.
diff --git a/share/doc/smm/00.contents b/share/doc/smm/00.contents
deleted file mode 100644
index ed03c7a..0000000
--- a/share/doc/smm/00.contents
+++ /dev/null
@@ -1,161 +0,0 @@
-.\" Copyright (c) 1986, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)00.contents 8.1 (Berkeley) 7/5/93
-.\"
-.OH '''SMM Contents'
-.EH 'SMM Contents'''
-.TL
-UNIX System Manager's Manual (SMM)
-.sp
-\s-24.4 Berkeley Software Distribution\s+2
-.sp
-\fRJune, 1993\fR
-.PP
-This volume contains manual pages and supplementary documents useful to system
-administrators.
-The information in these documents applies to
-the 4.4BSD system as distributed by U.C. Berkeley.
-.SH
-Reference Manual \- Section 8
-.tl '''(8)'
-.IP
-Section 8 of the UNIX Programmer's Manual contains information related to
-system operation, administration, and maintenance.
-.SH
-System Installation and Administration
-.IP
-.tl 'Installing and Operating 4.4BSD''SMM:1'
-.QP
-The definitive reference document for those occasions when
-you find you need to start over again.
-
-.IP
-.tl 'Building 4.4BSD Kernels with \fIConfig\fP''SMM:2'
-.QP
-In-depth discussions of the use and operation of the \fIconfig\fP
-program, and how to build your very own Unix kernel.
-
-.IP
-.tl 'Fsck \- The UNIX File System Check Program''SMM:3'
-.QP
-A reference document for using the \fIfsck\fP program during
-times of file system distress.
-
-.IP
-.tl 'Disc Quotas in a UNIX Environment''SMM:4'
-.QP
-A light introduction to the techniques
-for limiting the use of disc resources.
-
-.IP
-.tl 'A Fast File System for UNIX''SMM:5'
-.QP
-A description of the 4.4BSD file system organization,
-design and implementation.
-
-.IP
-.tl 'The 4.4BSD NFS Implementation''SMM:6'
-.QP
-An overview of the design, implementation, and use of NFS on 4.4BSD.
-
-.IP
-.tl 'Line Printer Spooler Manual''SMM:7'
-.QP
-This document describes the structure and installation procedure
-for the line printer spooling system.
-
-.IP
-.tl 'Sendmail Installation and Operation Guide''SMM:8'
-.QP
-The last word in installing and operating the \fIsendmail\fP program.
-
-.ne 3
-.IP
-.tl 'Sendmail \- An Internetwork Mail Router''SMM:9'
-.QP
-An overview document on the design and implementation of \fIsendmail\fP.
-
-.IP
-.tl 'Name Server Operations Guide for BIND''SMM:10'
-.QP
-Setting up and operating the name to Internet addressing software.
-If you have a network this will be of interest.
-
-.IP
-.tl 'Timed Installation and Operation Guide''SMM:11'
-.QP
-Describes how to maintain time synchronization between machines
-in a local network.
-
-.IP
-.tl 'The Berkeley UNIX Time Synchronization Protocol''SMM:12'
-.QP
-The protocols and algorithms used by timed,
-the network time synchronization daemon.
-
-.IP
-.tl 'AMD \- The 4.4BSD Automounter''SMM:13'
-.QP
-Automatically mounting file systems on demand.
-
-.IP
-.tl 'Installation and Operation of UUCP''SMM:14'
-.QP
-Describes the implementation of uucp; for the installer and administrator.
-
-.IP
-.tl 'A Dial\-Up Network of UNIX Systems''SMM:15'
-.QP
-Describes UUCP, a program for communicating files between UNIX systems.
-
-.IP
-.tl 'On the Security of UNIX''SMM:16'
-.QP
-Hints on how to break UNIX, and how to avoid your system being broken.
-
-.IP
-.tl 'Password Security \- A Case History''SMM:17'
-.QP
-How the bad guys used to be able to break the password algorithm, and why
-they cannot now (at least not so easily).
-
-.IP
-.tl 'Networking Implementation Notes, 4.4BSD Edition''SMM:18'
-.QP
-A concise description of the system interfaces used within the
-networking subsystem.
-
-.IP
-.tl 'The PERL Programming Language''SMM:19'
-.QP
-The Practical Extraction and Report Language is ideal for
-writing those pesky adminitration scripts.
diff --git a/share/doc/smm/Title b/share/doc/smm/Title
deleted file mode 100644
index 4dd1b89..0000000
--- a/share/doc/smm/Title
+++ /dev/null
@@ -1,203 +0,0 @@
-.\" Copyright (c) 1986, 1993 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)Title 8.2 (Berkeley) 4/19/94
-.\"
-.ps 18
-.vs 22
-.sp 2.75i
-.ft B
-.ce 2
-UNIX System Manager's Manual
-(SMM)
-.ps 14
-.vs 16
-.sp |4i
-.ce 2
-4.4 Berkeley Software Distribution
-.sp |5.75i
-.ft R
-.pt 12
-.vs 16
-.ce
-June, 1993
-.sp |8.2i
-.ce 5
-Computer Systems Research Group
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California
-Berkeley, California 94720
-.bp
-\&
-.sp |1i
-.hy 0
-.ps 10
-.vs 12p
-Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993
-The Regents of the University of California. All rights reserved.
-.sp 2
-Other than the specific manual pages and documents listed below
-as copyrighted by AT&T,
-redistribution and use of this manual in source and binary forms,
-with or without modification, are permitted provided that the
-following conditions are met:
-.sp 0.5
-.in +0.2i
-.ta 0.2i
-.ti -0.2i
-1) Redistributions of this manual must retain the copyright
-notices on this page, this list of conditions and the following disclaimer.
-.ti -0.2i
-2) Software or documentation that incorporates part of this manual must
-reproduce the copyright notices on this page, this list of conditions and
-the following disclaimer in the documentation and/or other materials
-provided with the distribution.
-.ti -0.2i
-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.''
-.ti -0.2i
-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.
-.in -0.2i
-.sp
-\fB\s-1THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.\s+1\fP
-.sp 2
-The Institute of Electrical and Electronics Engineers and the American
-National Standards Committee X3, on Information Processing Systems have
-given us permission to reprint portions of their documentation.
-.sp
-In the following statement, the phrase ``this text'' refers to portions
-of the system documentation.
-.sp 0.5
-``Portions of this text are reprinted and reproduced in
-electronic form in 4.4BSD from IEEE Std 1003.1-1988, IEEE
-Standard Portable Operating System Interface for Computer Environments
-(POSIX), copyright 1988 by the Institute of Electrical and Electronics
-Engineers, Inc. In the event of any discrepancy between these versions
-and the original IEEE Standard, the original IEEE Standard is the referee
-document.''
-.sp
-In the following statement, the phrase ``This material'' refers to portions
-of the system documentation.
-.sp 0.5
-``This material is reproduced with permission from American National
-Standards Committee X3, on Information Processing Systems. Computer and
-Business Equipment Manufacturers Association (CBEMA), 311 First St., NW,
-Suite 500, Washington, DC 20001-2178. The developmental work of
-Programming Language C was completed by the X3J11 Technical Committee.''
-.sp 2
-Manual pages cron.8, icheck.8, ncheck.8, and sa.8
-and documents SMM:15, 16, and 17
-are copyright 1979, AT&T Bell Laboratories, Incorporated.
-Document SMM:14 is a modification of an earlier document that
-is copyrighted 1979 by AT&T Bell Laboratories, Incorporated.
-Holders of \x'-1p'UNIX\v'-4p'\s-3TM\s0\v'4p'/32V,
-System III, or System V software licenses are
-permitted to copy these documents, or any portion of them,
-as necessary for licensed use of the software,
-provided this copyright notice and statement of permission
-are included.
-.sp 2
-The views and conclusions contained in this manual are those of the
-authors and should not be interpreted as representing official policies,
-either expressed or implied, of the Regents of the University of California.
-.br
-.ll 6.5i
-.lt 6.5i
-.po .75i
-.in 0i
-.af % i
-.ds ET\"
-.de HD
-.po 0
-.lt 7.4i
-.tl ''''
-.lt
-.po
-'sp 18p
-.if o .tl '\\*(ET''\\*(OT'
-.if e .tl '\\*(OT''\\*(ET'
-'sp 18p
-.ns
-..
-.de FO
-'sp 18p
-.if e .tl '\s9\\*(Dt''\\*(Ed\s0'
-.if o .tl '\s9\\*(Ed''\\*(Dt\s0'
-'bp
-..
-.wh 0 HD
-.wh -60p FO
-.bp 5
-.ds ET \s9\f2Table \|of \|Contents\fP\s0
-.ds OT - % -
-.ce
-\f3TABLE \|OF \|CONTENTS\fP
-.nr x .5i
-.in +\nxu
-.nf
-.ta \n(.lu-\nxuR
-.de xx
-\\$1\f3 \a \fP\\$2
-..
-.de t
-.sp 1v
-.ne .5i
-.cs 3
-.ti -.5i
-.ss 18
-\f3\s9\\$2. \\$3\s0\fP
-.ss 12
-.if t .sp .5v
-.cs 3 36
-.ds Ed Section \\$2
-.ds Dt \\$3
-.so \\$1
-..
-.t /usr/src/share/man/man0/toc8 8 "System Maintenance"
-.in -.5i
-.cs 3
-.if n .ta 8n 16n 24n 32n 40n 48n 56n 64n 72n 80n
-.if t .ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
diff --git a/share/doc/usd/00.contents b/share/doc/usd/00.contents
deleted file mode 100644
index eae0ba8..0000000
--- a/share/doc/usd/00.contents
+++ /dev/null
@@ -1,262 +0,0 @@
-.\" Copyright (c) 1986, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)00.contents 8.2 (Berkeley) 4/20/94
-.\"
-.de ND
-.KE
-.sp
-.KS
-..
-.OH '''USD Contents'
-.EH 'USD Contents'''
-.TL
-UNIX User's Supplementary Documents (USD)
-.sp
-\s-24.4 Berkeley Software Distribution\s+2
-.sp
-\fRJune, 1993\fR
-.PP
-This volume contains documents which supplement the manual pages in
-.I
-The Unix User's Reference Manual
-.R
-for the 4.4BSD system as distributed by U.C. Berkeley.
-.sp
-.KS
-.SH
-Getting Started
-.ND
-.IP
-.tl 'Unix for Beginners \- Second Edition''USD:1'
-.QP
-An introduction to the most basic uses of the system.
-.ND
-.IP
-.tl 'Learn \- Computer\-Aided Instruction on UNIX (Second Edition)''USD:2'
-.QP
-Describes a computer-aided instruction program that walks new users through
-the basics of files, the editor, and document prepararation software.
-.ND
-.SH
-Basic Utilities
-.ND
-.IP
-.tl 'An Introduction to the UNIX Shell''USD:3'
-.QP
-Steve Bourne's introduction to the capabilities of
-.I sh,
-a command interpreter especially popular for writing shell scripts.
-.ND
-.IP
-.tl 'An Introduction to the C shell''USD:4'
-.QP
-This introduction to
-.I csh,
-(a command interpreter popular for interactive work) describes many
-commonly used UNIX commands, assumes little prior knowledge of UNIX,
-and has a glossary useful for beginners.
-.ND
-.IP
-.tl 'DC \- An Interactive Desk Calculator''USD:5'
-.QP
-A super HP calculator, if you do not need floating point.
-.ND
-.IP
-.tl 'BC \- An Arbitrary Precision Desk-Calculator Language''USD:6'
-.QP
-A front end for DC that provides infix notation, control flow, and
-built\-in functions.
-.ND
-.SH
-Communicating with the World
-.ND
-.IP
-.tl 'Mail Reference Manual''USD:7'
-.QP
-Complete details on one of the programs for sending and reading your mail.
-.ND
-.IP
-.tl 'The Rand MH Message Handling System''USD:8'
-.QP
-This system for managing your computer mail uses lots of small programs,
-instead of one large one.
-.ND
-.SH
-Text Editing
-.ND
-.IP
-.tl 'A Tutorial Introduction to the Unix Text Editor''USD:9'
-.QP
-An easy way to get started with the line editor,
-.I ed.
-.ND
-.IP
-.tl 'Advanced Editing on Unix''USD:10'
-.QP
-The next step.
-.ND
-.IP
-.tl 'An Introduction to Display Editing with Vi''USD:11'
-.QP
-The document to learn to use the \fIvi\fR screen editor.
-.ND
-.IP
-.tl 'Ex Reference Manual (Version 3.7)''USD:12'
-.QP
-The final reference for the \fIex\fR editor.
-.ND
-.IP
-.tl 'Vi Reference Manual''USD:13'
-.QP
-The definitive reference for the \fInvi\fR editor.
-.ND
-.IP
-.tl 'Jove Manual for UNIX Users''USD:14'
-.QP
-Jove is a small, self-documenting, customizable display editor, based on
-EMACS. A plausible alternative to
-.I vi.
-.ND
-.IP
-.tl 'SED \- A Non-interactive Text Editor''USD:15'
-.QP
-Describes a one-pass variant of
-.I ed
-useful as a filter for processing large files.
-.ND
-.IP
-.tl 'AWK \- A Pattern Scanning and Processing Language (Second Edition)''USD:16'
-.QP
-A program for data selection and transformation.
-.ND
-.SH
-Document Preparation
-.ND
-.IP
-.tl 'Typing Documents on UNIX: Using the \-ms Macros with Troff and Nroff''USD:17'
-.QP
-Describes and gives examples of the basic use of the typesetting tools and
-``-ms'', a frequently used package of formatting requests that make it easier
-to lay out most documents.
-.ND
-.IP
-.tl 'A Revised Version of \-ms''USD:18'
-.QP
-A brief description of the Berkeley revisions made to the \-ms formatting
-macros for nroff and troff.
-.ND
-.IP
-.tl 'Writing Papers with \fInroff\fR using \-me''USD:19'
-.QP
-Another popular macro package for
-.I nroff.
-.ND
-.IP
-.tl '\-me Reference Manual''USD:20'
-.QP
-The final word on \-me.
-.ND
-.IP
-.tl 'NROFF/TROFF User\'s Manual''USD:21'
-.QP
-Extremely detailed information about these document formatting programs.
-.ND
-.IP
-.tl 'A TROFF Tutorial''USD:22'
-.QP
-An introduction to the most basic uses of
-.I troff
-for those who really want to know such things, or want to write their
-own macros.
-.ND
-.IP
-.tl 'A System for Typesetting Mathematics''USD:23'
-.QP
-Describes
-.I eqn,
-an easy-to-learn language for high-quality mathematical typesetting.
-.ND
-.IP
-.tl 'Typesetting Mathematics \- User\'s Guide (Second Edition)''USD:24'
-.QP
-More details about how to use
-.I eqn.
-.ND
-.IP
-.tl 'Tbl \- A Program to Format Tables''USD:25'
-.QP
-A program for easily typesetting tabular material.
-.ND
-.IP
-.tl 'Refer \- A Bibliography System''USD:26'
-.QP
-An introduction to one set of tools used to maintain bibliographic databases.
-The major program,
-.I refer,
-is used to automatically retrieve and format the references
-based on document citations.
-.ND
-.IP
-.tl 'Some Applications of Inverted Indexes on the UNIX System''USD:27'
-.QP
-Mike Lesk's paper describes the
-.I refer
-programs in a somewhat larger context.
-.ND
-.IP
-.tl 'BIB \- A Program for Formatting Bibliographies''USD:28'
-.QP
-This is an alternative to
-.I refer
-for expanding citations in documents.
-.ND
-.IP
-.tl 'Writing Tools \- The STYLE and DICTION Programs''USD:29'
-.QP
-These are programs which can help you understand and improve your
-writing style.
-.ND
-.SH
-Amusements
-.ND
-.IP
-.tl 'A Guide to the Dungeons of Doom''USD:30'
-.QP
-An introduction to the popular game of \fIrogue\fP, a fantasy game
-which is one of the biggest known users of VAX cycles.
-.ND
-.IP
-.tl 'Star Trek''USD:31'
-.QP
-You are the Captain of the Starship Enterprise. Wipe out the
-Klingons and save the Federation.
-.KE
diff --git a/share/doc/usd/Title b/share/doc/usd/Title
deleted file mode 100644
index d36a55f..0000000
--- a/share/doc/usd/Title
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" Copyright (c) 1986, 1993 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)Title 8.2 (Berkeley) 4/19/94
-.\"
-.ps 18
-.vs 22
-.sp 2.75i
-.ft B
-.ce 2
-UNIX User's Supplementary Documents
-(USD)
-.ps 14
-.vs 16
-.sp |4i
-.ce 2
-4.4 Berkeley Software Distribution
-.sp |5.75i
-.ft R
-.pt 12
-.vs 16
-.ce
-June, 1993
-.sp |8.2i
-.ce 5
-Computer Systems Research Group
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California
-Berkeley, California 94720
-.bp
-\&
-.sp |1i
-.hy 0
-.ps 10
-.vs 12p
-Copyright 1979, 1980, 1983, 1986, 1993
-The Regents of the University of California. All rights reserved.
-.sp 2
-Other than the specific documents listed below as copyrighted by AT&T,
-redistribution and use of this manual in source and binary forms,
-with or without modification, are permitted provided that the
-following conditions are met:
-.sp 0.5
-.in +0.2i
-.ta 0.2i
-.ti -0.2i
-1) Redistributions of this manual must retain the copyright
-notices on this page, this list of conditions and the following disclaimer.
-.ti -0.2i
-2) Software or documentation that incorporates part of this manual must
-reproduce the copyright notices on this page, this list of conditions and
-the following disclaimer in the documentation and/or other materials
-provided with the distribution.
-.ti -0.2i
-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.''
-.ti -0.2i
-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.
-.in -0.2i
-.sp
-\fB\s-1THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.\s+1\fP
-.sp 2
-Documents USD:1, 2, 3, 5, 6, 9, 10, 15, 16, 17, 21, 22, 23, 24, 25, 26, 27,
-and 29 are copyright 1979, AT&T Bell Laboratories, Incorporated.
-Holders of \x'-1p'UNIX\v'-4p'\s-3TM\s0\v'4p'/32V,
-System III, or System V software licenses are
-permitted to copy these documents, or any portion of them,
-as necessary for licensed use of the software,
-provided this copyright notice and statement of permission
-are included.
-.sp 2
-Documents USD:8, 14, and 28 are part of the
-user contributed software.
-.sp 2
-The views and conclusions contained in this manual are those of the
-authors and should not be interpreted as representing official policies,
-either expressed or implied, of the Regents of the University of California.
diff --git a/share/man/man8/adduser.8 b/share/man/man8/adduser.8
deleted file mode 100644
index 73e3dcd..0000000
--- a/share/man/man8/adduser.8
+++ /dev/null
@@ -1,115 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)adduser.8 8.1 (Berkeley) 6/5/93
-.\"
-.Dd June 5, 1993
-.Dt ADDUSER 8
-.Os BSD 4
-.Sh NAME
-.Nm adduser
-.Nd procedure for adding new users
-.Sh DESCRIPTION
-A new user must choose a login name, which must not already appear in
-.Pa /etc/passwd
-or
-.Pa /etc/aliases .
-It must also not begin with the hyphen
-.Ql Fl
-character.
-It is strongly recommended that it be all lower-case, and not contain
-the dot
-.Ql \&.
-character, as that tends to confuse mailers.
-An account can be added by editing a line into the passwd file; this
-must be done with the password file locked e.g. by using
-.Xr chpass 1
-or
-.Xr vipw 8 .
-.Pp
-A new user is given a group and user id.
-Login and user id's should be unique across the system, and often across
-a group of systems, since they are used to control file access.
-Typically, users working on similar projects will be put in the same groups.
-At the University of California, Berkeley, we have groups for system staff,
-faculty, graduate students, and special groups for large projects.
-.Pp
-A skeletal account for a new user
-\*(lqernie\*(rq
-might look like:
-.Bd -literal
-ernie::25:30::0:0:Ernie Kovacs,508 Evans Hall,x7925,
- 642-8202:/a/users/ernie:/bin/csh
-.Ed
-.Pp
-For a description of each of these fields, see
-.Xr passwd 5 .
-.Pp
-It is useful to give new users some help in getting started, supplying
-them with a few skeletal files such as
-.Pa \&.profile
-if they use
-.Pa /bin/sh ,
-or
-.Pa \&.cshrc
-and
-.Pa \&.login
-if they use
-.Pa /bin/csh .
-The directory
-.Pa /usr/share/skel
-contains skeletal definitions of such files.
-New users should be given copies of these files which, for instance,
-use
-.Xr tset 1
-automatically at each login.
-.Sh FILES
-.Bl -tag -width /etc/master.passwdxx -compact
-.It Pa /etc/master.passwd
-user database
-.It Pa /usr/share/skel
-skeletal login directory
-.El
-.Sh SEE ALSO
-.Xr chpass 1 ,
-.Xr finger 1 ,
-.Xr passwd 1 ,
-.Xr aliases 5 ,
-.Xr passwd 5 ,
-.Xr pwd_mkdb 8 ,
-.Xr vipw 8
-.Sh BUGS
-User information should (and eventually will) be stored elsewhere.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 3.0 .
diff --git a/share/tabset/3101 b/share/tabset/3101
deleted file mode 100644
index dab586b..0000000
--- a/share/tabset/3101
+++ /dev/null
@@ -1 +0,0 @@
-H 0 0 0 0 0 0 0 0 0
diff --git a/share/tabset/9837 b/share/tabset/9837
deleted file mode 100644
index 57d211f..0000000
--- a/share/tabset/9837
+++ /dev/null
@@ -1 +0,0 @@
-3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ No newline at end of file
diff --git a/share/tabset/aa b/share/tabset/aa
deleted file mode 100644
index 5784745..0000000
--- a/share/tabset/aa
+++ /dev/null
@@ -1 +0,0 @@
- 1 1 1 1 1 1 1 1 1 
diff --git a/share/tabset/aed512 b/share/tabset/aed512
deleted file mode 100644
index 2c9d5fc..0000000
--- a/share/tabset/aed512
+++ /dev/null
@@ -1 +0,0 @@
-\EG1MMM.`40K0001202080K8001????00^L\EC80L80{80^L\EK010100????K0601??0000c818100\EG1HHH.\07210000019A27FD006A280D002A200A52429FE8524861086118612861360N031B4C3F3F1800N041B0C1B4C38301800N001B3B313030301800N011B3B313030341800N021B3B313030381800N050800N061B3B313335301800\07211000015A58E8D5011A58F8D5111A5908D5211A5918D531160\07212000015AD5011858EAD5111858FAD52118590AD5311859160\0721300004B2071C5858E0A18658E0A0A858EA900858F268FA5278590A50A29018591A9F51865908590A90165918591A59038E58E8590A591E58F290185912071C5180A0A0A0901858EA900858F268F60\0721350000BA9472031DEA9502031DE60\E\E\E\EG1MMM.^A
diff --git a/share/tabset/beehive b/share/tabset/beehive
deleted file mode 100644
index 6d30c69..0000000
--- a/share/tabset/beehive
+++ /dev/null
@@ -1,2 +0,0 @@
-
-                                                                               
diff --git a/share/tabset/diablo b/share/tabset/diablo
deleted file mode 100644
index 8acc53f..0000000
--- a/share/tabset/diablo
+++ /dev/null
@@ -1,3 +0,0 @@
- 9
-2 1 1 1 !1 )1 11 91 A1 I1 Q1 Y1 a1 i1 q1 y1
- 9
diff --git a/share/tabset/dtc382 b/share/tabset/dtc382
deleted file mode 100644
index 79257c3..0000000
--- a/share/tabset/dtc382
+++ /dev/null
@@ -1 +0,0 @@
-  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ No newline at end of file
diff --git a/share/tabset/hp700-wy b/share/tabset/hp700-wy
deleted file mode 100644
index a48c65b..0000000
--- a/share/tabset/hp700-wy
+++ /dev/null
Binary files differ
diff --git a/share/tabset/ibm3101 b/share/tabset/ibm3101
deleted file mode 100644
index 7e510ef..0000000
--- a/share/tabset/ibm3101
+++ /dev/null
@@ -1 +0,0 @@
-H 0 0 0 0 0 0 0 0 0 \ No newline at end of file
diff --git a/share/tabset/std b/share/tabset/std
deleted file mode 100644
index e93f737..0000000
--- a/share/tabset/std
+++ /dev/null
@@ -1 +0,0 @@
- 3 1 1 1 1 1 1 1 1 1 1 1 1 1
diff --git a/share/tabset/stdcrt b/share/tabset/stdcrt
deleted file mode 100644
index 66ba12f..0000000
--- a/share/tabset/stdcrt
+++ /dev/null
@@ -1 +0,0 @@
- 3 1 1 1 1 1 1 1 1 1 \ No newline at end of file
diff --git a/share/tabset/tandem653 b/share/tabset/tandem653
deleted file mode 100644
index 4588c34..0000000
--- a/share/tabset/tandem653
+++ /dev/null
@@ -1 +0,0 @@
-3 1 1 1 1 1 1 1 1 1 1
diff --git a/share/tabset/teleray b/share/tabset/teleray
deleted file mode 100644
index 46158f3..0000000
--- a/share/tabset/teleray
+++ /dev/null
@@ -1 +0,0 @@
-GY9(FY90FY98FY9@FY9HFY9PFY9XFY9`FY9hF \ No newline at end of file
diff --git a/share/tabset/vt100 b/share/tabset/vt100
deleted file mode 100644
index 2ea71e1..0000000
--- a/share/tabset/vt100
+++ /dev/null
@@ -1 +0,0 @@
-  H H H H H H H H H H \ No newline at end of file
diff --git a/share/tabset/vt100-w b/share/tabset/vt100-w
deleted file mode 100644
index 20c0614..0000000
--- a/share/tabset/vt100-w
+++ /dev/null
@@ -1 +0,0 @@
-  H H H H H H H H H H H H H H H H H \ No newline at end of file
diff --git a/share/tabset/wyse-adds b/share/tabset/wyse-adds
deleted file mode 100644
index 996ed66..0000000
--- a/share/tabset/wyse-adds
+++ /dev/null
@@ -1,3 +0,0 @@
-Setting tabs... 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2
-
-
diff --git a/share/tabset/xerox1720 b/share/tabset/xerox1720
deleted file mode 100644
index 7437292..0000000
--- a/share/tabset/xerox1720
+++ /dev/null
@@ -1 +0,0 @@
-2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \ No newline at end of file
diff --git a/share/tabset/zenith29 b/share/tabset/zenith29
deleted file mode 100644
index ada8330..0000000
--- a/share/tabset/zenith29
+++ /dev/null
@@ -1 +0,0 @@
- H H H H H H H H H H
diff --git a/share/tmac/README b/share/tmac/README
deleted file mode 100644
index a15dcaf..0000000
--- a/share/tmac/README
+++ /dev/null
@@ -1,145 +0,0 @@
-# @(#)README 8.1 (Berkeley) 6/8/93
-
--mdoc stuff
- doc-* files are unstripped tmac.doc-* files
-
-Site specific string and register names (for doc-{common,nroff,ditroff})
-
-.\" tmac.doc-nroff
-.\"
-.\" Default fonts
-.\" FONT DITROFF style TROFF Style NROFF Style
-.\" Default Times Roman Times Roman Printer Dependent
-.\" Default bold Times Bold Times Bold Printer Dependent
-.\" Default italic Times Italic Times Italic Underline
-.\" Const width lit Courier Times ? Printer Dependent
-.\" Const width bold Courier Bold ? Printer Dependent
-.\" Const width ital Courier Oblique ? Printer Dependent
-.\"
-.\" Default point size 10 (vs 12), Section Header point size 12 (vs 14)
-.\"
-.\" STRING CONSTANTS
-.\" NS aD string (site) Address Style
-.\" NS aR string (site) Argument Reference Style
-.\" NS cM string (site) Interactive Comand Modifier (flag)
-.\" NS eM string (site) Emphasis (in the English sense - usually italics)
-.\" NS eR string (site) Errno Style
-.\" NS eV string (site) Environment Variable Style
-.\" NS fA string (site) Function Argument Style
-.\" NS fL string (site) Command Line Flag Style
-.\" NS fN string (site) Function Name Style
-.\" NS Hs string (site) Header String Style
-.\" NS iC string (site) Interactive Command Style
-.\" NS lI string (site) Literal Style
-.\" NS lp string (site) Left Function Parenthesis Style
-.\" NS rp string (site) Right Function Parenthesis Style
-.\" NS lP string (site) Left Parenthesis Style
-.\" NS rP string (site) Right Parenthesis Style
-.\" NS lB string (site) Bracket Open Style
-.\" NS rB string (site) Bracket Close Style
-.\" NS mL string (site) Diagnostic Message List Style
-.\" NS nM string (site) Name (subject of manpage) Style
-.\" NS nO string (site) normal font (default)
-.\" NS lO string (site) Options Open Bracket Style
-.\" NS rO string (site) Options Close Bracket Style
-.\" NS pA string (site) Pathname Style
-.\" NS Pu string (site) Accepted punctuation string for -mdoc syntax
-.\" NS rA string (site) Reference Author Style
-.\" NS rT string (site) Reference Title Style
-.\" NS sH string (site) Section Header Style
-.\" NS sY string (site) Symbolic Emphasis (boldface)
-.\" NS sX string (site) Section Header Cross References
-.\" NS tN string (site) Trade Name Style
-.\" NS vA string (site) Generic Variable Style
-.\" NS Vs string (site) Volume Title Style
-.\" NS xR string (site) Cross Reference STyle (man page only)
-.\" MISCELLANEOUS
-.\" NS lS string (site) list-label-sep (list-types hang, number, bullet, diag)
-.\" NS iV string soft space (can be split on a newline or padded in adjust mode)
-.\" NS sV string manipulable space
-.\" NS hV string hard space (cannot be split on newline or padded)
-.\" NS tV string tab space (for column function)
-.\" NS sI register (site) subheader indent
-.\" NS tI register (site) text indent
-.\" NS cR register nroff crt flag (1 for crt/online, 0 for printer)
-.\" NS Pp register (site) paragraph vertical spacing
-.\" NS dI register flag (Bd)
-.\" INDENT WIDTHS (used for tag widths, and argument tests)
-.\" NS Ad register (site) Width Needed for Address Tag (indented amount)
-.\" NS Ac register (site) Angle Quote Close Value
-.\" NS Ao register (site) Angle Quote Open Width
-.\" NS Aq register (site) Angle Quote Width
-.\" NS Bc register (site) Bracket Quote Close Value
-.\" NS Bl register (site) Bullet List Macro Value
-.\" NS Bo register (site) Bracket Quote Open Width
-.\" NS Bq register (site) Bracket Quote Width
-.\" NS Ar register (site) Width Needed for Argument
-.\" NS Cm register (site) Width neeeded for Interactive Command Modifier
-.\" NS Co register (site) Width Needed for Column offset
-.\" NS Cx register (site) Width Needed for Complex Expressions
-.\" NS Ds register (site) Width Needed for Display (right and left margins)
-.\" NS Dc register (site) Double Quote Close Value
-.\" NS Do register (site) Double Quote Open Width
-.\" NS Dq register (site) Double Quote Width
-.\" NS Dv register (site) Defined (#define) variable (markup)
-.\" NS tI register (site) tI is dependent on Ds and used by .Dp
-.\" NS Ec register (site) Enclose Quote Close Value
-.\" NS El register (site) Enumerated List Macro Value
-.\" NS Eo register (site) Enclose Quote Open Width
-.\" NS Em register (site) Width Needed for Display
-.\" NS Eq register (site) Enclose Quote Width
-.\" NS Er register (site) Width Needed for Errno Types
-.\" NS Ev register (site) Width Needed for Environment Variables
-.\" NS Ex register (site) Width Needed for Example Indent
-.\" NS Fa register (site) Width Needed for Function Argument
-.\" NS Fl register (site) Width Needed for Flag
-.\" NS Fc register (site) Funtion Quote Close Value
-.\" NS Fn register (site) Width Needed for Function
-.\" NS Fo register (site) Funtion Quote Open Width
-.\" NS Hl register (site) Hypehnated List Macro Value (sub bullet list)
-.\" NS I1, I2, I3 register (site) Indent values
-.\" NS Ic register (site) Width neeeded for Interactive Command Name
-.\" NS Li register (site) Width Needed for Literal Constant
-.\" NS Ms register (site) Width Needed for Math Symbol ? not sure if needed
-.\" NS Nm register (site) Width Needed for Name
-.\" NS No register (site) Width Needed for Name
-.\" NS Ns register (site) No Space Macro Value
-.\" NS Oo register (site) Width Needed for Option Open
-.\" NS Oc register (site) Width Needed for Option Close
-.\" NS Op register (site) Width Needed for Option (one line)
-.\" NS Pa register (site) Width Needed for Pathname
-.\" NS Pf register (site) Prefix Macro Value
-.\" NS Pq register (site) Parenthesis Quote Width
-.\" NS Ql register (site) Width Needed for Quoted Literal
-.\" NS Sc register (site) Single Quote Close Value
-.\" NS So register (site) Single Quote Open Width
-.\" NS Sq register (site) Single Quote Width
-.\" NS Sy register (site) Width Needed for Symbols, Modes or Masks
-.\" NS Sx register (site) Width Needed for Section Header Cross References
-.\" NS Ra register (site) Reference Author
-.\" NS Rj register (site) Reference Journal Name
-.\" NS Rn register (site) Reference Issue Number
-.\" NS Ro register (site) Reference Optional Information
-.\" NS Rr register (site) Reference Technical Report Name
-.\" NS Rt register (site) Reference Book or Article title Title
-.\" NS Rv register (site) Reference Volume
-.\" NS Ta register (site) Tab macro register
-.\" NS Tn register (site) Trade Name Macro Value
-.\" NS Tv register (site) Tab Macro Value
-.\" NS Tx register (site) Width needed for default or unknown text width
-.\" NS Va register (site) Width Needed for Generic Variable
-.\" NS Xc register (site) Extended Argument List Close Value
-.\" NS Xo register (site) Extended Argument List Open Width
-.\" NS Xr register (site) Width Needed for Cross Reference.
-.\" .nr %A 1
-.\" .nr %J 1
-.\" .nr %N 1
-.\" .nr %O 1
-.\" .nr %R 1
-.\" .nr %T 1
-.\" .nr %V 1
-.\" PAGE LAYOUT
-.\" NS pL macro - page layout
-.\" NS Hm register header margin
-.\" NS Fm register footer margin
-.\" NS vV register vertical distance (from Section headers/Lists/Subsections)
diff --git a/share/tmac/doc b/share/tmac/doc
deleted file mode 100644
index 609b9c1..0000000
--- a/share/tmac/doc
+++ /dev/null
@@ -1,3456 +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.
-.\"
-.\" @(#)doc 8.1 (Berkeley) 6/8/93
-.\"
-.\" .mdoc-parse - attempt to parse troff request arguments
-.\" %beginstrip%
-.if \n(.g \{\
-.cp 0
-.ftr C CR
-.\}
-.if t \{\
-. so /usr/share/tmac/tmac.doc-ditroff
-.\}
-.if n \{\
-. so /usr/share/tmac/tmac.doc-nroff
-.\}
-.so /usr/share/tmac/tmac.doc-common
-.so /usr/share/tmac/tmac.doc-syms
-.\" NS Db macro - start/stop DEBUG MODE
-.\" NS Db register DEBUG MODE
-.\" NS iN register DEBUG MODE (inline if 1, to stderr if 0 (default))
-.nr Db 0
-.de Db
-.ie \\n(.$==0 \{\
-. ie \\n(Db==0 \{\
-.tm DEBUGGING ON
-. nr Db 1
-. \}
-. el \{\
-.tm DEBUGGING OFF
-. nr Db 0
-. \}
-.\}
-.el \{\
-. if "\\$1"on" \{\
-.tm DEBUGGING ON
-. nr Db 1
-. \}
-. if "\\$1"off" \{\
-.tm DEBUGGING OFF
-. nr Db 0
-. \}
-.\}
-..
-.\" NS aV macro - parse argument vector (recursive) (.aV arg ... )
-.\" NS fV macro - parse argument vector (recursive) (.fV)
-.\" NS aC register argument counter (aV/fV)
-.\" NS fV register argument counter (must set to \\n(.$ prior to reuqest) (fV)
-.\" NS A[0-9] argument vector (aV/fV)
-.\" NS C[0-9] reg. arg type(1=macro, 2=arg, 3=punct-suf, 4=punct-pre) (aV/fV)
-.\" NS S[0-9] space vector (sV)
-.\" NS aP register argument pointer (aV)
-.\" NS yU local string used for debugging
-.\" NS iI local register (indent for inline debug mode)
-.\" NS mN name of calling request (set in each user requestable macro)
-.de aV
-.nr aC \\n(aC+1
-.ie "\\$1"|" \{\
-. if "\\*(mN"Op" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"Ar" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"Fl" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"Cm" .ds A\\n(aC \fR\\$1\fP
-. if "\\*(mN"It" .ds A\\n(aC \fR\\$1\fP
-.\}
-.el .ds A\\n(aC \\$1
-.aU \\n(aC
-.nr C\\n(aC \\n(aT
-.s\\n(aT
-.if \\n(Db \{\
-. if \\n(aT==1 .ds yU Executable
-. if \\n(aT==2 .ds yU String
-. if \\n(aT==3 .ds yU Closing Punctuation or suffix
-. if \\n(aT==4 .ds yU Opening Punctuation or prefix
-. if \\n(iN==1 \{\
-. br
-. nr iI \\n(.iu
-. in -\\n(iIu
-. if \\n(aC==1 \{\
-\&\fBDEBUG(argv) MACRO:\fP `.\\*(mN' \fBLine #:\fP \\n(.c
-. \}
-\&\t\fBArgc:\fP \\n(aC \fBArgv:\fP `\\*(A\\n(aC' \fBLength:\fP \\n(sW
-\&\t\fBSpace:\fP `\\*(S\\n(aC' \fBClass:\fP \\*(yU
-. \}
-. if \\n(iN==0 \{\
-. if \\n(aC==1 \{\
-. tm DEBUG(argv) MACRO: `.\\*(mN' Line #: \\n(.c
-. \}
-. tm \tArgc: \\n(aC Argv: `\\*(A\\n(aC' Length: \\n(sW
-. tm \tSpace: `\\*(S\\n(aC' Class: \\*(yU
-. \}
-.\}
-.ie \\n(.$==1 \{\
-. nr aP 0
-. ie \\n(dZ==1 \{\
-. if \\n(oM>1 .as b1 \\*(S0
-. \}
-. el \{\
-. if \\n(oM>0 \{\
-. if \\n(fC==0 .as b1 \\*(S0
-. \}
-. \}
-. ds S0 \\*(S\\n(aC
-. if \\n(Db \{\
-. if \\n(iN==1 \{\
-\&MACRO REQUEST: \t.\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. br
-. in \\n(iIu
-. \}
-. if \\n(iN==0 \{\
-.tm \tMACRO REQUEST: .\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. \}
-. \}
-.\}
-.el .aV \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.de fV
-.nr aC \\n(aC+1
-.if "\\*(A\\n(aC"|" \{\
-. if "\\*(mN"Op" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-. if "\\*(mN"Ar" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-. if "\\*(mN"Fl" .ds A\\n(aC \fR\&\\*(A\\n(aC\fP
-. if "\\*(mN"Cm" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-. if "\\*(mN"It" .ds A\\n(aC \fR\\*(A\\n(aC\fP
-.\}
-.aU \\n(aC
-.nr C\\n(aC \\n(aT
-.s\\n(aT
-.if \\n(Db \{\
-. if \\n(aT==1 .ds yU Executable
-. if \\n(aT==2 .ds yU String
-. if \\n(aT==3 .ds yU Closing Punctuation or suffix
-. if \\n(aT==4 .ds yU Opening Punctuation or prefix
-. if \\n(iN==1 \{\
-. br
-. nr iI \\n(.iu
-. in -\\n(iIu
-. if \\n(aC==1 \{\
-\&\fBDEBUG(fargv) MACRO:\fP `.\\*(mN' \fBLine #:\fP \\n(.c
-. \}
-\&\t\fBArgc:\fP \\n(aC \fBArgv:\fP `\\*(A\\n(aC' \fBLength:\fP \\n(sW
-\&\t\fBSpace:\fP `\\*(S\\n(aC' \fBClass:\fP \\*(yU
-. \}
-. if \\n(iN==0 \{\
-. if \\n(aC==1 \{\
-. tm DEBUG(fargv) MACRO: `.\\*(mN' Line #: \\n(.c
-. \}
-. tm \tArgc: \\n(aC Argv: `\\*(A\\n(aC' Length: \\n(sW
-. tm \tSpace: `\\*(S\\n(aC' Class: \\*(yU
-. \}
-.\}
-.ie \\n(fV==1 \{\
-. nr aP 0
-. ie \\n(dZ==1 \{\
-. if \\n(oM>1 .as b1 \\*(S0
-. \}
-. el \{\
-. if \\n(oM>0 \{\
-. if \\n(fC==0 .as b1 \\*(S0
-. \}
-. \}
-. ds S0 \\*(S\\n(aC
-. nr fV 0
-. if \\n(Db \{\
-. ie \\n(iN \{\
-\&\tMACRO REQUEST: .\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. br
-. in \\n(iIu
-. \}
-. el \{\
-.tm \tMACRO REQUEST: .\\*(mN \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-. \}
-. \}
-.\}
-.el \{\
-. nr fV \\n(fV-1
-. fV
-.\}
-..
-.\" NS aX macro - stuff saved strings into `b1' (used by -diag list)
-.de aX
-.nr aP \\n(aP+1
-.as b1 \&\\*(A\\n(aP
-.ie \\n(fV==1 \{\
-. nr aP 0
-. nr fV 0
-.\}
-.el \{\
-. as b1 \&\\*(sV
-. nr fV \\n(fV-1
-. aX
-.\}
-..
-.\" NS aI macro - append arg to arg vector: .aI [arg] [type] (used by .En only)
-.de aI
-.ie \\n(aC<9 \{\
-. nr aC \\n(aC+1
-. ds A\\n(aC \\$1
-. nr C\\n(aC \\$2
-. s\\$2
-. ds xV S\\n(aC
-.\}
-.el \{\
-. tm Usage: Too many arguments (maximum of 8 accepted) (#\\n(.c)
-. tm \\*(A1 \\*(A2 \\*(A3 \\*(A4 \\*(A5 \\*(A6 \\*(A7 \\*(A8 \\*(A9
-.\}
-..
-.\"
-.\" NS aZ macro - print buffer (pB) and clean up arg vectors (aY)
-.de aZ
-.pB
-.aY
-..
-.\" NS aY macro - clean up arg vector
-.de aY
-.rm C0 C1 C2 C3 C4 C5 C6 C7 C8 C9
-.rm A0 A1 A2 A3 A4 A5 A6 A7 A8 A9
-.rm S1 S2 S3 S4 S5 S6 S7 S8 S9
-.nr aC 0
-.nr aP 0
-..
-.\" NS pB macro - test for end of vector (eol) (print b1 buffer or divert)
-.de pB
-.ie \\n(dZ==1 \{\
-. if \\n(oM==1 \{\&\\*(b1
-. rm S0
-. ds b1
-. \}
-. if \\n(oM==0 \{\
-. x2
-. \}
-.\}
-.el \{\
-. ie \\n(oM==0 \{\&\\*(b1
-. rm S0
-. ds b1
-. \}
-. el \{\
-. if ((\\n(sM==1)&(\\n(tP==0)) \{\
-. x1
-. \}
-. \}
-.\}
-.hy
-..
-.\" NS x1 macro - save buffer and divert if tP flag set
-.\" NS eB diversion string
-.\" NS b2 string save of buffer
-.\" NS lK register count of lines read from input file
-.de x1
-.nr dZ \\n(dZ+1
-.ds b2 \\*(b1
-.ds b1
-.nr lK \\n(.c
-.ev 2
-.fi
-.di eB
-..
-.\"
-.\" NS x2 macro - end diversion and print
-.\" NS b0 string local temporary
-.de x2
-.br
-.di
-.ev
-.ie (\\n(.c-\\n(lK>1) \{\
-. ds b0 \&\\*(eB\\
-. ds b1 \\*(b2\\*(b0\\*(b1
-.\}
-.el .ds b1 \\*(b2\\*(b1
-\&\\*(b1
-.rm eB b2 b0 b1
-.nr dZ \\n(dZ-1
-..
-.\" NS Fl macro - flags (appends - and prints flags)
-.\" NS cF register save current font
-.\" NS cZ register save current font size
-.de Fl
-.as b1 \&\\*(fL
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. as b1 \&\|\-\|\fP\s0
-. pB
-. \}
-. el \{\
-. ds mN Fl
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 \{\
-. as b1 \&\|\-\fP\s0
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. as b1 \&\|\-\fP\s0
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. if \\n(C\\n(aP==3 \{\
-. as b1 \&\|\-\|
-. \}
-. fR
-. \}
-. \}
-.\}
-..
-.\"
-.\" NS fR macro - Fl flag recursion routine (special handling)
-.\" NS jM local register
-.\" NS jN local register
-.\"
-.de fR
-.hy 0
-.nr jM \\n(C\\n(aP
-.ie \\n(jM==1 \{\
-. as b1 \&\fP\s0
-. \\*(A\\n(aP
-.\}
-.el \{\
-. nr jN \\n(aP
-. ie \\n(jM==2 \{\
-. ie !"\\*(A\\n(aP"\\*(Ba" \{\
-. ie !"\\*(A\\n(aP"\fR|\fP" \{\
-. ie "\\*(A\\n(aP"-" .as b1 \&\|\-\^\-\|
-. el .as b1 \&\|\-\\*(A\\n(aP
-. \}
-. el .as b1 \&\\*(A\\n(aP
-. \}
-. el .as b1 \&\\*(A\\n(aP
-. \}
-. el .as b1 \&\f\\n(cF\s\\n(cZ\\*(A\\n(aP\fP\s0
-. ie \\n(aC==\\n(aP \{\
-. if \\n(jM==4 .as b1 \&\|\-
-. as b1 \&\fP\s0
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. ie ((\\n(C\\n(aP==3)&(\\n(C\\n(jN==4)) .as b1 \&\|\-
-. el .as b1 \&\\*(S\\n(jN
-. fR \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.rr jM jN
-..
-.\"
-.\" NS nR macro - general name recursion routine
-.\" NS jM local register
-.\" NS jN local register
-.de nR
-.hy 0
-.nr jM \\n(C\\n(aP
-.ie \\n(jM==1 \{\
-. as b1 \&\f\\n(cF\s\\n(cZ
-. \\*(A\\n(aP
-.\}
-.el \{\
-. nr jN \\n(aP
-. ie \\n(jM==2 .as b1 \&\\*(A\\n(aP
-. el .as b1 \&\f\\n(cF\s\\n(cZ\\*(A\\n(aP\fP\s0
-. ie \\n(aC==\\n(aP \{\
-. as b1 \&\f\\n(cF\s\\n(cZ
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. as b1 \&\\*(S\\n(jN
-. nR
-. \}
-.\}
-.rr jM jN
-..
-.\" NS Ar macro - command line `argument' macro
-.\"
-.de Ar
-.as b1 \\*(aR
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. as b1 file\ ...\fP\s0
-. pB
-. \}
-. el \{\
-. ds mN Ar
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 \{\
-. as b1 \&file\ ...\fP\s0
-. aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. as b1 \&file\ ...\fP\s0
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. if \\n(C\\n(aP==3 \{\
-. as b1 \&file\ ...
-. \}
-. nR
-. \}
-. \}
-.\}
-..
-.\" NS Ad macro - Addresses
-.de Ad
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ad address ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ad
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(aD
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Cd macro - Config declaration (for section 4 SYNOPSIS) (not callable)
-.\" needs work - not very translatable
-.de Cd
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Cd Configuration file declaration (#\\n(.c)
-. el \{\
-. ds mN Cd
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.br
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(nM
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie \\n(nS \{\
-. if "\\*(mN"Cd" \{\
-. rs
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 .nr iS \\n(Dsu
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-. \}
-. nR
-. in -\\n(iSu
-. \}
-. el .nR
-.\}
-..
-.\" NS Cm macro - Interactive command modifier (flag)
-.de Cm
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Cm Interactive command modifier ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Cm
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(cM
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Dv macro - define variable
-.de Dv
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Dv define_variable ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Dv
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eR
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Em macro - Emphasis
-.de Em
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. tm Usage: .Em text ... \\*(Pu (#\\n(.c)
-. \}
-. el \{\
-. ds mN Em
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eM
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Er macro - Errnotype
-.de Er
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Er ERRNOTYPE ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Er
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eR
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Ev macro - Environment variable
-.de Ev
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ev ENVIRONMENT_VARIABLE ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ev
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(eV
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Fd macro - function declaration - not callable (& no err check)
-.\" NS fD register subroutine test (in synopsis only)
-.\" NS fY register subroutine count (in synopsis only) (fortran only)
-.\" NS fZ register also subroutine count (in synopsis only)
-.de Fd
-.ds mN Fd
-.if \\n(nS>0 \{\
-.\" if a variable type was the last thing given, want vertical space
-. if \\n(fX>0 \{\
-. Pp
-. nr fX 0
-. \}
-.\" if a subroutine was the last thing given, want vertical space
-. if \\n(fZ>0 \{\
-. ie \\n(fD==0 \{\
-. Pp
-. rs
-. \}
-. el .br
-. \}
-. nr fD \\n(fD+1
-.\}
-.nr cF \\n(.f
-.nr cZ \\n(.s
-\&\\*(fD\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.br
-.ft \\n(cF
-.fs \\n(cZ
-..
-.\" NS Fr macro - function return value - not callable (at the moment)
-.de Fr
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fr Function_return_value... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Fr
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(aR
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Ic macro - Interactive command
-.de Ic
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ic Interactive command ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ic
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(iC
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Li macro - literals
-.de Li
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage .Li argument ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Li
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(lI
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Or macro - Pipe symbol (OR)
-.de Or
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Or ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Or
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(iC
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Ms macro - Math symbol
-.de Ms
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Ms Math symbol ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Ms
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(sY
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Nm macro - Name of command or page topic
-.\" NS n1 string - save first invocation of .Nm
-.\" NS iS register - indent second command line in a synopsis
-.de Nm
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. ie "\\*(n1"" .tm Usage: .Nm Name(s) ... \\*(Pu (#\\n(.c)
-. el \&\\*(nM\\*(n1\fP\s0
-. \}
-. el \{\
-. ds mN Nm
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie \\n(aC==\\n(aP \{\
-. as b1 \&\\*(nM\\*(n1\fP\s0
-. aZ
-. \}
-. el \{\
-. as b1 \\*(nM
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. as b1 \&\\*(n1\fP\s0
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. if \\n(nS \{\
-. if "\\*(mN"Nm" \{\
-. rs
-. in -\\n(iSu
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 \{\
-. sw \\$1
-. nr iS ((\\n(sWu+1)*\\n(fW)u
-. \}
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-. \}
-. \}
-. if "\\*(n1"" .ds n1 \\*(A\\n(aP
-. nR
-. \}
-. \}
-.\}
-..
-.\" NS Pa macro - Pathname
-.de Pa
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \&\\*(pA~\fP\s0
-. el \{\
-. ds mN Pa
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(pA
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Sy macro - Symbolics
-.de Sy
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Sy symbolic_text ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Sy
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(sY
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Tn macro - Trade Name Macro
-.de Tn
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Tn Trade_name(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Tn
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(tN\\*(tF
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS nN macro - Trade Name Macro for inside of reference
-.de nN
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Tn Trade_name(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Tn
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(tN
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS Va macro - variable name macro
-.de Va
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Va variable_name(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Va
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. as b1 \\*(vA
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\"
-.\" NS No macro - Normal text macro (default text style if mess up)
-.de No
-.as b1 \\*(nO
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .No must be called with arguments (#\\n(.c)
-. el \{\
-. ds mN No
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-. \}
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" NS Op macro - Option Expression
-.de Op
-.if \\n(aC==0 \{\
-. ds mN Op
-.\}
-.\" .ds qL \&\\*(lO
-.\" .ds qR \&\\*(rO
-.ds qL \&\\*(lB
-.ds qR \&\\*(rB
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-..
-.\" NS Aq macro - Enclose string in angle brackets
-.de Aq
-.if \\n(aC==0 .ds mN Aq
-.ds qL \&<
-.ds qR \&>
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Bq macro - Enclose string in square brackets
-.de Bq
-.if \\n(aC==0 .ds mN Bq
-.ds qL \&\\*(lB
-.ds qR \&\\*(rB
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Dq macro - Enclose string in double quotes
-.de Dq
-.if \\n(aC==0 .ds mN Dq
-.ds qL \&\\*(Lq
-.ds qR \&\\*(Rq
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Eq macro - Enclose string in double quotes
-.de Eq
-.if \\n(aC==0 .ds mN Eq
-.ds qL \\$1
-.ds qR \\$2
-.En \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Pq macro - Enclose string in parenthesis
-.de Pq
-.if \\n(aC==0 .ds mN Pq
-.ds qL \&\\*(lP
-.ds qR \&\\*(rP
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Ql macro - Quoted literal is in file mdoc-[dit|n|g]roff (too large
-.\" an if-else to carry along recursively for `if n ...')
-.\"
-.\" NS Sq macro - Enclose string in single quotes
-.de Qq
-.if \\n(aC==0 .ds mN Qq
-.ds qL \&\\*q
-.ds qR \&\\*q
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Sq macro - Enclose string in single quotes
-.de Sq
-.if \\n(aC==0 .ds mN Sq
-.ds qL \&\\*(sL
-.ds qR \&\\*(sR
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"
-.\" NS Es macro - Set up strings for .En call
-.de Es
-.if \\n(aC==0 \{\
-. ie \\n(.$>2 .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el \{\
-. ds qL \\$1
-. ds qR \\$2
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ds qL \\*(A\\n(aP
-. nr aP \\n(aP+1
-. ds qR \\*(A\\n(aP
-. ie \\n(aC>\\n(aP .c\\n(C\\n(aP
-. el .aZ
-.\}
-..
-.\" .tm En beg arg(A[\\n(aP])==\\*(A\\n(aP;
-.\" .tm En oM==\\n(oM; dZ==\\n(dZ; Xt==\\n(Xt; aC==\\n(aC
-.\" NS En macro - Enclose string with given args (eg [ and ] etc)
-.\" NS qL string variable set by calling macro
-.\" NS qR string variable set by calling macro
-.\" NS aJ register (for vR)
-.de En
-.ie \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. as b1 \&\\*(qL\\*(qR
-. pB
-. \}
-. el \{\
-.\". as mN (En)
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. as b1 \&\\*(qL
-. \}
-.\}
-.el \{\
-. as b1 \&\\*(qL
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 \{\
-. as b1 \&\\*(qR
-. aZ
-. \}
-. el \{\
-. ie \\n(C\\n(aC==3 \{\
-. nr aJ \\n(aC-1
-. vR
-. nr aJ \\n(aJ+1
-. ds A\\n(aJ \&\\*(qR\\*(A\\n(aJ
-. nr aJ 0
-. \}
-. el .aI \&\\*(qR 3
-. nr aP \\n(aP+1
-. if \\n(C\\n(aP==1 .\\*(A\\n(aP
-. if \\n(C\\n(aP>1 \{\
-. nr aP \\n(aP-1
-. No
-. \}
-. \}
-.\}
-..
-.\" NS vR macro - vector routine (for En, trace backwards past trail punct)
-.de vR
-.if \\n(C\\n(aJ==3 \{\
-. nr aJ \\n(aJ-1
-. vR
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" NS Ao macro - Angle open
-.de Ao
-.if \\n(aC==0 .ds mN Ao
-.ds qL \&<
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Ac macro - Angle close
-.de Ac
-.if \\n(aC==0 .ds mN Ac
-.ds qR \&>
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Bo macro - Bracket open
-.de Bo
-.if \\n(aC==0 .ds mN Bo
-.ds qL \&[
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Bc macro - Bracket close
-.de Bc
-.if \\n(aC==0 .ds mN Bc
-.ds qR \&]
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Do macro - Double Quote open
-.de Do
-.if \\n(aC==0 .ds mN Do
-.ds qL \&\\*(Lq
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Dc macro - Double Quote close
-.de Dc
-.if \\n(aC==0 .ds mN Dc
-.ds qR \&\\*(Rq
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Eo macro - Enclose open
-.de Eo
-.if \\n(aC==0 .ds mN Eo
-.ds qL \\$1
-.eO \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Ec macro - Enclose close
-.de Ec
-.if \\n(aC==0 .ds mN Ec
-.ds qR \\$1
-.eC \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Oo macro - Option open
-.de Oo
-.if \\n(aC==0 .ds mN Oo
-.ds qL \&[
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Oc macro - Option close
-.de Oc
-.if \\n(aC==0 .ds mN Oc
-.ds qR \&]
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Po macro - Parenthesis open
-.de Po
-.if \\n(aC==0 .ds mN Po
-.ds qL \&(
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Pc macro - Parenthesis close
-.de Pc
-.if \\n(aC==0 .ds mN Pc
-.ds qR \&)
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Qo macro - Straight Double Quote open
-.de Qo
-.if \\n(aC==0 .ds mN Qo
-.ds qL \&\\*q
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Qc macro - Straight Double Quote close
-.de Qc
-.if \\n(aC==0 .ds mN Qc
-.ds qR \&\\*q
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS So macro - Single Quote open
-.de So
-.if \\n(aC==0 .ds mN So
-.ds qL \&\\*(sL
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Sc macro - Single Quote close
-.de Sc
-.if \\n(aC==0 .ds mN Sc
-.ds qR \&\\*(sR
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Xo macro - Extend open (continue)
-.de Xo
-.if \\n(aC==0 .ds mN Xo
-.\" .nr mN 1
-.ds qL
-.eO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Xe macro - Extend close (end)
-.de Xc
-.\" .nr mN 0
-.if \\n(aC==0 .ds mN Xc
-.ds qR
-.eC \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS eO macro - enclose string open
-.\" NS oM register (extension possible)
-.de eO
-.nr oM \\n(oM+1
-.\" .tm eO last arg==A[\\n(aC]==\\*(A\\n(aC; aP==\\n(aP; oM==\\n(oM; dZ==\\n(dZ;
-.ie \\n(aC==0 \{\
-. ie \\n(.$>0 \{\
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. as b1 \\*(qL
-. \}
-. el \{\
-. as b1 \\*(qL
-. if (\\n(dZ==0)&(\\n(sM==1) \{\
-. nr dZ \\n(dZ+1
-. ds b2 \\*(b1
-. ds b1
-. nr lK \\n(.c
-. ev 2
-. fi
-. di eB
-. \}
-. \}
-.\}
-.el \{\
-. as b1 \\*(qL
-.\}
-.ie \\n(aC>0 \{\
-. if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 .\\*(A\\n(aP
-. el \{\
-. nr aP \\n(aP-1
-. No
-. \}
-. \}
-. if \\n(aC==\\n(aP \{\
-. if \\n(tP==1 \{\
-.\" .tm SETTING Xt!!!
-. nr Xt 1
-. \}
-.\".\" . ds S0
-.\"CHANGED ds S0 \\*(iV
-. aY
-. \}
-.\}
-.el \{\
-. if \\n(oM>1 .as b1 \\*(sV
-.\}
-..
-.\"
-.\" NS eC macro - enclose string close
-.\" NS aa local register
-.de eC
-.nr oM \\n(oM-1
-.\" tm eC last arg==A[\\n(aC]==\\*(A\\n(aC; aP==\\n(aP; oM==\\n(oM; dZ==\\n(dZ;
-.as b1 \\*(qR
-.if \\n(aC==0 \{\
-. ie \\n(.$>0 \{\
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-. el \{\
-. ie "\\*(xB"" \{\
-. pB
-. \}
-. el \{\
-. pB
-.\\*(L\\n(lC
-. nr Xt 0
-. ds xB
-. \}
-. \}
-.\}
-.if \\n(aC>0 \{\
-. ie \\n(aC==\\n(aP \{\
-. ie \\n(oM==0 \{\
-. aZ
-. \}
-. el .aY
-. \}
-. el \{\
-. nr aa \\n(aP+1
-. if \\n(C\\n(aa==2 .as b1 \\*(S\\n(aC
-.\" tm CURRENT arg (aP==\\*(A\\n(aP and ap+1==\\*(A\\n(aa) tP==\\n(tP Xt==\\n(Xt
-. rr aa
-. if \\n(tP>0 \{\
-.\" tm UNSETTING Xt==\\n(Xt!!!!
-. if \\n(Xt>0 .nr Xt \\n(Xt-1
-.\" tm NOW Xt==\\n(Xt!!!!
-. \}
-. No
-. \}
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" NS Pf macro - Prefix (calls .pF)
-.de Pf
-.if \\n(aC==0 .ds mN Pf
-.ds qL \&\\$1
-.pF \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS pF macro - Prefix (for prefixing open quotes, brackets etc)
-.de pF
-.ie \\n(aC==0 \{\
-. as b1 \&\\*(qL
-. ie \\n(.$<2 \{\
-. tm Warning: Missing arguments - prefix .Pf)
-. pB
-. \}
-. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.el \{\
-. ie (\\n(aC-\\n(aP)>1 \{\
-. nr aP \\n(aP+1
-. as b1 \&\\*(A\\n(aP
-. \}
-. el .tm Warning: .Pf: trailing prefix (#\\n(.c)
-.\}
-.if \\n(aC>0 \{\
-. ie (\\n(aC-\\n(aP)==0 .aZ
-. el \{\
-. nr aP \\n(aP+1
-. c\\n(C\\n(aP
-. \}
-.\}
-..
-.\" NS Ns macro - remove space (space remove done by .aV or .fV)
-.de Ns
-.if \\n(aC==0 \{\
-. ds mN Ns
-. ie \\n(.$>0 .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el .tm Usage: .Ns must be called with arguments (#\\n(.c)
-.\}
-.No
-..
-.de Ap
-.if \\n(aC==0 \{\
-. ds mN Ap
-. tm Usage: Ap "cannot be first request on a line (no .Ap)" (#\\n(.c)
-.\}
-.as b1 \&'
-.No
-..
-.\" NS Hv macro - Hard (unpaddable) Space vector
-.\" NS iV string inter-vector space
-.\" NS sV string inter-argument space
-.de Hv
-.ds iV \\*(sV
-.ds sV \\*(hV
-..
-.\" NS Sv macro - Soft Space vector (troff limitation)
-.de Sv
-.ds sV \\*(iV
-..
-.\" NS Tv macro - Tab Space vector
-.de Tv
-.ds sV \\*(tV
-..
-.\" NS Sm macro - Space mode
-.\" NS sM register - default is one (space mode on)
-.nr sM 1
-.de Sm
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm "Usage: .Sm [off | on]" (#\\n(.c)
-. el \{\
-. ds mN Sm
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>0 \{\
-. nr aP \\n(aP+1
-. if "\\*(A\\n(aP"on" \{\
-. ds sV \\*(iV
-. nr sM 1
-. \}
-. if "\\*(A\\n(aP"off" \{\
-. ds sV
-. rm S0 S1 S2 S3 S4 S5 S6 S7 S8 S9
-. nr sM 0
-. \}
-. ie \\n(aC>\\n(aP \{\
-. No
-. \}
-. el .aY
-.\}
-..
-.\"------------------------------------------------------------------------
-.\" Size and Argument type macros
-.\" NS aT macro - argument type
-.\" NS aU macro - argument type (same as .aT but uses A[1-9] strings
-.\" NS aT register argument type
-.if \n(.g \{\
-.de aT
-.nr aT 0
-.ie \\n(sW>2:(\A'\\$1'==0) \{\
-. nr aT 2
-.\}
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\$1>2 \{\
-. nr aT \\n(z\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie \\n(\\$1 \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.de aU
-.nr aT 0
-.aW \\$1
-.ie \\n(sW>2:(\A'\\*(A\\$1'==0) .nr aT 2
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\*(A\\$1>2 \{\
-. nr aT \\n(z\\*(A\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie (\\n(\\*(A\\$1) \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.\}
-.if !\n(.g \{\
-.de aT
-.nr aT 0
-.ie \\n(sW>2 \{\
-. nr aT 2
-.\}
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\$1>2 \{\
-. nr aT \\n(z\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie \\n(\\$1 \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.de aU
-.nr aT 0
-.aW \\$1
-.ie \\n(sW>2 .nr aT 2
-.el \{\
-. if \\n(sW==1 \{\
-. ie \\n(z\\*(A\\$1>2 \{\
-. nr aT \\n(z\\*(A\\$1
-. \}
-. el .nr aT 2
-. \}
-. if \\n(sW==2 \{\
-. ie (\\n(\\*(A\\$1) \{\
-. nr aT 1
-. \}
-. el .nr aT 2
-. \}
-.\}
-..
-.\}
-.\" NS s1 macro - set spacing for class type 1
-.\" NS s2 macro - set spacing for class type 2
-.\" NS s3 macro - set spacing for class type 3
-.\" NS s1 macro - set spacing for class type 1
-.\" NS s2 macro - set spacing for class type 2
-.\" NS s3 macro - set spacing for class type 3
-.\" NS s4 macro - set spacing for class type 4
-.\" NS S[0-9] string spacing
-.\" NS xX local register
-.\" NS aa local register
-.de s0
-.tm MDOC-ERROR: bogus type 0 (can't set space '\\*(A\\n(aC') (#\\n(.c)
-..
-.de s1
-.if \\n(\\*(A\\n(aC==3 \{\
-. nr xX \\n(aC-1
-. rm S\\n(xX
-. ds S\\n(aC \\*(sV
-.\}
-.if \\n(\\*(A\\n(aC==2 \{\
-. nr xX \\n(aC-1
-.\" this kludge can probably go away, but need to double check first
-. ie "\\*(A\\n(aC"Nb" .ds S\\n(xX \\*(hV
-. el .rm S\\n(xX
-.\}
-..
-.de s2
-.ds S\\n(aC \\*(sV
-..
-.de s3
-.if \\n(aC>1 \{\
-. nr xX \\n(aC-1
-. rm S\\n(xX
-.\}
-.ds S\\n(aC \\*(sV
-..
-.de s4
-.nr aa 0
-..
-.\" Class switches (on current argument aP)
-.\" NS c0 macro - catch errors (non-existent class type 0)
-.\" NS c1 macro - call request if type 1
-.\" NS c2 macro - call .No if type 2
-.\" NS c3 macro - call .No if type 3
-.\" NS c4 macro - call .No if type 4
-.de c0
-.tm MDOC-ERROR: bogus class 0 (can't determine '\\*(A\\n(aC') (#\\n(.c)
-..
-.de c1
-.\\*(A\\n(aP
-..
-.de c2
-.nr aP \\n(aP-1
-.No
-..
-.de c3
-.nr aP \\n(aP-1
-.No
-..
-.de c4
-.nr aP \\n(aP-1
-.No
-..
-.\" NS y1 macro - ignore if class 1
-.\" NS y2 macro - ignore if class 2
-.\" NS y3 macro - append if type 3
-.\" NS y4 macro - append if type 4
-.de y1
-.nr aa 1
-..
-.de y2
-.nr aa 1
-..
-.de y3
-.as b1 \\*(A\\n(aP
-.nr aP \\n(aP+1
-.n\\C\\n(aP
-..
-.de y4
-.as b1 \\*(A\\n(aP
-.nr aP \\n(aP+1
-.n\\C\\n(aP
-..
-.\"--------------------------------------------------------------------------
-.\" Ns Bf macro - Begin Font Mode (will be begin-mode/end-mode in groff & TeX)
-.\" Ns Ef macro - End Font Mode
-.de Bf
-.ds mN Bf
-.ie \\n(.$>0 \{\
-. nr bF \\n(.f
-. nr bZ \\n(.s
-. if "\\$1"Em" \&\\*(eM\c
-. if "\\$1"Li" \&\\*(lI\c
-. if "\\$1"Sy" \&\\*(sY\c
-. if "\\$1"-emphasis" \&\\*(eM\c
-. if "\\$1"-literal" \&\\*(lI\c
-. if "\\$1"-symbolic" \&\\*(sY\c
-.\}
-.el .tm Usage .Bf [Em | emphasis | Li | literal | Sy | symbolic] (#\\n(.c)
-..
-.de Ef
-.ds mN Ef
-.ie \\n(.$>0 .tm Usage .Ef (does not take arguments) (#\\n(.c)
-.el \&\f\\n(bF\s\\n(bZ
-..
-.\" Ns Bk macro - Begin Keep
-.\" Ns Ek macro - End Keep
-.\" Ns kS string - keep type
-.de Bk
-.ds mN Bk
-.ie \\n(.$==0 \{\
-.tm Usage: .Bk [-lines | -words] (#\\n(.c)
-.\}
-.el \{\
-. if !"\\*(kS"" .tm .Bk: nesting keeps not implemented yet. (#\\n(.c)
-. if "\\$1"-lines" .tm .Bd -lines: Not implemented yet. (#\\n(.c)
-. if "\\$1"-words" .Hv
-. ds kS \\$1
-.\}
-..
-.de Ek
-.ds mN Ek
-.ie \\n(.$>0 .tm Usage .Ek (does not take arguments) (#\\n(.c)
-.el \{\
-. if "\\*(kS"-lines" .tm .Bd -lines: Not implemented yet. (#\\n(.c)
-. if "\\*(kS"-words" .Sv
-. rm kS
-.\}
-..
-.\" NS Bd macro - Begin Display display-type [offset string]
-.\" NS Ed macro - end Display
-.\" NS O[0-9] registers - stack of indent
-.\" NS d[0-9] registers - display-type stack
-.de Bd
-.ds mN Bd
-.ie \\n(.$==0 \{\
-.tm Usage: .Bd [-literal | -filled | -ragged | -unfilled] [-offset [string]] [-compact] (#\\n(.c)
-.\}
-.el \{\
-. ds aa
-. nr bV 0
-. nr iD 0
-. nr dP \\n(dP+1
-. if "\\$1"-literal" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dL
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie t \{\&\\*(lI
-' ta 9n 18n 27n 36n 45n 54n 63n 72n
-. \}
-. el \{\
-' ta 8n 16n 24n 32n 40n 48n 56n 64n 72n
-. \}
-. nf
-. \}
-. if "\\$1"-filled" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dF
-. br
-. \}
-. if "\\$1"-ragged" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dR
-. na
-. \}
-. if "\\$1"-unfilled" \{\
-. nr iD \\n(iD+1
-. ds d\\n(dP dU
-. nf
-. \}
-.\" .tm Here is argc: \\n(.$ and here is iD \\n(iD
-. if ((\\n(iD>=1)&(\\n(.$>\\n(iD)) \{\
-. bV \\$2 \\$3 \\$4
-. \}
-. if \\n(O\\n(dP>0 'in \\n(.iu+\\n(O\\n(dPu
-. if (\\n(bV==0) \{\
-. if (\\n(nS==0) \{\
-. ie "\\*(d\\n(dP"dR" .sp \\n(dVu
-. el 'sp \\n(dVu
-. \}
-. \}
-. if \\n(cR==0 .ne 2v
-. nr bV 0
-. nr iD 0
-.\}
-..
-.\" NS bV macro - resolve remaining .Bd arguments
-.de bV
-.\" .tm in bV with args: \\$1 \\$2 \\$3
-.nr iD 1
-.ds bY
-.if "\\$1"-offset" \{\
-. ds bY \\$2
-. if "\\*(bY"left" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP 0
-. \}
-. if "\\*(bY"right" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP (\\n(.l/3)u
-. \}
-. if "\\*(bY"center" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP (\\n(.l-\\n(.i)/4u
-. \}
-. if "\\*(bY"indent" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP \\n(dIu
-. \}
-. if "\\*(bY"indent-two" \{\
-. nr iD \\n(iD+1
-. nr O\\n(dP \\n(dIu+\\n(dIu
-. \}
-. if \\n(iD==1 \{\
-. nr iD \\n(iD+1
-. sW "\\*(bY"
-. ie \\n(sW>2 \{\
-. ie ((\\*(bY>9n)&(\\*(bY<100n)) \{\
-. nr O\\n(dP \\*(bY
-. \}
-. el .nr O\\n(dP (\\n(sW)*\\n(fWu
-. \}
-. el \{\
-. if \\n(sW==2 .aT \\*(bY
-. ie \\n(aT==1 \{\
-. nr O\\n(dP \\n(\\*(bY
-. \}
-. el .nr O\\n(dP \\*(bY
-. \}
-. \}
-.\}
-.if "\\$1"-compact" \{\
-. nr bV 1
-.\}
-.if \\n(iD<\\n(.$ \{\
-. ie "\\*(bY"" \{\
-. bV \\$2 \\$3
-. \}
-. el \{\
-. bV \\$3
-. \}
-.\}
-..
-.\" NS Ed macro - end display
-.de Ed
-.ds mN Ed
-.br
-.if \\n(dP==0 .tm mdoc: Extraneous .Ed
-.if "\\*(d\\n(dP"dL" \{\
-. ft \\n(cF
-. fz \\n(cZ
-.\}
-.in \\n(.iu-\\n(O\\n(dPu
-.rr O\\n(dP
-.rm d\\n(dP
-.nr dP \\n(dP-1
-.fi
-.if t .ad
-..
-.\"--------------------------------------------------------------------------
-.\" NS Bl macro - begin list (.Bl list-type)
-.\" NS L[0-9] registers - stack of list types
-.de Bl
-.ie \\n(.$==0 \{\
-.tm Usage: .Bl [[-hang | -tag] [-width]] [ -item | -enum | -bullet | -diag] (#\\n(.c)
-.\}
-.el \{\
-. ds mN Bl
-. nr aP 0
-. nr lC \\n(lC+1
-. ds A1 \\$2
-. ds A2 \\$3
-. ds A3 \\$4
-. ds A4 \\$5
-. ds A5 \\$6
-. ds A6 \\$7
-. ds A7 \\$8
-. ds A8 \\$9
-. nr fV \\n(.$-1
-. if "\\$1"-hang" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC hL
-. nr w\\n(lC 6n
-. nr tC 1
-. \}
-. if "\\$1"-tag" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC tL
-. nr tC 1
-. \}
-. if "\\$1"-item" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC iT
-. nr tC 1
-. \}
-. if "\\$1"-enum" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC nU
-. nr w\\n(lC 3n
-. nr tC 1
-. \}
-. if "\\$1"-bullet" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC bU
-. nr w\\n(lC 2n
-. nr tC 1
-. \}
-. if "\\$1"-dash" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC hU
-. nr w\\n(lC 2n
-. nr tC 1
-. \}
-. if "\\$1"-hyphen" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC hU
-. nr w\\n(lC 2n
-. nr tC 1
-. \}
-. if "\\$1"-inset" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC lL
-. nr tC 1
-. \}
-. if "\\$1"-diag" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC mL
-. nr mL 1
-. \}
-. if "\\$1"-ohang" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC oL
-. nr tC 1
-. \}
-. if "\\$1"-column" \{\
-. nr aP \\n(aP+1
-. ds L\\n(lC cL
-. \}
-. ie \\n(aP==0 \{\
-. tm \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. tm Usage: .Bl [[-inset|-tag] -width] [-item|-enum|-bullet|-diag] (#\\n(.c)
-. \}
-. el \{\
-. tY
-. if (\\n(aP==1)&(\\n(aP<\\n(.$) \{\
-. nr aP 0
-. lV
-. if "\\*(L\\n(lC"cL" \{\
-. W\\n(wV
-. nr w\\n(lC 0
-' in -\\n(eWu
-. ie \\n(v\\n(lC==1 \{\
-. nr aa 0
-. \}
-. el \{\
-. sp \\n(dVu
-. \}
-. nf
-. nr wV 0
-. \}
-. \}
-. \}
-. nr aP 0
-.\" . ds b1
-. aY
-.\" .tm Here is L[\\n(lC]==\\*(L\\n(lC
-.\}
-..
-.if \n(.g \{\
-. nr i 10
-. while \ni<100 \{\
-. nr num!\nin 1
-. nr i +1
-. \}
-.\}
-.\" NS lV macro - resolve remaining .Bl arguments
-.de lV
-.nr aP \\n(aP+1
-.if \\n(fV>=\\n(aP \{\
-. nr iD 0
-. if "\\*(A\\n(aP"-compact" \{\
-. nr iD 1
-. nr v\\n(lC 1
-. \}
-. if "\\*(A\\n(aP"-width" \{\
-. nr iD 1
-. nr aP \\n(aP+1
-. nr tW 1
-. ds t\\n(lC TagwidtH
-. ds tS \\*(A\\n(aP
-. aW \\n(aP
-. ie \\n(sW>2 \{\
-. nr w\\n(lC (\\n(sW)*\\n(fWu
-. if \\n(sW==3 \{\
-. ie \\n(.g \{\
-. if \A'\\*(tS' .if r num!\\*(tS \{\
-. nr w\\n(lC \\*(tS
-. \}
-. \}
-. el \{\
-. if (\\*(tS>9n)&(\\*(tS<99n) \{\
-. nr w\\n(lC \\*(tSu
-. \}
-. \}
-. \}
-. \}
-. el \{\
-. aT \\*(tS
-. ie \\n(aT==1 \{\
-. nr w\\n(lC \\n(\\*(tS
-. \}
-. el \{\
-. nr w\\n(lC \\*(tSu
-. \}
-. \}
-. \}
-. if "\\*(A\\n(aP"-offset" \{\
-. nr iD 1
-. nr aP \\n(aP+1
-. ie "\\*(A\\n(aP"indent" \{\
-. nr o\\n(lC \\n(Dsu
-. \}
-. el \{\
-. ds tS \\*(A\\n(aP
-. aW \\n(aP
-. ie \\n(sW>2 \{\
-. nr o\\n(lC (\\n(sW)*\\n(fWu
-. ie \\n(.g \{\
-. if \A'\\*(tS' .if r num!\\*(tS \{\
-. nr o\\n(lC \\*(tS
-. \}
-. \}
-. el \{\
-. if (\\*(tS>9n)&(\\*(tS<100n) \{\
-. nr o\\n(lC \\*(tS
-. \}
-. \}
-. \}
-. el \{\
-. ie \\n(C\\n(aP==1 .nr o\\n(lC \\n(\\*(tS
-. el .nr o\\n(lC \\*(tS
-. \}
-. \}
-. \}
-. if \\n(iD==0 \{\
-. if "\\*(L\\n(lC"cL" \{\
-. nr wV \\n(wV+1
-. ds A\\n(wV \\*(A\\n(aP
-. \}
-. \}
-. if \\n(fV>\\n(aP .lV
-.\}
-..
-.\" NS El macro - end list
-.\" NS iD local register
-.de El
-.ie \\n(.$>0 \{\
-. tm Usage: .El (#\\n(.c)
-.\}
-.el \{\
-. ds mN El
-. nr iD 0
-. if "\\*(L\\n(lC"cL" \{\
-. nr iD 1
-. cC
-. \}
-. if "\\*(L\\n(lC"nU" \{\
-. nr nU 0
-. \}
-. if \\n(mL>0 \{\
-. nr iD 1
-. nr mL 0
-. tZ
-. nr lC \\n(lC-1
-. tY
-. \}
-. if "\\*(L\\n(lC"iT" \{\
-' in \\n(.iu-\\n(o\\n(lCu
-. tZ
-. nr lC \\n(lC-1
-. tY
-. nr iD 1
-. \}
-. if "\\*(L\\n(lC"oL" \{\
-' in \\n(.iu-\\n(o\\n(lCu
-. tZ
-. nr lC \\n(lC-1
-. tY
-. nr iD 1
-. \}
-. if "\\*(L\\n(lC"lL" \{\
-' in \\n(.iu-\\n(o\\n(lCu
-. tZ
-. nr lC \\n(lC-1
-. tY
-. nr iD 1
-. \}
-. if \\n(iD==0 \{\
-. lE
-. \}
-. br
-. nr iD 0
-.\}
-..
-.\" NS It macro - list item
-.\" NS iD local register
-.\" NS aA save pA font string for section FILES (no underline if nroff)
-.de It
-.if "\\*(L\\n(lC"" \{\
-. tm Usage .Bl -list-type [-width [string] | -compact | -offset [string]] (#\\n(.c)
-. tm .It \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-.\}
-.\" .tm Here is L[\\n(lC]==\\*(L\\n(lC
-.ne 3v
-.ie \\n(.$>0 \{\
-. ds mN It
-. ds b1
-. nr iD 0
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. if "\\*(L\\n(lC"mL" \{\
-. nr iD 1
-. nr aP 0
-. aX
-. \\*(L\\n(lC
-. \}
-. if "\\*(L\\n(lC"cL" \{\
-. ds b1
-. nr aP 0
-. nr iD 1
-. \\*(L\\n(lC
-. \}
-. if "\\*(L\\n(lC"iT" \{\
-. nr aP 0
-. nr iD 1
-. \\*(L\\n(lC
-. \}
-. if \\n(iD==0 \{\
-. fV
-.\" tm ------------------------------------------------------------------------
-.\" tm It list-type==\\*(L\\n(lC, aP==\\n(aP
-.\" tm It beg arg(A[1])==\\*(A1; oM==\\n(oM; dZ==\\n(dZ; Xt==\\n(Xt; aC==\\n(aC
-. nr oM \\n(oM+1
-. nr tP 1
-. nr aP \\n(aP+1
-. nr tX \\n(C\\n(aP
-. ds tX \\*(A\\n(aP
-. if \\n(nF==1 \{\
-. ds aA \\*(pA
-. if n .ds pA \\*(nO
-. \}
-. ie \\n(C\\n(aP==1 \{\
-. \\*(A\\n(aP
-. \}
-. el \{\
-. nr aP \\n(aP-1
-. No
-. \}
-.\" tm in It here is b1==\\*(b1
-.\" tm It mid arg(A[1])==\\*(A1; oM==\\n(oM; dZ==\\n(dZ; Xt==\\n(Xt; aC==\\n(aC
-. ie \\n(Xt==1 .ds xB \&\\*(L\\n(lC
-. el .\\*(L\\n(lC
-. \}
-. nr iD 0
-.\}
-.el .\\*(L\\n(lC
-..
-.\" NS lL macro - .It item of list-type inset
-.de lL
-.lY
-.br
-\&\\*(b1
-.nr oM \\n(oM-1
-.nr tP 0
-.ds b1
-.aY
-'fi
-..
-.\" NS hL macro - .It item of list-type hanging label (as opposed to tagged)
-.de hL
-.lX
-.nr bb \\n(w\\n(lCu+\\n(lSu
-.ti -\\n(bbu
-.ie \w\\*(b1u>=(\\n(w\\n(lCu) \&\\*(b1
-.el \&\\*(b1\h'|\\n(bbu'\c
-.nr oM \\n(oM-1
-.ds b1
-.nr tP 0
-.aY
-'fi
-..
-.\" NS oL macro - .It item of list-type overhanging label
-.de oL
-.lY
-\&\\*(b1
-.br
-.nr oM \\n(oM-1
-.ds b1
-.nr tP 0
-.aY
-'fi
-..
-.\" NS iT macro - .It item of list-type [empty label]
-.de iT
-.lY
-.br
-.\" .ds b1
-.aY
-'fi
-..
-.\" NS nU macro - Enumerated list
-.\" NS nU register count
-.\" NS hU macro - Hyphen paragraph list (sub bullet list)
-.\" NS bU macro - Bullet paragraph list
-.de nU
-.nr oM \\n(oM+1
-.nr nU \\n(nU+1
-.ds b1 \&\\n(nU.
-.uL
-..
-.de bU
-.nr oM \\n(oM+1
-.nr bU \\n(bU+1
-.ds b1 \&\\*(sY\&\(bu\fP
-.uL
-..
-.de hU
-.nr oM \\n(oM+1
-.nr bU \\n(bU+1
-.ds b1 \&\\*(sY\&\-\fP
-.uL
-..
-.\" NS uL macro - .It item of list-type enum/bullet/hyphen
-.de uL
-.lX
-.nr bb \\n(w\\n(lCu+\\n(lSu
-.ti -\\n(bbu
-.ie \w\\*(b1u>=(\\n(w\\n(lCu) \&\\*(b1
-.el \&\\*(b1\h'|\\n(bbu'\c
-.nr oM \\n(oM-1
-.\" .nr dZ \\n(dZ+1
-.ds b1
-.nr tP 0
-.aY
-'fi
-..
-.\" NS mL macro - .It item of list-type diagnostic-message
-.de mL
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ie \\n(mL==1 \{\
-. nr zB \\n(.c
-. ie (\\n(zB-\\n(zA)>1 .Pp
-. el .br
-. nr zA \\n(zB
-. nr zB 0
-.\}
-.el \{\
-. nr zA \\n(.c
-. br
-.\}
-\&\\*(sY\\*(b1\f\\n(cF\s\\n(cZ\\*(lS\c
-.aY
-.ds b1
-'fi
-..
-.\" NS tL macro - .It item of list-type "tag"
-.de tL
-.\" tm in tL here is b1==\\*(b1
-.if \\n(tW==0 .lW
-.lX
-.nr bb \\n(w\\n(lCu+\\n(lSu
-.ti -\\n(bbu
-.ie (\w\\*(b1u)>(\\n(w\\n(lCu) \{\&\\*(b1
-. br
-.\}
-.el \&\\*(b1\h'|\\n(bbu'\c
-.if \\n(nF==1 \{\
-. if n .ds pA \\*(aA
-.\}
-.nr oM \\n(oM-1
-.nr tP 0
-.\" .nr dZ \\n(dZ+1
-.ds b1
-.aY
-'fi
-..
-.\" NS lW macro - resolve unknown label/tag width (if .Bl [inset | tag] only)
-.de lW
-.if !"TagwidtH"\\*(t\\n(lC" \{\
-. ie \\n(tX==1 \{\
-. ds t\\n(lN \\*(tX
-. nr w\\n(lN \\n(\\*(tX
-. \}
-. el \{\
-. ds t\\n(lN No
-. nr w\\n(lN \\n(No
-. \}
-. if !"\\*(t\\n(lC"\\*(t\\n(lN" .nr tC 1
-.\}
-..
-.\" NS lX macro - set up vertical spacing (if compact) and offset+indent (all)
-.de lX
-.ie \\n(tC \{\
-. nr tC 0
-. nr tW 0
-. if \\n(v\\n(lC==0 .sp \\n(dVu
-. in \\n(.iu+\\n(w\\n(lCu+\\n(o\\n(lCu+\\n(lSu
-.\}
-.el \{\
-. ie \\n(v\\n(lC==1 \{\
-. nr aa 0
-. \}
-. el \{\
-. sp \\n(dVu
-. \}
-.\}
-.if !\\n(cR .ne 2v
-..
-.\" NS lY macro - set up vertical spacing (if compact) and offset+indent (all)
-.de lY
-.ie \\n(tC \{\
-. nr tC 0
-. nr tW 0
-. if \\n(v\\n(lC==0 .sp \\n(dVu
-. in \\n(.iu+\\n(o\\n(lCu
-.\}
-.el \{\
-. ie \\n(v\\n(lC==1 \{\
-. nr aa 0
-. \}
-. el \{\
-. sp \\n(dVu
-. \}
-.\}
-.if !\\n(cR .ne 2v
-..
-.\" NS tS temporary string
-.\" NS hL macro - hanging list function
-.\" NS tS temporary string
-.\" NS hL macro - hanging list function
-.\" NS lT macro - tagged list function
-.\" NS lE macro - list end function
-.\" NS tX string (initial string)
-.\" NS tX register (initial class)
-.\" NS tC parameter change flag
-.\" NS Xt save current list-type flag
-.\" NS lC register - list type stack counter
-.\" NS tP register tag flag (for diversions)
-.\" NS w[0-9] register tag stack (nested tags)
-.\" NS t[0-9] register tag string stack (nested tags)
-.\" NS o[0-9] register offset stack (nested tags)
-.\" NS v[0-9] register vertical tag break stack
-.\" NS h[0-9] register horizontal tag stack (continuous if 1, break if 0)
-.nr lC 0
-.nr wV 0
-.nr w1 0
-.nr o1 0
-.nr v1 0
-.nr h1 0
-.ds t\n(lC
-.de lE
-.\" IN lC o[\\n(lC]==\\n(o\\n(lC, w[\\n(lC]==\\n(w\\n(lC,
-.ie \\n(o\\n(lC>0 \{\
-' in \\n(.iu-(\\n(w\\n(lCu)-(\\n(o\\n(lCu)-\\n(lSu
-. rr o\\n(lC
-.\}
-.el 'in \\n(.iu-\\n(w\\n(lCu-\\n(lSu
-.if \\n(lC<=0 .tm Extraneous .El call (#\\n(.c)
-.tZ
-.nr lC \\n(lC-1
-.tY
-..
-.\" NS tY macro - set up next block for list
-.\" NS tZ macro - decrement stack
-.\" NS tY register (next possible lC value)
-.de tY
-.nr tY (\\n(lC+1)
-.nr w\\n(tY 0
-.nr h\\n(tY 0
-.nr o\\n(tY 0
-.ds t\\n(tY \\*(t\\n(lC
-.ds L\\n(tY
-.nr v\\n(tY 0
-..
-.de tZ
-.rm L\\n(tY
-.rr w\\n(tY
-.rr h\\n(tY
-.rr o\\n(tY
-.rm t\\n(tY
-.rr v\\n(tY
-.nr tY \\n(tY-1
-..
-.\" initial values
-.nr w1 0
-.nr o1 0
-.nr h1 0
-.ds t1
-.nr v1 0
-.nr tY 1
-.\" NS Xr macro - cross reference (man page only)
-.de Xr
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Xr manpage_name [section#] \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Xr
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 .tm Usage: .Xr manpage_name [section#] \\*(Pu (#\\n(.c)
-. el \{\
-. ie \\n(C\\n(aP>2 .y\\n(C\\n(aP
-. el \{\
-. as b1 \&\\*(xR\\*(A\\n(aP\fP\s0
-. if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. if \\n(C\\n(aP==2 \{\
-. as b1 \&(\\*(A\\n(aP)
-. nr aP \\n(aP+1
-. \}
-. if \\n(aC>=\\n(aP \{\
-. c\\n(C\\n(aP
-. \}
-. \}
-. \}
-. aZ
-. \}
-.\}
-..
-.\" NS Sx macro - cross section reference
-.de Sx
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Sx Usage: .Sx Section Header \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Sx
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. as b1 \\*(sX
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS cC macro - column-list end-list
-.\" NS eW macro - column indent width
-.\" NS cI register - column indent width
-.\" NS W[1-5] macro - establish tabs for list-type column
-.de cC
-'in \\n(.iu-\\n(o\\n(lCu-\\n(w\\n(lCu
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.fi
-.tZ
-.nr lC \\n(lC-1
-.tY
-..
-.de W1
-.ta \w\\*(A1 u
-.nr eW \w\\*(A1 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W2
-.ta \w\\*(A1 u +\w\\*(A2 u
-.nr eW \w\\*(A1 u+\w\\*(A2 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W3
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u
-.nr eW \w\\*(A1 u+\w\\*(A2 u+\w\\*(A3 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W4
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u
-.nr eW \w\\*(A1 u+\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u
-'in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.de W5
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u
-.nr eW \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u
-' in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.\" This is packed abnormally close, intercol width should be an option
-.de W6
-.ta \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u +\w\\*(A6
-.nr eW \w\\*(A1 u +\w\\*(A2 u +\w\\*(A3 u +\w\\*(A4 u +\w\\*(A5 u +\w\\*(A6
-' in \\n(.iu+\\n(eWu+\\n(o\\n(lCu
-..
-.\" NS cL macro - column items
-.de cL
-.if \\n(w\\n(lC==0 .nr w\\n(lC \\n(eWu
-.if \\n(.u==0 \{\
-. fi
-' in \\n(.iu+\\n(eWu
-.\}
-.ti -\\n(eWu
-.fV
-.nr aP \\n(aP+1
-.ie \\n(aC>=\\n(aP \{\
-. if "\\*(A\\n(aP"Ta" \{\
-. nr jJ \\n(aP-1
-. rm S\\n(jJ
-. rr jJ
-. \}
-. c\\n(C\\n(aP
-.\}
-.el .tm Usage: .It column_string [Ta [column_string ...] ] (#\\n(.c)
-..
-.\" NS Ta macro - append tab (\t)
-.de Ta
-.ie \\n(aC>0 \{\
-. nr aP \\n(aP+1
-. ie \\n(aC>=\\n(aP \{\
-. if "\\*(A\\n(aP"Ta" \{\
-. nr jJ \\n(aP-1
-. rm S\\n(jJ
-. rr jJ
-. \}
-. as b1 \\t
-. c\\n(C\\n(aP
-. \}
-. el \{\
-. as b1 \\t\\c
-. rm S\\n(aP
-. pB
-. aY
-.\" . ds b1
-. \}
-.\}
-.el \{\
-. tm Usage: Ta must follow column entry: e.g. (#\\n(.c)
-. tm .It column_string [Ta [column_string ...] ]
-.\}
-..
-.\"
-.\" NS Dl macro - display (one line) literal
-.de Dl
-'ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.in \\n(.iu+\\n(Dsu
-.ie \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. tm Usage: .Dl argument ... (#\\n(.c)
-. \}
-. el \{\
-. ds mN Dl
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. Li
-. \}
-.\}
-.el \{\
-. tm Usage: .Dl not callable by other macros (#\\n(.c)
-.\}
-.in \\n(.iu-\\n(Dsu
-..
-.\"
-.\" NS D1 macro - display (one line)
-.de D1
-'ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.in \\n(.iu+\\n(Dsu
-.ie \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-. tm Usage: .D1 argument ... (#\\n(.c)
-. \}
-. el \{\
-. ds mN D1
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 .\\*(A\\n(aP
-. el .No
-. \}
-.\}
-.el \{\
-. tm Usage: .D1 not callable by other macros (#\\n(.c)
-.\}
-.in \\n(.iu-\\n(Dsu
-..
-.\" NS Ex macro - DEFUNCT
-.de Ex
-.tm Ex defunct, Use .D1: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"
-.\" NS Ex macro - DEFUNCT
-.de Ex
-.tm Ex defunct, Use .D1: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"
-.\" NS Vt macro - Variable type (for forcing old style variable declarations)
-.\" this is not done in the same manner as .Ot for fortrash - clean up later
-.de Vt
-.\" if a function declaration was the last thing given, want vertical space
-.if \\n(fD>0 \{\
-. Pp
-. nr fD 0
-.\}
-.\" if a subroutine was the last thing given, want vertical space
-.if \\n(fZ>0 \{\
-. ie \\n(fX==0 \{\
-. Pp
-. rs
-. \}
-. el .br
-.\}
-.nr fX \\n(fX+1
-.nr cF \\n(.f
-.nr cZ \\n(.s
-\\*(fT\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ie \\n(oT==0 .br
-.el \&\ \&
-.ft \\n(cF
-.fs \\n(cZ
-..
-.\"
-.\" NS Ft macro - Function type
-.nr fZ 0
-.de Ft
-.if \\n(nS>0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fX 0
-. \}
-. nr fY 1
-.\}
-.nr cF \\n(.f
-.nr cZ \\n(.s
-\&\\*(fT\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ft \\n(cF
-.fs \\n(cZ
-.\" .br
-..
-.\"
-.\" NS Ot macro - Old Function type (fortran - no newline)
-.\" Ns oT register
-.nr oT 0
-.de Ot
-.nr oT 1
-.if \\n(nS>0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fD 0
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fX 0
-. \}
-. nr fY 1
-.\}
-.if \\n(.$==4 .as b1 \&\\*(fT\&\\$1 \\$2 \\$3 \\$4
-.if \\n(.$==3 .as b1 \&\\*(fT\&\\$1 \\$2 \\$3
-.if \\n(.$==2 .as b1 \&\\*(fT\&\\$1 \\$2
-.if \\n(.$==1 .as b1 \&\\*(fT\&\\$1
-.as b1 \&\ \fP
-..
-.\"
-.\" NS Fa macro - Function arguments
-.de Fa
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fa Function Arguments ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Fa
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.ie \\n(fC>0 \{\
-. fC
-.\}
-.el \{\
-. if \\n(aC>\\n(aP \{\
-. as b1 \\*(fA
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-. if \\n(nS>0 \{\
-. if \\n(fZ>0 .br
-. \}
-. \}
-.\}
-..
-.\" NS fC macro - interal .Fa for .FO and .Fc
-.de fC
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-.\" . nr aa \\n(aP
-.\" . if \\n(nS>0 \{\
-. ds Fb
-. nr fB 0
-. nr Fb 0
-. fB \\*(A\\n(aP
-. if \\n(fB>1 \{\
-. rm A\\n(aP
-. rn Fb A\\n(aP
-. \}
-.\" . \}
-. if \\n(fC>1 \{\
-. as b1 \&\f\\n(cF\s\\n(cZ\|,\\*(fA\\*(S\\n(aP\\*(A\\n(aP\fP\s0
-. \}
-. if \\n(fC==1 \{\
-. as b1 \&\|\\*(fA\\*(A\\n(aP\fP\s0
-. \}
-. nr fC \\n(fC+1
-. fC
-.\}
-.el \{\
-. aY
-.\}
-..
-.\" NS Fn macro - functions
-.\" NS fY register - dick with old style function declarations (fortran)
-.\" NS fZ register - break a line when more than one function in a synopsis
-.\"
-.de Fn
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fn function_name function_arg(s) ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN Fn
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(nS>0 \{\
-.\" if there is/has been more than one subroutine declaration
-. if \\n(fY==0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fX 0
-. nr fD 0
-. \}
-. \}
-. if \\n(fY==1 \{\
-. br
-. nr fX 0
-. nr fD 0
-. nr fY 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fD 0
-. \}
-. nr fZ \\n(fZ+1
-. nr fY 0
-. rs
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 \{\
-. nr iS ((8)*\\n(fW)u
-. \}
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. as b1 \\*(fN\\*(A\\n(aP\fP\s0\\*(lp
-. ie \\n(aC>\\n(aP \{\
-. as b1 \\*(fA
-. nr aP \\n(aP+1
-. f\\n(C\\n(aP
-. \}
-. el \{\
-. ie \\n(nS>0 .as b1 \|\\*(rp\fR;\fP
-. el .as b1 \|\\*(rp
-. aZ
-. \}
-. if \\n(nS>0 \{\
-. in -\\n(iSu
-. \}
-.\}
-..
-.\"
-.\" NS f1 macro - class switch
-.\" NS f2 macro - handle function arguments
-.\" NS f3 macro - punctuation
-.\" NS f4 macro - write out function
-.de f1
-.ie \\n(nS>0 .as b1 \\*(rp\fR;\fP\f\\n(cF\s\\n(cZ
-.el .as b1 \\*(rp\f\\n(cF\s\\n(cZ
-.\\*(A\\n(aP
-..
-.de f2
-.if \\n(nS>0 \{\
-. ds Fb
-. nr fB 0
-. nr Fb 0
-. fB \\*(A\\n(aP
-. if \\n(fB>1 \{\
-. rm A\\n(aP
-. rn Fb A\\n(aP
-. \}
-.\}
-.as b1 \\*(A\\n(aP
-.ie \\n(aC>\\n(aP \{\
-. nr aa \\n(aP
-. nr aP \\n(aP+1
-. if \\n(C\\n(aP==2 \{\
-. as b1 \&\|\f\\n(cF\s\\n(cZ,\\*(S\\n(aa\fP\s0\|
-. \}
-. f\\n(C\\n(aP
-.\}
-.el \{\
-. ie \\n(nS>0 .as b1 \\*(rp\fR;\fP\f\\n(cF\s\\n(cZ
-. el .as b1 \\*(rp\f\\n(cF\s\\n(cZ
-. aZ
-.\}
-..
-.de f3
-.ie \\n(nS>0 .as b1 \\*(rp\f\\n(cF\s\\n(cZ\\*(A\\n(aP
-.el .as b1 \\*(rp\f\\n(cF\s\\n(cZ\\*(A\\n(aP
-.ie \\n(aC>\\n(aP \{\
-. No
-.\}
-.el .aZ
-..
-.de f4
-.ie \\n(nS>0 .as b1 \\*(rp\fR;\fP\f\\n(cF\s\\n(cZ\\*(S\\n(aP\\*(A\\n(aP
-.el .as b1 \\*(rp\f\\n(cF\s\\n(cZ\\*(S\\n(aP\\*(A\\n(aP
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. No
-.\}
-.el .aZ
-..
-.de Fo
-.hy 0
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .Fo function_name
-. el \{\
-. ds mN Fo
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(nS>0 \{\
-.\" if there is/has been more than one subroutine declaration
-. if \\n(fY==0 \{\
-. if \\n(fZ>0 \{\
-. Pp
-. nr fX 0
-. nr fD 0
-. \}
-. \}
-. if \\n(fY==1 \{\
-. br
-. nr fX 0
-. nr fD 0
-. nr fY 0
-. \}
-. if \\n(fD>0 \{\
-. Pp
-. nr fX 0
-. \}
-. if \\n(fX>0 \{\
-. Pp
-. nr fD 0
-. \}
-. nr fZ \\n(fZ+1
-. nr fY 0
-. rs
-. ie \\n(nS>1 .br
-. el \{\
-. if \\n(iS==0 \{\
-. nr iS ((8)*\\n(fW)u
-. \}
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr oM \\n(oM+1
-. nr fC 1
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. as b1 \\*(fN\\*(A\\n(aP\fP\s0\\*(lp
-. aY
-.\}
-..
-.de Fc
-.if \\n(aC==0 \{\
-. if \\n(.$>0 \{\
-. ds mN Fo
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.nr fC 0
-.nr oM \\n(oM-1
-.ie \\n(nS>0 .as b1 \|\\*(rp\fR;\fP
-.el .as b1 \|\\*(rp
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. \\*(A\\n(aP
-.\}
-.el \{\
-. aZ
-.\}
-.if \\n(nS>0 \{\
-. in -\\n(iSu
-.\}
-.hy
-..
-.\" NS fb macro - if SYNOPSIS, set hard space inbetween function args
-.\" NS fb register - count of words in a function argument
-.\" NS Fb register - counter
-.\" NS Fb string - temporary string
-.de fB
-.\" .tm fB==\\n(fB, Fb==\\n(Fb, 1==\\$1 2==\\$2 3==\\$3 4==\\$4 5==\\$5 6==\\$6
-.if \\n(fB==0 \{\
-. nr fB \\n(.$
-. nr Fb 0
-. ds Fb
-.\}
-.nr Fb \\n(Fb+1
-.as Fb \&\\$1
-.if \\n(Fb<\\n(fB \{\
-. as Fb \&\\*(hV
-. fB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-..
-.\" NS Fc - Function close - not implemented yet
-.\" NS Fo - Function open - not implemented yet
-.\"
-.\" Very crude references, stash all reference info into strings (usual
-.\" use of b1 buffer, then b1 contents copied to string of retrievable
-.\" naming convention), print out reference on .Re request and clean up.
-.\" Ordering very limited, no fancy citations, but can do articles, journals
-.\" and books - need to add several missing options (like city etc).
-.\" should be able to grab a refer entry, massage it a wee bit (prefix
-.\" a `.' to the %[A-Z]) and not worry (ha!)
-.\"
-.\" NS Rs macro - Reference Start
-.\" NS rS register - Reference Start flag
-.\" NS rS string - Reference Start buffer name for next save (of b1 buffer)
-.de Rs
-.nr rS 1
-.rC
-.if \\n(nA==1 .Pp
-.nr Kl 0
-..
-.\" NS Re macro - Reference End
-.de Re
-.rZ
-.rC
-.nr rS 0
-..
-.\" NS rC macro - reference cleanup
-.de rC
-.nr uK 0
-.nr jK 0
-.nr iK 0
-.nr nK 0
-.nr oK 0
-.nr qK 0
-.nr rK 0
-.nr tK 0
-.nr vK 0
-.nr dK 0
-.nr pK 0
-.nr bK 0
-.ds rS
-.rm U1 U2 U3 U4 U5 U6 U7 U8
-.rm uK jK iK nK oK rK qK tK vK dK pK bK
-..
-.\" NS rZ macro - reference print
-.de rZ
-.if \\n(uK \{\&\\*(U1,
-. nr aK 1
-. if (\\n(uK>1 \{\
-. aK
-. \}
-. nr Kl -\\n(uK
-.\}
-.if \\n(tK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \{\
-. ie (\\n(jK==1):(\\n(bK==1) \{\&\\*q\\*(tK\\*q.
-. \}
-. el \{\&\\*(eM\\*(tK\\*(nO.
-. \}
-. \}
-. if \\n(Kl>0 \{\
-. ie (\\n(jK==1):(\\n(bK==1) \{\&\\*q\\*(tK\\*q,
-. \}
-. el \{\&\\*(eM\\*(tK\\*(nO,
-. \}
-. \}
-.\}
-.if \\n(bK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(eM\\*(bK\\*(nO.
-. if \\n(Kl>0 \&\\*(eM\\*(bK\\*(nO,
-.\}
-.if \\n(iK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(eM\\*(iK\\*(nO.
-. if \\n(Kl>0 \&\\*(eM\\*(iK\\*(nO,
-.\}
-.if \\n(jK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(eM\\*(jK\\*(nO.
-. if \\n(Kl>0 \&\\*(eM\\*(jK\\*(nO,
-.\}
-.if \\n(rK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(rK.
-. if \\n(Kl>0 \&\\*(rK,
-.\}
-.if \\n(nK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(nK.
-. if \\n(Kl>0 \&\\*(nK,
-.\}
-.if \\n(vK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(vK.
-. if \\n(Kl>0 \&\\*(vK,
-.\}
-.if \\n(pK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(pK.
-. if \\n(Kl>0 \&\\*(pK,
-.\}
-.if \\n(qK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(qK.
-. if \\n(Kl>0 \&\\*(qK,
-.\}
-.if \\n(dK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(dK.
-. if \\n(Kl>0 \&\\*(dK,
-.\}
-.if \\n(oK \{\
-. nr Kl \\n(Kl-1
-. if \\n(Kl==0 \&\\*(oK.
-. if \\n(Kl>0 \&\\*(oK,
-.\}
-.if \\n(Kl>0 .tm unresolved reference problem
-..
-.\" NS aK macro - print out reference authors
-.de aK
-.nr aK \\n(aK+1
-.ie (\\n(uK-\\n(aK)==0 \{\&and \\*(U\\n(aK,
-.\}
-.el \{\&\\*(U\\n(aK,
-. aK
-.\}
-..
-.\" NS %A macro - reference author(s)
-.\" NS uK register - reference author(s) counter
-.\" NS U[1-9] strings - reference author(s) names
-.de %A
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%A Author_name (#\\n(.c)
-. el \{\
-. nr uK \\n(uK+1
-. nr Kl \\n(Kl+1
-. ds rS U\\n(uK
-. ds mN %A
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %B macro - [reference] Book Name
-.\" NS bK string - Book Name
-.\" NS bK register - Book Name flag
-.de %B
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%B Book Name (#\\n(.c)
-. el \{\
-. ds mN %B
-. if \\n(rS>0 \{\
-. nr bK \\n(bK+1
-. nr Kl \\n(Kl+1
-. ds rS bK
-. \}
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie \\n(rS==0 \{\
-. as b1 \&\\*(eM
-. nR
-. \}
-. el .rR
-.\}
-..
-.\" NS %D macro - [reference] Date
-.\" NS dK string - Date String
-.\" NS dK register - Date flag
-.de %D
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%D Date (#\\n(.c)
-. el \{\
-. ds mN %D
-. nr dK \\n(dK+1
-. nr Kl \\n(Kl+1
-. ds rS dK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %I macro - [reference] Issuer/Publisher Name
-.\" NS jK register - [reference] Issuer/Publisher Name flag
-.\" NS jK string - [reference] Issuer/Publisher Name
-.de %I
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%I Issuer/Publisher Name (#\\n(.c)
-. el \{\
-. ds mN %I
-. nr iK \\n(iK+1
-. ds rS iK
-. nr Kl \\n(Kl+1
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %J macro - [reference] Journal Name
-.\" NS jK register - [reference] Journal Name flag
-.\" NS jK string - [reference] Journal Name
-.de %J
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%J Journal Name (#\\n(.c)
-. el \{\
-. ds mN %J
-. nr jK \\n(jK+1
-. ds rS jK
-. nr Kl \\n(Kl+1
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %N macro - [reference] issue number
-.\" NS nK register - [reference] issue number flag
-.\" NS nK string - [reference] issue number
-.de %N
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%N issue number (#\\n(.c)
-. el \{\
-. nr nK \\n(nK+1
-. nr Kl \\n(Kl+1
-. ds rS nK
-. ds mN %N
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %O macro - [reference] optional information
-.\" NS oK register - [reference] optional information flag
-.\" NS oK string - [reference] optional information
-.de %O
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%O optional information ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN %O
-. nr oK \\n(oK+1
-. nr Kl \\n(Kl+1
-. ds rS oK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %P macro - [reference] page numbers
-.\" NS pK register - [reference] page number flag
-.\" NS pK string - [reference] page number
-.de %P
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%P page numbers ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN %P
-. nr pK \\n(pK+1
-. nr Kl \\n(Kl+1
-. ds rS pK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %Q macro - Corporate or Foreign Author
-.\" NS qK string - Corporate or Foreign Author
-.\" NS qK register - Corporate or Foreign Author flag
-.de %Q
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%Q Corporate or Foreign Author (#\\n(.c)
-. el \{\
-. ds mN %Q
-. nr qK \\n(qK+1
-. nr Kl \\n(Kl+1
-. ds rS qK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %R macro - [reference] report name
-.\" NS rK string - [reference] report name
-.\" NS rK register - [reference] report flag
-.de %R
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%R reference report (#\\n(.c)
-. el \{\
-. ds mN %R
-. nr rK \\n(rK+1
-. nr Kl \\n(Kl+1
-. ds rS rK
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS %T macro - reference title
-.\" NS tK string - reference title
-.\" NS tK register - reference title flag
-.de %T
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%T (#\\n(.c)
-. el \{\
-. ds mN %T
-. if \\n(rS>0 \{\
-. nr tK \\n(tK+1
-. nr Kl \\n(Kl+1
-. ds rS tK
-. \}
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-.\" . ie \\n(jS==1 \{\
-.\" . nr cF \\n(.f
-.\" . nr cZ \\n(.s
-.\" . ds qL \&\\*(Lq\\*(rA
-.\" . ds qR \&\\*(Rq\f\\n(cF\s\\n(cZ
-.\" . En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\" . \}
-.\" . el \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ie \\n(rS==0 \{\
-. as b1 \&\\*(eM
-. nR
-. \}
-. el .rR
-.\" . \}
-.\}
-..
-.\" NS %V macro - reference volume
-.\" NS vK string - reference volume
-.\" NS vK register - reference volume flag
-.de %V
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .%V Volume , ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN %V
-. nr vK \\n(vK+1
-. nr Kl \\n(Kl+1
-. ds rS vK
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. rR
-.\}
-..
-.\" NS rR macro - reference recursion routine
-.\" NS jM local register
-.\" NS jN local register
-.de rR
-.hy 0
-.nr jM \\n(C\\n(aP
-.ie \\n(jM==1 \{\
-.\" . as b1 \&\f\\n(cF\s\\n(cZ
-. ie "\\*(A\\n(aP"Tn" \{\
-. nN
-. \}
-. el \{\
-. if \\n(aC>8 .tm Usage: \\*(mN - maximum 8 arguments (#\\n(.c)
-. aI rR 1
-. \\*(A\\n(aP
-. \}
-.\}
-.el \{\
-. nr jN \\n(aP
-. ie \\n(jM==2 .as b1 \&\\*(A\\n(aP
-. el .as b1 \&\\*(A\\n(aP
-.\" . el .as b1 \&\f\\n(cF\s\\n(cZ\\*(A\\n(aP\fP\s0
-. ie \\n(aC==\\n(aP \{\
-.\" . as b1 \&\f\\n(cF\s\\n(cZ
-. rD
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. as b1 \&\\*(S\\n(jN
-. rR
-. \}
-.\}
-.rr jM jN
-..
-.\" NS rD macro - save b1 buffer in to appropriate name
-.de rD
-.as \\*(rS \\*(b1
-.ds b1
-.ds rS
-.aY
-..
-.\" NS Hf macro - source include header files.
-.de Hf
-.Pp
-File:
-.Pa \\$1
-.Pp
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ie t \{\
-\&\\*(lI
-.br
-.ta +9n 18n 27n 36n 45n 54n 63n 72n
-.\}
-.el \{\
-.ta +8n 16n 24n 32n 40n 48n 56n 64n 72n
-.\}
-.nf
-.so \\$1
-.fi
-.ft \\n(cF
-.fz \\n(cZ
-.Pp
-..
-.\" NS An macro - author name
-.\" NS aN register
-.nr aN 0
-.de An
-.if \\n(nY==1 \{\
-. ie \\n(aN==1 \{\
-. br
-. \}
-. el \{\
-. nr aN 1
-. \}
-.\}
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 .tm Usage: .An author_name ... \\*(Pu (#\\n(.c)
-. el \{\
-. ds mN An
-. aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. nR
-.\}
-..
-.\" NS Sf macro -defunct
-.de Sf
-.tm .Sf defunct, use prefix or Ns
-..
-.ds rV "function returns the value 0 if successful; otherwise the value -1 is returned and the global variable \\*(vAerrno\fP is set to indicate the error.
-.\" Ns Rv macro - return values
-.\" Ns rV string - standard return message
-.de Rv
-.ie \\n(.$==0 \{\
-.tm Usage: .Rv [-std] (#\\n(.c)
-.\}
-.el \{\
-. ds mN Rv
-.\" . nr aP 0
-.\" . nr lR \\n(lR+1
-.\" . ds A1 \\$2
-.\" . ds A2 \\$3
-.\" . ds A3 \\$4
-.\" . ds A4 \\$5
-.\" . ds A5 \\$6
-.\" . ds A6 \\$7
-.\" . ds A7 \\$8
-.\" . ds A8 \\$9
-.\" . nr fV \\n(.$-1
-. if "\\$1"-std" \{\
-. nr cH \\*(cH
-. if (\\n(cH<2):(\\n(cH>3) .tm Usage: .Rv -std sections 2 and 3 only
-. br
-\&The
-.Fn \\$2
-\&\\*(rV
-. \}
-.\}
-..
diff --git a/share/tmac/doc-common b/share/tmac/doc-common
deleted file mode 100644
index a8aef9e..0000000
--- a/share/tmac/doc-common
+++ /dev/null
@@ -1,432 +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.
-.\"
-.\" @(#)doc-common 8.1 (Berkeley) 6/8/93
-.\"
-.\" %beginstrip%
-.nr %A 1
-.nr %J 1
-.nr %N 1
-.nr %O 1
-.nr %R 1
-.nr %T 1
-.nr %V 1
-.nr Ad 12n
-.nr Ac 3
-.nr Ao 12n
-.nr An 12n
-.nr Aq 12n
-.nr Ar 12n
-.nr Bc 3
-.nr Bl 1
-.nr Bo 12n
-.nr Bq 12n
-.nr Cd 12n
-.nr Cm 10n
-.nr Dc 3
-.nr Do 10n
-.nr Dq 12n
-.nr Ds 6n
-.nr Dq 12n
-.nr Dv 12n
-.nr Ec 3
-.nr El 1
-.nr Eo 12n
-.nr Eq 12n
-.nr Em 10n
-.nr Er 12n
-.nr Ev 15n
-.nr Fa 12n
-.nr Fl 10n
-.nr Fc 3
-.nr Fo 16n
-.nr Fn 16n
-.nr I1 6n
-.nr I2 12n
-.nr I3 18n
-.nr Ic 10n
-.nr Li 16n
-.nr Ms 6n
-.nr Nm 10n
-.nr No 12n
-.nr Ns 2
-.nr Oo 10n
-.nr Oc 3
-.nr Op 14n
-.nr Pa 32n
-.nr Pf 12n
-.nr Pc 3
-.nr Po 12n
-.nr Pq 12n
-.nr Ql 16n
-.nr Sc 3
-.nr So 12n
-.nr Sq 12n
-.nr Sy 6n
-.nr Sx 16n
-.nr Rv 1
-.nr Tn 10n
-.nr Ta 1
-.nr Tv 1
-.nr Tx 22n
-.nr Va 12n
-.nr Xc 3
-.nr Xo 1
-.nr Xr 10n
-.ds sV \& \&
-.ds hV \&\ \&
-.ds iV \& \&
-.ds tV \&\\t\&
-.\" Punctuation values (3 = closing punctuation, 4 = opening)
-.nr z. 3
-.nr z, 3
-.nr z: 3
-.nr z; 3
-.nr z( 4
-.nr z) 3
-.nr z[ 4
-.nr z] 3
-.\" Matching pairs
-.ds z( z)
-.ds z[ z]
-.ds z< z>
-.\" This is disgusting, troff not parse ``if'' stmt properly
-.nr z0 0
-.nr z1 0
-.nr z2 0
-.nr z3 0
-.nr z4 0
-.nr z5 0
-.nr z6 0
-.nr z7 0
-.nr z8 0
-.nr z9 0
-.nr z# 0
-.\" Header assembly macros
-.de Dt
-.ds dT UNTITLED
-.ds vT LOCAL
-.ds cH Null
-.if !"\\$1"" .ds dT \\$1
-.if !"\\$2"" \{\
-. ds cH \\$2
-.\" . if "\\$3"" \{\
-. if \\$2>=1 .if \\$2<=8 \{\
-. ds vT BSD Reference Manual
-. if \\$2>1 .if \\$2<6 .ds vT BSD Programmer's Manual
-. if "\\$2"8" .ds vT BSD System Manager's Manual
-. nr sN \\$2
-. \}
-. if "\\$2"unass" .ds vT DRAFT
-. if "\\$2"draft" .ds vT DRAFT
-. if "\\$2"paper" .ds vT UNTITLED
-.\" . \}
-.\}
-.if !"\\$3"" \{\
-. if "\\$3"USD" .ds vT BSD User's Supplementary Documents
-. if "\\$3"PS1" .ds vT BSD Programmers's Supplementary Documents
-. if "\\$3"AMD" .ds vT BSD Ancestral Manual Documents
-. if "\\$3"SMM" .ds vT BSD System Manager's Manual
-. if "\\$3"URM" .ds vT BSD Reference Manual
-. if "\\$3"PRM" .ds vT BSD Programmers's Manual
-. if "\\$3"IND" .ds vT BSD Manual Master Index
-.\" . if "\\$3"CON" .ds vT BSD Contributed Software Manual
-.\" . if "\\$3"IMP" .ds vT BSD Implementation Notes
-.\" . if "\\$3"HOW" .ds vT BSD How Pocket Manual
-. if "\\$3"LOCAL" .ds vT BSD Local Manual
-. if "\\$3"tahoe" .as vT \ (Tahoe Architecture)
-. if "\\$3"vax" .as vT \ (VAX Architecture)
-. if "\\$3"hp300" .as vT \ (HP300 Architecture)
-. if "\\$3"sparc" .as vT \ (SPARC Architecture)
-. if "\\*(vT"LOCAL" .ds vT \\$3
-.\}
-..
-.\" NS Os macro - Operating System (behaviour changes after first call)
-.\" . ds vT \f(CODRAFT\fP\ \ \-\-\ \ \\*(vT\ \ \-\-\ \ \f(CODRAFT
-.\" . ds dD \f(CODRAFT\fP\ \ \-\-\ \ \\*(dD\ \ \-\-\ \ \f(CODRAFT
-.\" .ds vT \s+4\f(CODRAFT\fP\s-4\ \ \-\-\ \ \\*(vT\ \ \-\-\ \ \s+4\f(CODRAFT\s-4
-.\" .ds dD \s+4\f(CODRAFT\fP\s-4\ \ \-\-\ \ \\*(dD\ \ \-\-\ \ \s+4\f(CODRAFT\s-4
-.de Os
-.ds oS Null
-.if "\\$1"" \{\
-. ds oS 4.4BSD
-.\}
-.if "\\$2"" \{\
-. ds aa Non-Null
-.\}
-.if "\\$1"ATT" \{\
-. ds oS AT&T
-. if "\\$2"" .as oS \0UNIX
-. if "\\$2"7th" .as oS \07th Edition
-. if "\\$2"7" .as oS \07th Edition
-. if "\\$2"III" .as oS \0System III
-. if "\\$2"3" .as oS \0System III
-. if "\\$2"V" .as oS \0System V
-. if "\\$2"V.2" .as oS \0System V Release 2
-. if "\\$2"V.3" .as oS \0System V Release 3
-. if "\\$2"V.4" .as oS \0System V Release 4
-.\}
-.if "\\$1"BSD" \{\
-. if "\\$2"3" .ds oS 3rd Berkeley Distribution
-. if "\\$2"4" .ds oS 4th Berkeley Distribution
-. if "\\$2"4.1" .ds oS 4.1 Berkeley Distribution
-. if "\\$2"4.2" .ds oS 4.2 Berkeley Distribution
-. if "\\$2"4.3" .ds oS 4.3 Berkeley Distribution
-. if "\\$2"4.3T" .ds oS 4.3-Tahoe Berkeley Distribution
-. if "\\$2"4.3R" .ds oS 4.3-Reno Berkeley Distribution
-. if "\\$2"4.3t" .ds oS 4.3-Tahoe Berkeley Distribution
-. if "\\$2"4.3r" .ds oS 4.3-Reno Berkeley Distribution
-. if "\\$2"4.4" .ds oS 4.4BSD
-.\}
-.if "\\*(oS"Null" .ds oS \0\\$1
-.if "\\*(aa"Non-Null" .as oS \0\\$2
-.rm aa
-..
-.de Dd
-.if !"\\*(dD"" .nr gX 1
-.ie \\n(.$>0 \{\
-. ie \\n(.$==3 \{\
-. ds dD \\$1 \\$2 \\$3
-. \}
-. el \{\
-. if "\\n(mo"1" .ds dD January
-. if "\\n(mo"2" .ds dD February
-. if "\\n(mo"3" .ds dD March
-. if "\\n(mo"4" .ds dD April
-. if "\\n(mo"5" .ds dD May
-. if "\\n(mo"6" .ds dD June
-. if "\\n(mo"7" .ds dD July
-. if "\\n(mo"8" .ds dD August
-. if "\\n(mo"9" .ds dD September
-. if "\\n(mo"10" .ds dD October
-. if "\\n(mo"11" .ds dD November
-. if "\\n(mo"12" .ds dD December
-. as dD \&\ \\n(dy, 19\\n(yr
-. \}
-.\}
-.el \{\
-. ds dD Epoch
-.\}
-..
-.de hM
-.ev 1
-.pL
-.if !\\n(cR 'sp \\n(Hmu
-.tl @\\*(Hs\\*(hT\fP@\\*(Vs\\*(vT\fP@\\*(Hs\\*(hT\fP@
-'sp \\n(Hmu
-.ev
-..
-.de fM
-.ie \\n(cR 'br
-.el \{\
-. ev 1
-. pL
-. if !\\n(cR \{\
-' sp \\n(Fmu
-. tl @\\*(Hs\\*(oS\fP@\\*(Vs\\*(dD\fP@%@
-' bp
-. \}
-. ev
-.\}
-..
-.de lM
-.fl
-.if \\n(cR \{\
-' sp
-. tl @\\*(Hs\\*(oS\fP@\\*(Vs\\*(dD\fP@%@
-. pl \\n(nlu
-.\}
-..
-.de Pp
-.sp \\n(Ppu
-.ne 2
-.ns
-..
-.de Lp
-.Pp
-..
-.de LP
-.tm Not a \-mdoc command: .LP
-..
-.de PP
-.tm Not a \-mdoc command: .PP
-..
-.de pp
-.tm Not a \-mdoc command: .pp
-..
-.de Nd
-\&\-\& \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.de Ss
-.sp
-.ne 2
-.ti -.25i
-\&\\*(sH\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9
-\&\fP\s0
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.if !\\n(cR .ne 2
-.br
-..
-.de Rd
-.tm MDOC REGISTER DUMP
-.tm Db==\\n(Db register DEBUG MODE
-.tm L[0-9] registers - stack of list types
-.tm L0==\\n(L0
-.tm L1==\\n(L1
-.tm L2==\\n(L2
-.tm L3==\\n(L3
-.tm L4==\\n(L4
-.tm L5==\\n(L5
-.tm L6==\\n(L6
-.tm L7==\\n(L7
-.tm L8==\\n(L8
-.tm L9==\\n(L9
-.tm O[0-9] registers - stack of indent
-.tm O0==\\n(O0
-.tm O1==\\n(O1
-.tm O2==\\n(O2
-.tm O3==\\n(O3
-.tm O4==\\n(O4
-.tm O5==\\n(O5
-.tm O6==\\n(O6
-.tm O7==\\n(O7
-.tm O8==\\n(O8
-.tm O9==\\n(O9
-.tm aC==\\n(aC register argument counter (aV/fV)
-.tm aJ==\\n(aJ register (for vR)
-.tm aN==\\n(aN register
-.tm aP==\\n(aP register argument pointer (aV)
-.tm aT==\\n(aT register argument type
-.tm aa==\\n(aa local register
-.tm bK==\\n(bK register - Book Name flag
-.tm cF==\\n(cF register save current font
-.tm cI==\\n(cI register - column indent width
-.tm cZ==\\n(cZ register save current font size
-.tm dK==\\n(dK register - Date flag
-.tm d[0-9] registers - display-type stack
-.tm d0==\\n(d0
-.tm d1==\\n(d1
-.tm d2==\\n(d2
-.tm d3==\\n(d3
-.tm d4==\\n(d4
-.tm d5==\\n(d5
-.tm d6==\\n(d6
-.tm d7==\\n(d7
-.tm d8==\\n(d8
-.tm d9==\\n(d9
-.tm dZ==\\n(dZ register diversion count
-.tm fD==\\n(fD register subroutine test (in synopsis only)
-.tm fV==\\n(fV register argument counter (must set to \\n(.$ prior to
-.tm fY==\\n(fY register - dick with old style function declarations (fortran)
-.tm fZ==\\n(fZ register also subroutine count (in synopsis only)
-.tm h[0-9] register horizontal tag stack (continuous if 1, break if
-.tm h0==\\n(h0
-.tm h1==\\n(h1
-.tm h2==\\n(h2
-.tm h3==\\n(h3
-.tm h4==\\n(h4
-.tm h5==\\n(h5
-.tm h6==\\n(h6
-.tm h7==\\n(h7
-.tm h8==\\n(h8
-.tm h9==\\n(h9
-.tm iD==\\n(iD local register
-.tm iI==\\n(iI local register (indent for inline debug mode)
-.tm iN==\\n(iN register DEBUG MODE (inline if 1, to stderr if
-.tm iS==\\n(iS register - indent second command line in a synopsis
-.tm jK==\\n(jK register - [reference] Journal Name flag
-.tm jM==\\n(jM local register
-.tm jN==\\n(jN local register
-.tm lC==\\n(lC register - list type stack counter
-.tm lK==\\n(lK register count of lines read from input file
-.tm nK==\\n(nK register - [reference] issue number flag
-.tm nU==\\n(nU register count
-.tm oK==\\n(oK register - [reference] optional information flag
-.tm oM==\\n(oM register (extension possible)
-.tm o[0-9] register offset stack (nested tags)
-.tm o0==\\n(o0
-.tm o1==\\n(o1
-.tm o2==\\n(o2
-.tm o3==\\n(o3
-.tm o4==\\n(o4
-.tm o5==\\n(o5
-.tm o6==\\n(o6
-.tm o7==\\n(o7
-.tm o8==\\n(o8
-.tm o9==\\n(o9
-.tm oM==\\n(oM register open ended line flag
-.tm pK==\\n(pK register - [reference] page number flag
-.tm qK==\\n(qK register - Corporate or Foreign Author flag
-.tm rK==\\n(rK register - [reference] report flag
-.tm rS==\\n(rS register - Reference Start flag
-.tm sM==\\n(sM register - default is one (space mode on)
-.tm tK==\\n(tK register - reference title flag
-.tm tP==\\n(tP register tag flag (for diversions)
-.tm tX==\\n(tX register (initial class)
-.tm tY==\\n(tY register (next possible lC value)
-.tm t[0-9] register tag string stack (nested tags)
-.tm t0==\\n(t0
-.tm t1==\\n(t1
-.tm t2==\\n(t2
-.tm t3==\\n(t3
-.tm t4==\\n(t4
-.tm t5==\\n(t5
-.tm t6==\\n(t6
-.tm t7==\\n(t7
-.tm t8==\\n(t8
-.tm t9==\\n(t9
-.tm uK==\\n(uK register - reference author(s) counter
-.tm vK==\\n(vK register - reference volume flag
-.tm v[0-9] register vertical tag break stack
-.tm v0==\\n(v0
-.tm v1==\\n(v1
-.tm v2==\\n(v2
-.tm v3==\\n(v3
-.tm v4==\\n(v4
-.tm v5==\\n(v5
-.tm v6==\\n(v6
-.tm v7==\\n(v7
-.tm v8==\\n(v8
-.tm v9==\\n(v9
-.tm w[0-9] register tag stack (nested tags)
-.tm w0==\\n(w0
-.tm w1==\\n(w1
-.tm w2==\\n(w2
-.tm w3==\\n(w3
-.tm w4==\\n(w4
-.tm w5==\\n(w5
-.tm w6==\\n(w6
-.tm w7==\\n(w7
-.tm w8==\\n(w8
-.tm w9==\\n(w9
-.tm xX==\\n(xX local register
-.tm END OF REGISTER DUMP
-..
diff --git a/share/tmac/doc-ditroff b/share/tmac/doc-ditroff
deleted file mode 100644
index 08b413e..0000000
--- a/share/tmac/doc-ditroff
+++ /dev/null
@@ -1,269 +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.
-.\"
-.\" @(#)doc-ditroff 8.1 (Berkeley) 6/8/93
-.\"
-.\" tmac.mdoc-ditroff
-.\" %beginstrip%
-.\"
-.ds aD \fI\s10
-.ds aR \f(CO\s10
-.ds cM \f(CB\s10
-.ds dF \fR\s10
-.ds eM \fI\s10
-.ds eR \fC\s10
-.ds eV \fC\s10
-.ds fA \f(CO\s10
-.ds fD \f(CB\s10
-.ds fL \f(CB\s10
-.ds fN \f(CB\s10
-.ds fP \fP\s0
-.ds fS \s0
-.ds fT \f(CO\s10
-.ds Hs \fR\s10
-.ds iC \f(CB\s10
-.ds lI \fC
-.ds lP \fR\|(\|\fP\s10
-.ds lp \fR(\fP\s10
-.ds rP \fR\|)\|\fP\s10
-.ds rp \fR)\fP\s10
-.ds lB \fR\^[\^\fP\s10
-.ds rB \fR\^]\fP\s10
-.ds mL \fB\s10
-.ds nM \f(CB\s10
-.ds nO \fR\s10
-.ds nT \s0
-.ds pA \fC\s10
-.ds Pu \fR{\ .\ ,\ :\ ;\ (\ )\ [\ ]\ \fR}
-.ds rA \fR\s10
-.ds rT \f(CO\s10
-.ds sH \fB\s10
-.ds sP \s0
-.ds sY \fB\s10
-.ds sX \fR\s10
-.ds tF \fR
-.ds tN \s9
-.ds vA \fI\s10
-.ds Vs \fR\s10
-.ds vT \f(CB\s10
-.ds xR \fC\s10
-.tr *\(**
-.nr sI \w\fC,u*5
-.nr Ti \n(sIu
-.nr Pp .5v
-.ds lS \0
-.nr lS \w'\0'u
-.nr dI 6n
-.de pL
-.nr Hm .5i
-.nr Fm .5i
-.nr ll 6.5i
-.ll 6.5i
-.nr lt 6.5i
-.lt 6.5i
-.nr po 1i
-.po 1.i
-.nr dV .5v
-..
-.ds <= \(<=
-.ds >= \(>=
-.ds Lq \&``
-.ds Rq \&''
-.ds ua \(ua
-.ds aa \(aa
-.ds ga \(ga
-.ds sR \&'
-.ds sL \&`
-.ds q \&"
-.\" Math stuff
-.ds Pi \(*p
-.ds Ne \(!=
-.ds Le \(<=
-.ds Ge \(>=
-.ds Lt <
-.ds Gt >
-.ds Pm \(+-
-.ds If \(if
-.ds Na \fINaN\fP
-.ds Ba \fR\&|\fP
-.\"
-.nr gX 0
-.de hK
-.ds hT \\*(dT
-.if !"\\*(cH"Null" \{\
-. ie !"\\*(gP"Null" .as hT \|(\|\\*(cH\\*(gP\|)
-. el .as hT \\|(\\|\\*(cH\\|)
-.\}
-.if "\\*(cH"Null" \{\
-. if !"\\*(gP"Null" .as hT \&\|(\|\\*(gP\|)
-.\}
-.wh 0 hM
-.wh -1.25i fM
-.\" .tm Here is gX == \\n(gX
-.ie \\n(gX==1 \{\
-. rm n1
-. if \\n(.g .br
-. if !\\n(.g .bp
-.\}
-.el \{\
-. if \\n(.g .br
-. if !\\n(.g 'bp
-.\}
-.nr % 1
-.nr gX 0
-.em lM
-..
-.\"
-.nr fW \w\fC0
-.de sW
-.nr sW \w\fC\\$1
-.ie \\n(sW>=\\n(fW \{\
-. ie \\n(sW%\\n(fW .nr sW (\\n(sW/\\n(fW)+1
-. el .nr sW \\n(sW/\\n(fW
-.\}
-.el \{\
-. ie \\n(sW>0 .nr sW 1
-. el .nr sW 0
-.\}
-..
-.\"
-.de aW
-.nr sW \w\fC\\*(A\\$1
-.ie \\n(sW>=\\n(fW \{\
-. ie \\n(sW%\\n(fW .nr sW (\\n(sW/\\n(fW)+1
-. el .nr sW \\n(sW/\\n(fW
-.\}
-.el \{\
-. ie \\n(sW>0 .nr sW 1
-. el .nr sW 0
-.\}
-..
-.\" NS Ql macro - Quoted literal define
-.de Ql
-.if \\n(aC==0 \{\
-. ds mN Ql
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. nr fV \\n(.$
-. fV
-.\}
-.nr aP \\n(aP+1
-.aW \\n(aP
-.nr aP \\n(aP-1
-.if \\n(sW>2 .Li
-.if \\n(sW<=2 \{\
-.\" Db on
-. if (\\n(aP>0) \{\
-. ds A\\n(aP Li
-. nr aP \\n(aP -1
-. \}
-. if (\\n(aP==0) \{\
-. rm C0 C1 C2 C3 C4 C5 C6 C7 C8 C9
-. rm S1 S2 S3 S4 S5 S6 S7 S8 S9
-. rn A8 A9
-. rn A7 A8
-. rn A6 A7
-. rn A5 A6
-. rn A4 A5
-. rn A3 A4
-. rn A2 A3
-. rn A1 A2
-. ds A1 Li
-. nr fV \\n(aC+1
-. nr aC 0
-. fV
-. \}
-. ds qL \&\\*(sL
-. ds qR \&\\*(sR
-. En
-.\" Db off
-.\}
-..
-.\" NS Sh macro - Section Headers
-.\" NS nS register - Section Header SYNOPSIS flag
-.\" NS nF register - Section Header FILES flag
-.\" NS nA register - Section Header SEE ALSO flag
-.\" NS nT register - Section Header STANDARDS flag
-.de Sh
-.nr nS 0
-.nr sE 0
-.nr iS 0
-'ad
-.ie "\\$1"NAME" \{\
-. hK
-' in 0
-.\}
-.el \{\
-. nr nS 0
-. nr nA 0
-. nr nF 0
-. nr nT 0
-. nr nY 0
-. nr oT 0
-. if "\\$1"SYNOPSIS" \{\
-. na
-. nr nS 1
-. \}
-. if "\\$1"DESCRIPTION" \{\
-. nr fY 0
-. nr fZ 0
-. nr fB 0
-. nr Fb 0
-. ds Fb
-. \}
-. if "\\$1"SEE" \{\
-. nr nA 1
-. na
-. \}
-. if "\\$1"FILES" .nr nF 1
-. if "\\$1"STANDARDS" .nr nT 1
-. if "\\$1"AUTHORS" .nr nY 1
-. if "\\$1"SEE" .nr sE 1
-. in 0
-. nr aN 0
-.\}
-.pL
-'sp
-.ns
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.if !\\n(cR .ne 3
-'fi
-\&\\*(sH\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9
-\&\fP\s0\&
-.in \\n(.iu+\\n(Tiu
-.ns
-..
diff --git a/share/tmac/doc-nroff b/share/tmac/doc-nroff
deleted file mode 100644
index 2bb9531..0000000
--- a/share/tmac/doc-nroff
+++ /dev/null
@@ -1,225 +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.
-.\"
-.\" @(#)doc-nroff 8.1 (Berkeley) 6/8/93
-.\"
-.\" tmac.mdoc-nroff
-.\" %beginstrip%
-.\"
-.ds aD \fI
-.ds aR \fI
-.ds cM \fB
-.ds dF \fR
-.ds eM \fI
-.ds eR \fR
-.ds eV \fR
-.ds fA \fI
-.ds fD \fB
-.ds fL \fB
-.ds fN \fB
-.ds fP \fP
-.ds fS
-.ds fT \fI
-.ds Hs \fR
-.ds iC \fB
-.ds lI \fR
-.ds lP \fR\|(\fP
-.ds rP \fR\|)\fP
-.ds lp \fR\|(\fP
-.ds rp \fR\|)\fP
-.ds lB \fR\|[\|\fP
-.ds rB \fR\|]\fP
-.ds mL \fB
-.ds nM \fB
-.ds nO \fR
-.ds pA \fI
-.ds Pu {\ .\ ,\ ;\ :\ (\ )\ [\ ]}
-.ds rA \fR
-.ds rT \fI
-.ds sH \fB
-.ds sP
-.ds sY \fB
-.ds sX \fI
-.ds tF \fR
-.ds tN
-.ds vA \fI
-.ds Vs \fR
-.ds vT \fB
-.ds xR \fR
-.\" MISCELLANEOUS
-.nr sI .5i
-.nr Ti .5i
-.nr cR 1
-.nr Pp 1v
-.ds lS \0\0
-.nr lS \w'\0\0'u
-.nr dI 6n
-.\"
-.de pL
-.ie \\n(cR .nr Hm 0
-.el .nr Hm .5i
-.nr Fm .5i
-.nr ll 78n
-.ll 78n
-.nr lt 78n
-.lt 78n
-.nr po 0i
-.po 0i
-.nr dV 1v
-.ad l
-.na
-..
-.ds <= \&<\&=
-.ds >= \&>\&=
-.ds Rq ''
-.ds Lq ``
-.ds ua ^
-.ds aa \'
-.ds ga \`
-.ds sL `
-.ds sR '
-.ds q \&"
-.\" Math stuff
-.ds Pi pi
-.ds Ne !=
-.ds Le <=
-.ds Ge >=
-.ds Lt <
-.ds Gt >
-.ds Pm +-
-.ds If infinity
-.ds Na \fINaN\fP
-.ds Ba \fR\&|\fP
-
-.\"
-.de hK
-.nr % 1
-.ds hT \\*(dT
-.if !"\\*(cH"Null" \{\
-. ie !"\\*(gP"Null" .as hT \|(\|\\*(cH\\*(gP\|)
-. el .as hT \\|(\\|\\*(cH\\|)
-.\}
-.if "\\*(cH"Null" .if !"\\*(gP"Null" .as hT \&\|(\|\\*(gP\|)
-.ie \\n(cR \{\
-. hM
-. wh -1v fM
-.\}
-.el \{\
-. wh 0 hM
-. wh -1.167i fM
-.\}
-.if \\n(nl==0:\\n(nl==-1 'bp
-.em lM
-..
-.nr fW \w'0'
-.de sW
-.nr sW \w\\$1
-.ie \\n(sW>=\\n(fW \{\
-. ie \\n(sW%\\n(fW .nr sW (\\n(sW/\\n(fW)+1
-. el .nr sW \\n(sW/\\n(fW
-.\}
-.el .nr sW 0
-..
-.de aW
-.nr sW \w\\*(A\\$1
-.ie \\n(sW>=\\n(fW \{\
-. ie \\n(sW%\\n(fW .nr sW (\\n(sW/\\n(fW)+1
-. el .nr sW \\n(sW/\\n(fW
-.\}
-.el .nr sW 0
-..
-.\" NS Ql macro - Quoted literal define
-.de Ql
-.if \\n(aC==0 \{\
-. ds mN Ql
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-.\}
-.ds qL \&\\*(sL
-.ds qR \&\\*(sR
-.En \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" NS Sh macro - Section Headers
-.\" NS nS register - Section Header SYNOPSIS flag
-.\" NS nF register - Section Header FILES flag
-.\" NS nA register - Section Header SEE ALSO flag
-.\" NS nT register - Section Header STANDARDS flag
-.de Sh
-.nr nS 0
-.nr sE 0
-.nr iS 0
-.ie "\\$1"NAME" \{\
-. hK
-' in 0
-.\}
-.el \{\
-. nr nS 0
-. nr nA 0
-. nr nF 0
-. nr nT 0
-. nr nY 0
-. nr aN 0
-. nr oT 0
-. if "\\$1"SEE" .nr nA 1
-. if "\\$1"FILES" .nr nF 1
-. if "\\$1"STANDARDS" .nr nT 1
-. if "\\$1"SYNOPSIS" .nr nS 1
-. if "\\$1"DESCRIPTION" \{\
-. rr fB
-. rr Fb
-. ds Fb
-. nr fY 0
-. nr fZ 0
-. \}
-. if "\\$1"AUTHORS" .nr nY 1
-. in 0
-.\}
-.pL
-'sp
-.ns
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.if !\\n(cR .ne 3
-'fi
-\&\\*(sH\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9
-\&\fP\s0\&
-.in \\n(.iu+\\n(Tiu
-.if "\\$1"SEE" .nr sE 1
-.ns
-..
diff --git a/share/tmac/doc-syms b/share/tmac/doc-syms
deleted file mode 100644
index edc886f..0000000
--- a/share/tmac/doc-syms
+++ /dev/null
@@ -1,238 +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.
-.\"
-.\" @(#)doc-syms 8.1 (Berkeley) 6/8/93
-.\"
-.\" %beginstrip%
-.\" NS Ux macro - UNIX
-.de Ux
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ds aa \&\f\\n(cF\s\\n(cZ
-.as b1 \&\\*(tNUNIX\\*(aa
-.rm aa
-.if \\n(aC==0 \{\
-. if \\n(.$>0 .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==1 \{\
-. \\*(A\\n(aP
-. \}
-. el .nR
-.\}
-.el .aZ
-..
-.\" NS Bx macro -BSD (fix smaller nroff version)
-.de Bx
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ds aa \&\f\\n(cF\s\\n(cZ
-.if \\n(aC==0 \{\
-.\" . ie \\n(.$==0 \&\\*(tNBSD\\*(aa \\*(tNUNIX\\*(aa
-. ie \\n(.$==0 \&\\*(tNBSD\\*(aa
-. el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.if "\\$1"-alpha" \{\
-\&currently in alpha test.
-. aY
-.\}
-.if "\\$1"-beta" \{\
-\&currently in beta test.
-. aY
-.\}
-.if "\\$1"-devel" \{\
-\&currently under development.
-. aY
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. ie \\n(C\\n(aP==2 \{\
-. as b1 \&\\*(A\\n(aP\&\\*(tNBSD\\*(aa
-. ie \\n(aC>\\n(aP \{\
-. nr jj \\n(aP+1
-. ie \\n(C\\n(jj==2 \{\
-. if "\\*(A\\n(jj"Reno" \{\
-. nr aP \\n(aP+1
-. as b1 \&\-\\*(A\\n(jj
-. \}
-. if "\\*(A\\n(jj"reno" \{\
-. nr aP \\n(aP+1
-. as b1 \&\-Reno
-. \}
-. if "\\*(A\\n(jj"Tahoe" \{\
-. nr aP \\n(aP+1
-. as b1 \&\-\\*(A\\n(jj
-. \}
-. if "\\*(A\\n(jj"tahoe" \{\
-. nr aP \\n(aP+1
-. as b1 \&\-Tahoe
-. \}
-. ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nR
-. \}
-. el .aZ
-. \}
-. el \{\
-. nr aP \\n(aP+1
-. nR
-. \}
-. rr jj
-. \}
-. el .aZ
-. \}
-. el \{\
-. as b1 \&\\*(tNBSD\\*(aa
-. nR
-. \}
-.\}
-..
-.\" Ns Ud macro - prints "currently under development" (HISTORY section)
-.de Ud
-\&currently under development.
-..
-.\" Ns At macro - AT&T UNIX (this macro does not handle punctuation)
-.de At
-.nr cF \\n(.f
-.nr cZ \\n(.s
-.ds aa \&\f\\n(cF\s\\n(cZ
-.if \\n(.$==2 \{\
-. if "\\$1"32v" \&Version 32V \\*(tNAT&T UNIX\\*(aa\\$2
-. if "\\$1"v6" \&Version 6 \\*(tNAT&T UNIX\\*(aa\\$2
-. if "\\$1"v7" \&Version 7 \\*(tNAT&T UNIX\\*(aa\\$2
-. if "\\$1"V" \&\\*(tNAT&T\\*(aa System V \\*(tNUNIX\\*(aa\\$2
-. if "\\$1"V.1" \&\\*(tNAT&T\\*(aa System V.1 \\*(tNUNIX\\*(aa\\$2
-. if "\\$1"V.4" \&\\*(tNAT&T\\*(aa System V.4 \\*(tNUNIX\\*(aa\\$2
-.\}
-.if \\n(.$==1 \{\
-. if "\\$1"32v" \&Version 32V \\*(tNAT&T UNIX\\*(aa
-. if "\\$1"v6" \&Version 6 \\*(tNAT&T UNIX\\*(aa
-. if "\\$1"v7" \&Version 7 \\*(tNAT&T UNIX\\*(aa
-. if "\\$1"V" \&\\*(tNAT&T\\*(aa System V \\*(tNUNIX\\*(aa
-. if "\\$1"V.1" \&\\*(tNAT&T\\*(aa System V.1 \\*(tNUNIX\\*(aa
-. if "\\$1"V.4" \&\\*(tNAT&T\\*(aa System V.4 \\*(tNUNIX\\*(aa
-.\}
-.if \\n(.$==0 \{\
-\&\\*(tNAT&T UNIX\\*(aa
-.\}
-..
-.\" The Bt macro should go away now
-.\" Ns Bt macro - prints "is currently in beta test." (HISTORY section)
-.de Bt
-\&is currently in beta test.
-..
-.\" NS St macro - standards (posix, ansi - formal standard names)
-.ds Px \\*(tNPOSIX
-.ds Ai \\*(tNANSI
-.de St
-.if \\n(aC==0 \{\
-. ie \\n(.$==0 \{\
-.tm Usage: .St [-p1003.1-88 | -p1003.2 | -ansiC-89 | -iso ] \\*(Pu ... (#\\n(.c)
-. \}
-. el \{\
-. ds mN St
-. nr aP 0
-. ds A1 \\$1
-. ds A2 \\$2
-. ds A3 \\$3
-. ds A4 \\$4
-. ds A5 \\$5
-. ds A6 \\$6
-. ds A7 \\$7
-. ds A8 \\$8
-. ds A9 \\$9
-. nr fV \\n(.$
-. fV
-. \}
-.\}
-.if \\n(aC>\\n(aP \{\
-. nr cF \\n(.f
-. nr cZ \\n(.s
-. ds aa \&\f\\n(cF\s\\n(cZ
-. nr aP \\n(aP+1
-. if "\\*(A\\n(aP"-p1003.1-88" \{\
-. ie \\n(sT==1 \{\
-. ds b1 \&\\*(tNIEEE Std\\*(aa1003.1-1988\\*(sV
-. as b1 (``\\*(tN\\*(Px\\*(aa'')
-. \}
-. el \{\
-. ds b1 \&\\*(tNIEEE Std\\*(aa1003.1-1988\\*(sV
-. as b1 (``\\*(tN\\*(Px\\*(aa'')
-. \}
-. \}
-. if "\\*(A\\n(aP"-p1003.2" \{\
-. ie \\n(sT==1 \{\
-. ds b1 \&\\*(tNIEEE Std\\*(aa1003.2
-. as b1 (``\\*(tN\\*(Px\\*(aa'')
-. \}
-. el \{\
-. ds b1 \&\\*(tNIEEE Std\\*(aa1003.2\\*(sV
-. as b1 (``\\*(tN\\*(Px\\*(aa'')
-. \}
-. \}
-. if "\\*(A\\n(aP"-ansiC" \{\
-. ie \\n(sT==1 \{\
-. ds b1 \&\\*(tNANSI C \\*(aaX3.159-1989\\*(sV
-. as b1 (``\\*(tNANSI C\\*(aa'')
-. \}
-. el \{\
-. ds b1 \&\\*(tNANSI C \\*(aaX3.159-1989\\*(sV
-. as b1 (``\\*(tNANSI C \\*(aa'')
-. \}
-. \}
-. if "\\*(A\\n(aP"-ansiC-89" \{\
-. ie \\n(sT==1 \{\
-. ds b1 \&\\*(tNANSI C \\*(aaX3.159-1989\\*(sV
-. as b1 (``\\*(tNANSI C \\*(aa'')
-. \}
-. el \{\
-. ds b1 \&\\*(tNANSI C \\*(aaX3.159-1989\\*(sV
-. as b1 (``\\*(tNANSI C \\*(aa'')
-. \}
-. \}
-. if "\\*(A\\n(aP"-iso8802-3" \{\
-. ie \\n(sT==1 \{\
-. ds b1 \&\\*(tNISO \\*(aa8802-3: 1989\\*(sV
-.\" . as b1 (``\\*(tNANSI C\\*(aa'')
-. \}
-. el \{\
-. ds b1 \&\\*(tNISO \\*(aa8802-3: 1989\\*(sV
-.\" . as b1 (``\\*(tNANSI C\\*(aa'')
-. \}
-. \}
-. ie \\n(aC>\\n(aP \{\
-. nr aP \\n(aP+1
-. nR
-. \}
-. el .aZ
-.\}
-..
diff --git a/share/tmac/strip.sed b/share/tmac/strip.sed
deleted file mode 100644
index 4a03826..0000000
--- a/share/tmac/strip.sed
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /bin/sed -f
-#
-# Copyright (c) 1988, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of
-# California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)strip.sed 8.1 (Berkeley) 6/8/93
-#
-
-/%beginstrip%/{
- h
- s/.*/.\\" This version has had comments stripped; an unstripped version is available./p
- g
-}
-/%beginstrip%/,$s/[. ][ ]*\\".*//
-/^$/d
-/\\n@/d
diff --git a/share/tmac/tmac.andoc b/share/tmac/tmac.andoc
deleted file mode 100644
index 8ceec48..0000000
--- a/share/tmac/tmac.andoc
+++ /dev/null
@@ -1,54 +0,0 @@
-.\"
-.\" Copyright (c) 1990 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)tmac.andoc 8.1 (Berkeley) 6/30/93
-.\"
-.\" If -mdoc macros, source tmac.mdoc
-.\" If -man macros, check to see if groff or troff/nroff is being used
-.\"
-.de Dd
-.rn Dd xX
-.so /usr/share/tmac/tmac.doc
-.Dd \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-.rm xX
-..
-.de TH
-.rn TH xX
-.ie \n(.g \{\
-. so /usr/share/tmac/tmac.groff_an
-.\}
-.el \{\
-. so /usr/old/lib/tmac/tmac.an
-.\}
-.TH "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8"
-.rm xX
-..
diff --git a/share/tmac/tmac.doc.old b/share/tmac/tmac.doc.old
deleted file mode 100644
index e998fcf..0000000
--- a/share/tmac/tmac.doc.old
+++ /dev/null
@@ -1,1833 +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.
-.\"
-.\" @(#)tmac.doc.old 8.1 (Berkeley) 6/8/93
-.\"
-.\" Assume nroff on crt's only if cR==1
-.if n .nr cR 1
-.\" STRING CONSTANTS
-.\" DITROFF
-.if t \{\
-.\" Address Style
-.ds aD \fI
-.\" Argument Reference Style
-.ds aR \f(CO
-.\" Interactive Comand Modifier (flag)
-.ds cM \f(CB
-.\" Emphasis (in the English sense - usually italics)
-.ds eM \fI
-.\" Errno Style
-.ds eR \fC
-.\" Environment Variable Style
-.ds eV \fC
-.\" Command Line Flag Style
-.ds fL \f(CB
-.\" Header String Style
-.ds Hs \fR
-.\" Interactive Command Style
-.ds iC \f(CB
-.\" Literal Style
-.ds lI \fC
-.\" Left Parenthesis Style
-.ds lP \fR\|(\|\fP
-.\" Right Parenthesis Style
-.ds rP \fR\|)\|\fP
-.\" Options Open Bracket Style
-.ds lB \fR\^[\^\fP
-.\" Options Open Bracket Style
-.ds rB \fR\^]\fP
-.\" Name (subject of manpage) Style
-.ds nM \f(CB
-.\" Pathname Style
-.ds pA \fC
-.\" Accepted punctuation string for -mdoc syntax
-.ds Pu \fR[.,:;(\^)[\^]\fR]
-.\" Section Header Style
-.ds Sp \s12\fB
-.\" .ds sT \s-2\fR
-.\" Symbolic Emphasis (boldface)
-.ds sY \f(CB
-.\" Generic Variable Style
-.ds vA \fI
-.\" Volume Title Style
-.ds Vs \fR
-.\" Cross Reference STyle (man page only)
-.ds xR \fC
-.\" Math *
-.tr *\(**
-.\}
-.\" NROFF
-.if n \{\
-.\" Address Style
-.ds aD \fI
-.\" Argument Reference Style
-.ds aR \fI
-.\" Interactive Command Modifier (flag)
-.ds cM \fB
-.\" Emphasis (in the English sense - usually italics)
-.ds eM \fI
-.\" Errno Style
-.ds eR \fR
-.\" Environment Variable Style
-.ds eV \fR
-.\" Command Line Flag Style
-.ds fL \fB
-.\" Header String Style
-.ds Hs \fR
-.\" Interactive Command Style
-.ds iC \fB
-.\" Literal Style
-.ds lI \fR
-.\" Left Parenthesis Style
-.ds lP \fR\|(\fP
-.\" Right Parenthesis Style
-.ds rP \fR\|)\fP
-.\" Options Open Bracket Style
-.ds lB \fR\|[\|\fP
-.\" Options Open Bracket Style
-.ds rB \fR\|]\fP
-.\" Name (subject of manpage) Style
-.ds nM \fB
-.\" Pathname Style
-.ds pA \fI
-.\" Accepted punctuation string for -mdoc syntax
-.ds Pu [.,;:()[]]
-.\" Section Header Style
-.ds Sp \s12\fB
-.\" .ds sT \s-2\fR
-.\" .ds sT \s-2\fR
-.\" Symbol, Mode or Mask Style
-.ds sY \fB
-.\" Generic Variable Style
-.ds vA \fI
-.\" Volume Title Style
-.ds Vs \fR
-.\" Cross Reference Style (man page only)
-.ds xR \fR
-.\}
-.\" INDENTS - Subheaders(sI), Text(Ti) between Section Headers and Subsects
-.if t \{\
-. nr sI \w'\fC,'u*5
-. nr Ti \n(sIu
-.\}
-.if n \{\
-. nr sI .5i
-. nr Ti .5i
-.\}
-.\" Flags for macros names which are used only for .Ds
-.nr dI 6n
-.nr dC 1
-.nr dL 1
-.nr dR 1
-.\" INDENT WIDTHS (for Lists)
-.\" Width Needed for Address Tag (indented amount)
-.nr Ad 12n
-.\" Angle Quote Width
-.nr Aq 12n
-.\" Width Needed for Argument
-.nr Ar 12n
-.\" Width Needed for Column offset
-.nr Cl 15n
-.\" Width neeeded for Interactive Command Modifier
-.nr Cm 10n
-.\" Width Needed for Complex Expressions
-.nr Cx 20n
-.\" Indent Width Needed for Display (right and left margins)
-.nr Ds 6n
-.\" Double Quote Width
-.nr Dq 12n
-.\" tI is dependent on Ds and used by .Dp
-.nr tI \n(Dsu
-.\" Width Needed for Display
-.nr Em 10n
-.\" Width Needed for Errno Types
-.nr Er 15n
-.\" Width Needed for Environment Variables
-.nr Ev 15n
-.\" Width Needed for Example Indent
-.nr Ex 10n
-.\" Width Needed for Flag
-.nr Fl 10n
-.\" Width Needed for Function
-.nr Fn 16n
-.\" Width neeeded for Interactive Command Name
-.nr Ic 10n
-.\" Width Needed for Constant
-.nr Li 16n
-.\" Width Needed for Math Symbol ? not sure if needed
-.nr Ms 6n
-.\" Width Needed for Name
-.nr Nm 10n
-.\" Width Needed for Option Begin
-.nr Ob 14n
-.\" Width Needed for Option End
-.nr Oe 14n
-.\" Width Needed for Option (one line)
-.nr Op 14n
-.\" Width Needed for Pathname
-.nr Pa 32n
-.\" Parenthesis Quote Width
-.nr Pq 12n
-.\" Single Quote Width
-.nr Sq 12n
-.\" Width Needed for Symbols, Modes or Masks
-.nr Sy 6n
-.\" Width needed for default or unknown text width
-.nr Tx 22n
-.\" Width Needed for Generic Variable
-.nr Va 12n
-.\" Width Needed for Cross Reference, should the cross ref be annotated.
-.nr Xr 10n
-.\" PARAGRAPH SPACE
-.if t \{\
-. nr Pp .5v
-.\}
-.if n \{\
-. nr Pp 1v
-.\}
-.\" PAGE LAYOUT
-.\" .Li Tagged Paragraph Style - zero if break on oversized tag
-.\" one if add em space and continue filling line.
-.nr tP 0
-.\" Page Layout Macro
-.de pL
-.\" DITROFF
-.ie t \{\
-.\" Header Margin
-. nr Hm .5i
-.\" Footer Margin
-. nr Fm .5i
-.\" Line length
-. nr ll 5.5i
-.\" Line length
-. ll 5.5i
-.\" Title length
-. nr lt 5.5i
-.\" Title length
-. lt 5.5i
-.\" Page offset
-. nr po 1.56i
-.\" Page offset
-. po 1.56i
-.\" Vertical space distance (from Section headers/Lists/Subsections)
-. nr vV .5v
-.\" em space
-. ds tP \|\|\|\|\|\|
-.\}
-.el \{\
-.\" Line length
-. nr ll 78n
-. ll 78n
-.\" Title length
-. nr lt 78n
-.\" Title length
-. lt 78n
-.\" Page offset
-. nr po 0i
-.\" Page offset
-. po 0i
-.\" Vertical space distance (from Section headers/Lists/Subsections)
-. nr vV 1v
-.\" em space
-. ds tP \0\0
-.\" Test for crt
-. ie \\n(cR .nr Hm 0
-. el .nr Hm .5i
-.\" Footer Margin
-. nr Fm .5i
-.\}
-..
-.\" Adjustment mode
-.if n \{\
-.ad l
-.na
-..
-.\}
-.\" PREDEFINED STRINGS
-.if t \{\
-. ds <= \(<=
-. ds >= \(>=
-. ds Lq \&``
-. ds Rq \&''
-. ds ua \(ua
-. ds aa \(aa
-. ds ga \(ga
-. ds sR \(aa
-. ds sL \(ga
-.\}
-.if n \{\
-. ds <= \&<\&=
-. ds >= \&>\&=
-. ds Rq ''
-. ds Lq ``
-. ds ua ^
-. ds aa '
-. ds ga `
-. ds sL `
-. ds sR '
-.\}
-.\" Note: The distances from the bottom or top of the page are set
-.\" in headers (macro .hK): to -1.25 for troff, and -1.167 for nroff
-.\" bottoms, and top is 0.
-.\"
-.\" .Dt Document/manpage_title section/chapter volume
-.\" The \{ and \} is necessary as roff doesn't nest if-elses
-.\" properly, especially with .ds.
-.\" TODO: separate Dt into Dt, Ch and Vt for supp docs.
-.de Dt
-.ds dT UNTITLED
-.ds vT Local
-.ds cH Null
-.\" Volume and Section Number or Chapter Number
-.if !"\\$1"" .ds dT \\$1
-.if !"\\$2"" \{\
-. ds cH \\$2
-. if "\\$3"" \{\
-. \" Volume Title if none given
-. if \\$2>=1 .if \\$2<=8 \{\
-. ds vT UNIX Reference Manual
-. if \\$2>1 .if \\$2<6 .ds vT UNIX Programmer's Manual
-. if "\\$2"8" .ds vT UNIX System Manager's Manual
-. \}
-. if "\\$2"unass" .ds vT DRAFT
-. if "\\$2"draft" .ds vT DRAFT
-. if "\\$2"paper" .ds vT Null
-. \}
-.\}
-.if !"\\$3"" \{\
-. \" Volume Title if given
-. if "\\$3"USD" .ds vT UNIX User's Supplementary Documents
-. if "\\$3"PS1" .ds vT UNIX Programmers's Supplementary Documents
-. if "\\$3"AMD" .ds vT UNIX Ancestral Manual Documents
-. if "\\$3"SMM" .ds vT UNIX System Manager's Manual
-. if "\\$3"URM" .ds vT UNIX Reference Manual
-. if "\\$3"PRM" .ds vT UNIX Programmers's Manual
-. if "\\$3"IND" .ds vT UNIX Manual Master Index
-. if "\\$3"CON" .ds vT UNIX Contributed Software Manual
-. if "\\$3"IMP" .ds vT UNIX Implementation Notes
-. if "\\$3"HOW" .ds vT UNIX How Pocket Manual
-. if "\\$3"LOCAL" .ds vT UNIX Local Manual
-. if "\\*(vT"Local" .ds vT \\$3
-.\}
-..
-.\"
-.\" .Os Operating System/Standard and Release or Version Number
-.\"
-.de Os
-.ds oS Null
-.if "\\$1"" \{\
-. ds oS \fIBSD Experimental\fP
-.\" . ds oS (\fIBag o' Bits\fP)
-.\}
-.if "\\$2"" \{\
-. ds o1 Non-Null
-.\}
-.if "\\$1"ATT" \{\
-. ds oS AT&T
-. if "\\$2"" .as oS \0UNIX
-. if "\\$2"7th" .as oS \07th Edition
-. if "\\$2"7" .as oS \07th Edition
-. if "\\$2"III" .as oS \0System III
-. if "\\$2"3" .as oS \0System III
-. if "\\$2"V" .as oS \0System V
-. if "\\$2"V.2" .as oS \0System V Release 2
-. if "\\$2"V.3" .as oS \0System V Release 3
-. if "\\$2"V.4" .as oS \0System V Release 4
-.\}
-.if "\\$1"BSD" \{\
-. if "\\$2"3" .ds oS 3rd Berkeley Distribution
-. if "\\$2"4" .ds oS 4th Berkeley Distribution
-. if "\\$2"4.1" .ds oS 4.1 Berkeley Distribution
-. if "\\$2"4.2" .ds oS 4.2 Berkeley Distribution
-. if "\\$2"4.3" .ds oS 4.3 Berkeley Distribution
-. if "\\$2"4.3+" .ds oS 4.3+tahoe Berkeley Distribution
-.\}
-.if "\\*(oS"Null" .ds oS \\$1
-.if "\\*(o1"Non-Null" .as oS \0\\$2
-.rm o1
-..
-.\"
-.\" Standards
-.\"
-.\" .de St
-.\" .ds sT Null
-.\" .if "\\$1"POSIX" \{\
-.\" . ds sT IEEE Standard POSIX
-.\" . if \\$2 .as sT \0\\$2
-.\" .\}
-.\" .if "\\$1"ANSI" \{\
-.\" . ds sT ANSI Standard
-.\" . if \\$2 .as sT \0\\$2
-.\" .\}
-.\" .if "\\$1"ISO" \{\
-.\" . ds sT ISO Standard
-.\" . if \\$2 .as sT \0\\$2
-.\" .\}
-.\" .if "\\*(sT"Null" .ds sR \\$3
-.\" ..
-.\"
-.\" .de Gp
-.\" .ie !"\\$1"" .ds gP \&\\$1 \\$2 \\$3 \\$4 \\$5
-.\" .el .ds gP Null
-.\" ..
-.\"
-.\"
-.de Dd
-.nr aa 0
-.ie \\n(.$>0 \{\
-. ie \\n(.$<4 \{\
-. ds dD \\$1 \\$2 \\$3
-. \}
-. el .tm Usage: .Dd Month Day, Year (e.g July 4, 1977).
-.\}
-.el \{\
-. ds dD Epoch
-.\}
-..
-.\"
-.\" House Keeping Macro - Make sense of dT, cH, vT, sT, gP and dS
-.\" TODO: Try to get else's for efficiency
-.\" TODO: GET RID OF .wh -1.167i (its in v7)
-.\"
-.\"
-.de hK
-.nr % 1
-.ds hT \\*(dT
-.if !"\\*(cH"Null" \{\
-. ie !"\\*(gP"Null" .as hT \|(\|\\*(cH\\*(gP\|)
-. el .as hT \\|(\\|\\*(cH\\|)
-.\}
-.if "\\*(cH"Null" .if !"\\*(gP"Null" .as hT \&\|(\|\\*(gP\|)
-.if t \{\
-. wh 0 hM
-. wh -1.25i fM
-.\}
-.if n \{\
-. ie \\n(cR \{\
-. hM
-. wh -0v fM
-. \}
-. el \{\
-. wh 0 hM
-. wh -1.167i fM
-. \}
-.\}
-.if n \{\
-. if \\n(nl==0:\\n(nl==-1 'bp
-.\}
-.if t 'bp
-.em lM
-..
-.\" Header Macro
-.\"
-.de hM
-.ev 1
-.pL
-.if !\\n(cR 'sp \\n(Hmu
-.tl @\\*(Hs\\*(hT\fP@\\*(Vs\\*(vT\fP@\\*(Hs\\*(hT\fP@
-'sp \\n(Hmu
-.ev
-..
-.\"
-.de fM
-.ev 1
-.pL
-.if !\\n(cR \{\
-' sp \\n(Fmu
-. tl @\\*(Hs\\*(oS\fP@\\*(Vs\\*(dD\fP@%@
-' bp
-.\}
-.if \\n(cR \{\
-.\" . tl @\\*(Hs\\*(oS\fP@\\*(Vs\\*(dD\fP@%@
-.\" ' bp
-.\}
-.ev
-..
-.de lM
-.fl
-.if \\n(cR \{\
-. fM
-. pl \\n(nlu
-.\}
-..
-.de Pp
-.sp \\n(Ppu
-.ne 2
-.ns
-..
-.de Lp
-.Pp
-..
-.de LP
-.tm Not a \-mdoc command: .LP
-..
-.de PP
-.tm Not a \-mdoc command: .PP
-..
-.de pp
-.tm Not a \-mdoc command: .pp
-..
-.de Co
-.tm Not a \-mdoc command: .Co
-..
-.nr z. 1
-.nr z, 1
-.nr z: 1
-.nr z; 1
-.nr z) 1
-.nr z( 1
-.nr z[ 1
-.nr z] 1
-.\" This is disgusting, troff not parse if stmt properly
-.nr z1 0
-.nr z2 0
-.nr z3 0
-.nr z4 0
-.nr z5 0
-.nr z6 0
-.nr z7 0
-.nr z8 0
-.nr z9 0
-.nr z0 0
-.nr z# 0
-.\"
-.de Ad
-.ie \\n(.$==0 \{\
-. tm Usage: .Ad address [...] \\*(Pu
-.\}
-.el \{\
-. ds sV \\*(aD
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.\" Command Line Argument Macro
-.\"
-.de Ar
-.ie \\n(.$==0 \{\
-. ie !"\\*(iM"" .as f1 \&[\|\\*(aRfile\ ...\fP\|]
-. el \&[\|\\*(aRfile\ ...\fP\|]
-.\}
-.el \{\
-. ds sV \\*(aR
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Em
-.ie \\n(.$==0 \{\
-. tm Usage: .Em text ... \\*(Pu
-.\}
-.el \{\
-. ds sV \\*(eM
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Er
-.ie \\n(.$==0 \{\
-. tm Usage: .Er ERRNOTYPE ... \\*(Pu
-. \}
-.el \{\
-. ds sV \\*(eR
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Ev
-.ie \\n(.$==0 \{\
-. tm Usage: .Ev ENVIRONMENT_VARIABLE(s) ... \\*(Pu
-. \}
-.el \{\
-. ds sV \\*(eV
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.\" Flag Name Macro
-.\"
-.de Fl
-.ie \\n(.$==0 \{\
-. ie !"\\*(iM"" .as f1 \&\\*(fL\-\fP
-. el \&\\*(fL\-\fP
-.\}
-.el \{\
-. nr rZ 0
-. sW \\$1
-. if (\\n(sW==1&\\n(.$==1) .rZ \\$1
-. ds sV \\*(fL
-. nr cF \\n(.f
-. ie \\n(rZ \{\
-. ie "\\*(iM"" .ds f1 \&\\*(sV\-\f\\n(cF\\$1
-. el \&\\*(sV\-\f\\n(cF\\$1
-. \}
-. el \{\
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. fB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-. \}
-.\}
-..
-.\" Interactive Commands Macro
-.\"
-.de Ic
-.ie \\n(.$==0 \{\
-. tm Usage: .Ic Interactive Commands(s) ... \\*(Pu
-.\}
-.el \{\
-. ds sV \\*(iC
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.\" Interactive Command Modifiers (flags)
-.\"
-.de Cm
-.ie \\n(.$==0 \{\
-. tm Usage: .Cm Interactive Command Modifier(s) ... \\*(Pu
-.\}
-.el \{\
-. ds sV \\*(cM
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Li
-.ie \\n(.$==0 \{\
-. tm Usage: .Li literal ... \\*(Pu
-. \}
-.el \{\
-. ds sV \\*(lI
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\" If in nroff or any other case where the default font
-.\" is constant width, and literal means zilch, single quote instead.
-.ie n \{\
-.de Ql
-. ie \\n(.$==0 \{\
-. tm Usage: .Ql literal ... \\*(Pu
-. \}
-. el \{\
-. Sq \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-..
-.\}
-.el \{\
-.de Ql
-. ie \\n(.$==0 \{\
-. tm Usage: .Ql literal ... \\*(Pu
-. \}
-. el \{\
-. Li \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-..
-.\}
-.\"
-.de Nm
-.ie \\n(.$==0 \{\
-. if "\\*(n1"" .tm Usage: .Nm Name(s) ... \\*(Pu
-. ie !"\\*(iM"" .as f1 \&\\*(nM\\*(n1\\$1\fP
-. el \&\\*(nM\\*(n1\\$1\fP
-.\}
-.el \{\
-. ds sV \\*(nM
-. nr cF \\n(.f
-. if \\n(nS \{\
-. rs
-. in -\\n(iSu
-. ie \\n(nS>1 .br
-. el \{\
-. sW \\$1
-. nr iS ((\\n(sW+1)*\\n(fW)u
-. \}
-. in +\\n(iSu
-. ti -\\n(iSu
-. nr nS \\n(nS+1
-. \}
-. if "\\*(n1"" .ds n1 \\$1
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Pa
-.ie \\n(.$==0 \{\
-\&\\*(pA~\fP
-.\}
-.el \{\
-. ds sV \\*(pA
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Sy
-.ie \\n(.$==0 \{\
-. tm Usage: .Sy Symbolic Text ... \\*(Pu
-. \}
-.el \{\
-. ds sV \\*(sY
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Ms
-.ie \\n(.$==0 \{\
-. tm Usage: .Ms Math Symbol ... \\*(Pu
-. \}
-.el \{\
-. ds sV \\*(sY
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de Va
-.ie \\n(.$==0 \{\
-. tm Usage: .Va variable_name(s) ... \\*(Pu
-.\}
-.el \{\
-. ds sV \\*(vA
-. nr cF \\n(.f
-. ie "\\*(iM"" .ds f1 \&\\*(sV
-. el .as f1 \&\\*(sV
-. nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-.\}
-..
-.\"
-.de nB
-.hy 0
-.if \\n(.$==0 .tm Usage error: called with empty arguments (empty quotes)?
-.ie \\n(.$>1 \{\
-. rZ \\$1
-. ie \\n(rZ .as f1 \&\f\\n(cF\\$1\fP
-. el .as f1 \&\\$1
-. rZ \\$2
-. if !\\n(rZ \{\
-. ie !"\\*(iM""\{\
-.\" I surrender
-. if "\\*(iM"Tp" .as f1 \&\ \&
-. if "\\*(iM"Dp" .as f1 \&\ \&
-. if "\\*(iM"Op" .as f1 \&\ \&
-. if "\\*(iM"Cx" .as f1 \&\ \&
-. if "\\*(iM"Dq" .as f1 \& \&
-. if "\\*(iM"Sq" .as f1 \& \&
-. if "\\*(iM"Pq" .as f1 \& \&
-. if "\\*(iM"Aq" .as f1 \& \&
-. \}
-. el .as f1 \& \&
-. \}
-. nB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.el \{\
-. rZ \\$1
-. ie \\n(rZ .as f1 \&\f\\n(cF\\$1
-. el .as f1 \&\\$1\f\\n(cF
-. if "\\*(iM"" \{\&\\*(f1
-. ds f1
-. \}
-. hy
-.\}
-..
-.de fB
-.hy 0
-.if \\n(.$==0 .tm Usage error: called with empty arguments (empty quotes)?
-.ie \\n(.$>1 \{\
-. rZ \\$1
-. ie \\n(rZ .as f1 \&\f\\n(cF\\$1\fP
-. el \{\
-. ie "\\$1"-" .as f1 \&\-\-
-. el .as f1 \&\-\\$1
-. \}
-. rZ \\$2
-. if !\\n(rZ \{\
-. ie !"\\*(iM""\{\
-.\" I surrender
-. if "\\*(iM"Tp" .as f1 \&\ \&
-. if "\\*(iM"Dp" .as f1 \&\ \&
-. if "\\*(iM"Op" .as f1 \&\ \&
-. if "\\*(iM"Cx" .as f1 \&\ \&
-. if "\\*(iM"Dq" .as f1 \& \&
-. if "\\*(iM"Sq" .as f1 \& \&
-. if "\\*(iM"Pq" .as f1 \& \&
-. if "\\*(iM"Aq" .as f1 \& \&
-. \}
-. el .as f1 \& \&
-. \}
-. fB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.el \{\
-. rZ \\$1
-. ie \\n(rZ .as f1 \&\f\\n(cF\\$1
-. el \{\
-. ie "\\$1"-" .as f1 \&\-\-\f\\n(cF
-. el .as f1 \&\-\\$1\f\\n(cF
-. \}
-. if "\\*(iM"" \{\&\\*(f1
-. ds f1
-. \}
-. hy
-.\}
-..
-.\"
-.\" Single quoted Items
-.\" eF, sB g[0-9] and f2
-.de Sq
-.nr eF 0
-.ie \\n(.$==0 \{\
-. ie "\\*(iM"" \&\\*(sL\&\\*sR
-. el .as f1 \&\\*(sL\&\\*(sR
-.\}
-.el \{\
-. ie "\\*(iM"" \{\
-. ds f1 \&\\*(sL
-. ds iM Sq
-. \}
-. el .as f1 \&\\*(sL
-. sB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ie \\n(eF>0 .\\*(g1 \\*(g2 \\*(g3 \\*(g4 \\*(g5 \\*(g6 \\*(g7 \\*(g8
-. el .as f1 \\*(g0
-. as f1 \\*(sR
-. if !"\\*(f2"" .as f1 \\*(f2
-. if "\\*(iM"Sq" \{\
-\&\\*(f1
-. ds f1
-. ds iM
-. \}
-. ds f2
-. rm g0 g1 g2 g3 g4 g5 g6 g7 g8 g9
-. nr eF 0
-.\}
-..
-.\"
-.\" Double quoted Items
-.de Dq
-.nr Ef 0
-.ie \\n(.$==0 \{\
-. ie "\\*(iM"" \&\\*(Lq\&\\*(Rq
-. el .as f1 \&\\*(Lq\&\\*(Rq
-.\}
-.el \{\
-. ie "\\*(iM"" \{\
-. ds f1 \&\\*(Lq
-. ds iM Dq
-. \}
-. el .as f1 \&\\*(Lq
-. Sb \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ie \\n(Ef>0 .\\*(k1 \\*(k2 \\*(k3 \\*(k4 \\*(k5 \\*(k6 \\*(k7 \\*(k8
-. el .as f1 \\*(k0
-. as f1 \\*(Rq
-. if !"\\*(f4"" .as f1 \\*(f4
-. if "\\*(iM"Dq" \{\
-\&\\*(f1
-. ds f1
-. ds iM
-. \}
-. ds f4
-. rm k0 k1 k2 k3 k4 k5 k6 k7 k8 k9
-. nr Ef 0
-.\}
-..
-.\"
-.\" Parenthesis quoted Items
-.de Pq
-.nr pQ 0
-.ie \\n(.$==0 \{\
-. ie "\\*(iM"" \&(\&)
-. el .as f1 \&(\&)
-.\}
-.el \{\
-. ie "\\*(iM"" \{\
-. ds f1 \&(
-. ds iM Pq
-. \}
-. el .as f1 \&(
-. pB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ie \\n(pQ>0 .\\*(y1 \\*(y2 \\*(y3 \\*(y4 \\*(y5 \\*(y6 \\*(y7 \\*(y8
-. el .as f1 \\*(y0
-. as f1 \&)
-. if !"\\*(f3"" .as f1 \\*(f3
-. if "\\*(iM"Pq" \{\
-\&\\*(f1
-. ds f1
-. ds iM
-. \}
-. ds f3
-. rm y0 y1 y2 y3 y4 y5 y6 y7 y8 y9
-. nr pQ 0
-.\}
-..
-.\" eF, sB g[0-9] and f2
-.de sB
-.hy 0
-.ie \\n(.$==0 .tm Sick Logic: macro sB
-.el \{\
-. ie \\n(eF>=1 .nr eF \\n(eF+1
-. el \{\
-. mN \\$1
-. if \\n(mN .nr eF \\n(eF+1
-. \}
-. rZ \\$1
-. ie \\n(rZ .as f2 \\$1
-. el \{\
-. ie \\n(eF<1 .as g\\n(eF \\$1
-. el .as g\\n(eF \\$1
-. \}
-. if \\n(.$>1 \{\
-. rZ \\$2
-. if \\n(rZ==0 \{\
-. if \\n(eF<1 \{\
-. as g\\n(eF \& \&
-. \}
-. \}
-. sB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-..
-.de Sb
-.hy 0
-.ie \\n(.$==0 .tm Sick Logic: macro Sb
-.el \{\
-. ie \\n(Ef>=1 .nr Ef \\n(Ef+1
-. el \{\
-. mN \\$1
-. if \\n(mN .nr Ef \\n(Ef+1
-. \}
-. rZ \\$1
-. ie \\n(rZ .as f4 \\$1
-. el \{\
-. ie \\n(Ef<1 .as k\\n(Ef \\$1
-. el .as k\\n(Ef \\$1
-. \}
-. if \\n(.$>1 \{\
-. rZ \\$2
-. if \\n(rZ==0 \{\
-. if \\n(Ef<1 \{\
-. as k\\n(Ef \& \&
-. \}
-. \}
-. Sb \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-..
-.de pB
-.hy 0
-.ie \\n(.$==0 .tm Sick Logic: macro pB
-.el \{\
-. ie \\n(pQ>=1 .nr pQ \\n(pQ+1
-. el \{\
-. mN \\$1
-. if \\n(mN .nr pQ \\n(pQ+1
-. \}
-. rZ \\$1
-. ie \\n(rZ .as f3 \\$1
-. el \{\
-. ie \\n(pQ<1 .as y\\n(pQ \\$1
-. el .as y\\n(pQ \\$1
-. \}
-. if \\n(.$>1 \{\
-. rZ \\$2
-. if \\n(rZ==0 \{\
-. if \\n(pQ<1 \{\
-. as y\\n(pQ \& \&
-. \}
-. \}
-. pB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-..
-.de aQ
-.hy 0
-.ie \\n(.$==0 .tm Bad Syntax: .Aq
-.el \{\
-. ie \\n(aQ>=1 .nr aQ \\n(aQ+1
-. el \{\
-. mN \\$1
-. if \\n(mN .nr aQ \\n(aQ+1
-. \}
-. rZ \\$1
-. ie \\n(rZ .as aZ \\$1
-. el \{\
-. ie \\n(aQ<1 .as a\\n(aQ \\$1
-. el .as a\\n(aQ \\$1
-. \}
-. if \\n(.$>1 \{\
-. rZ \\$2
-. if \\n(rZ==0 \{\
-. if \\n(aQ<1 \{\
-. as a\\n(aQ \& \&
-. \}
-. \}
-. aQ \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-..
-.\" Angle Bracket Quoted Items
-.de Aq
-.nr aQ 0
-.ie \\n(.$==0 \{\
-. ie "\\*(iM"" \&<\&>
-. el .as f1 \&<\&>
-.\}
-.el \{\
-. ie "\\*(iM"" \{\
-. ds f1 \&<
-. ds iM Aq
-. \}
-. el .as f1 \&<
-. aQ \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-. ie \\n(aQ>0 .\\*(a1 \\*(a2 \\*(a3 \\*(a4 \\*(a5 \\*(a6 \\*(a7 \\*(a8
-. el .as f1 \\*(a0
-. as f1 \&>
-. if !"\\*(aZ"" .as f1 \\*(aZ
-. if "\\*(iM"Aq" \{\
-\&\\*(f1
-. ds f1
-. ds iM
-. \}
-. ds aZ
-. rm a0 a1 a2 a3 a4 a5 a6 a7 a8
-. nr aQ 0
-.\}
-..
-.\" macro Name test, return macro register value if true
-.de mN
-.nr mN 0
-.sW \\$1
-.if \\n(sW==2 \{\
-. if \\n(\\$1 .nr mN \\n(\\$1
-.\}
-..
-.\" Punctuation test (using z registers), return 1 if true
-.de rZ
-.nr rZ 0
-.sW \\$1
-.if \\n(sW==1 \{\
-. if \\n(z\\$1==1 \{\
-. nr rZ 1
-. \}
-.\}
-..
-.\"
-.\" sW returns number of characters in a string
-.if t \{\
-.nr fW \w'\fC,'
-.de sW
-.nr sW \w'\fC\\$1'
-.\}
-.if n \{\
-.nr fW \w'0'
-.de sW
-.nr sW \w'\\$1'
-.\}
-.ie \\n(sW>=\\n(fW \{\
-. ie \\n(sW%\\n(fW .nr sW (\\n(sW/\\n(fW)+1
-. el .nr sW \\n(sW/\\n(fW
-.\}
-.el .nr sW 0
-..
-.\" Option Expression -
-.\" TODO - add line overflow check (right!)
-.nr eP 0
-.ds e1
-.nr oE 0
-.nr hP 0
-.ds hP
-.nr Ep 0
-.de Op
-.hy 0
-.if "\\*(iM"" \{\
-. ds iM Op
-. ds f1 \&
-.\}
-.as f1 \&\\*(lB
-.\" .tm Op: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.dO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ie !"\\$1"Cx" .oE
-.el .nr oE \\n(oE+1
-..
-.\"
-.\" just for mike, with every bite of garlic in mind (oops, i mean burp).
-.\" dO: go dOwn an argument vector and test each argument to see if
-.\" a macro name or punctuation. stash in respective place along
-.\" with its arguments.
-.nr oO 0
-.nr oP 0
-.nr aO 0
-.de dO
-.mN \\$1
-.ie \\n(mN \{\
-. if \\n(oP \{\
-. if \\n(hP \{\
-. nr oZ 1
-. oZ
-. Oz
-. \}
-. if \\n(e1==1 \{\
-.\\*(e1 \\*(e2 \\*(e3 \\*(e4 \\*(e5 \\*(e6 \\*(e7 \\*(e8 \\*(e9
-. \}
-. uO
-. if !(\\n(oO:\\n(aO) .as f1 \& \&
-. \}
-. ie "\\$1"Op" \{\
-. as f1 \&\\*(lB
-. nr aO \\n(aO+1
-. \}
-. el \{\
-. nr eP \\n(eP+1
-. ds e\\n(eP \\$1
-. nr e\\n(eP 1
-. \}
-.\}
-.el \{\
-.\" .tm dO: $1: \\$1: eP \\n(eP e[\\n(eP]: \\*(e\\n(ePEE
-. rZ \\$1
-. ie \\n(rZ \{\
-.\" .tm dO:rZ: $1: \\$1: eP \\n(eP e[\\n(eP]: \\*(e\\n(eP
-. nr hP \\n(hP+1
-. ds h\\n(hP \\$1
-. \}
-. el \{\
-.\" .tm dO:word $1: \\$1: eP \\n(eP e[\\n(eP]: \\*(e\\n(ePEE
-. if \\n(eP==0:\\n(e\\n(eP==1 .nr eP \\n(eP+1
-. if \\n(eZ .as e\\n(eP \& \&
-. as e\\n(eP \&\\$1
-.\" . ds e\\n(eP \&\\$1
-. nr eZ \\n(eZ+1
-. \}
-.\}
-.nr oP 1
-.ie \\n(.$>1 \{\
-. dO \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.\}
-.el \{\
-. ie \\n(e1 \{\
-.\\*(e1 \\*(e2 \\*(e3 \\*(e4 \\*(e5 \\*(e6 \\*(e7 \\*(e8 \\*(e9
-. \}
-. el \{\
-. as f1 \\*(e1
-. \}
-.\}
-..
-.\" handle old style arguments such as the arg -Idir
-.\" in adb, .Oo is a toggle.
-.de Oo
-.ie \\n(oO .nr oO 0
-.el .nr oO 1
-..
-.\" stash punctuation
-.de oZ
-.if \\n(hP>=\\n(oZ \{\
-. nr eP \\n(eP+1
-. ds e\\n(eP \\*(h\\n(oZ
-. nr oZ \\n(oZ+1
-. oZ
-.\}
-..
-.\" clean up punctuation vector
-.de Oz
-.if \\n(hP>0 \{\
-. rm h\\n(hP
-. nr hP \\n(hP-1
-. Oz
-.\}
-..
-.\" uO: go back up created vector cleaning it up along the way
-.de uO
-.if \\n(eP>0 \{\
-. rm e\\n(eP
-. rr e\\n(eP
-. nr eP \\n(eP-1
-. nr oP 0
-. nr eZ 0
-. uO
-.\}
-..
-.\" option end
-.de oE
-.uO
-.ie \\n(hP \{\
-. as f1 \\*(rB\\*(h1\\*(h2\\*(h3
-. Oz
-. nr oZ 0
-.\}
-.el \{\
-. as f1 \\*(rB
-.\}
-.ie "\\*(iM"Op" \{\
-. if \\n(aO .aO
-.if t \{\
-. if (\\n(.lu-\\n(.ku-\\n(.ou-(2*\\n(fWu))<\w'\fC\\*(f1'u .br
-.\}
-.if n \{\
-. nr aa \w'\\*(f1'u
-.\" . nr qq \\n(.lu-\\n(.ku-\\n(.ou
-.\" \&aa == \\n(aa, f1==\\*(f1, qq==\\n(qq
-. if (\\n(.lu-\\n(.ku-\\n(.ou-\\n(aau)<=(8*\\n(fWu) .br
-.\}
-\&\\*(f1
-. ds iM
-. ds f1
-. hy
-.\}
-.el .nr oE \\n(oE-1
-..
-.de aO
-.as f1 \\*(rB
-.nr aO \\n(aO-1
-.if \\n(aO >0 .aO
-..
-.\"
-.de Xr
-.if \\n(.$<=1 \{\
-. ie \\n(.$==1 \{\
-. if !"\\*(iM"" .as f1 \&\\*(xR\\$1\fP
-. if "\\*(iM"" \&\\*(xR\\$1\fP
-. \}
-. el .tm Xr Usage: .Xr manpage_name [section#] \\*(Pu
-.\}
-.if \\n(.$==2 \{\
-. rZ \\$2
-. ie "\\*(iM"" \{\
-. ie \\n(rZ \&\\*(xR\\$1\fP\\$2
-. el \&\\*(xR\\$1\fP(\\$2)
-. \}
-. el \{\
-. ie \\n(rZ .as f1 \&\\*(xR\\$1\fP\\$2
-. el .as f1 \&\\*(xR\\$1\fP(\\$2)
-. \}
-.\}
-.if \\n(.$>=3 \{\
-. rZ \\$2
-. ie \\n(rZ \{\
-. ie !"\\*(iM"" .as f1 \&\\*(xR\\$1\fP\\$2\\$3\\$4\\$5\\$6\\$7\\$8
-. el \&\\*(xR\\$1\fP\\$2\\$3\\$4\\$5\\$6\\$7\\$8
-. \}
-. el \{\
-. rZ \\$3
-. ie \\n(rZ \{\
-. if !"\\*(iM"" \{\
-. as f1 \&\\*(xR\\$1\fP(\\$2)\\$3\\$4\\$5\\$6\\$7\\$8
-. \}
-. if "\\*(iM"" \{\
-\&\\*(xR\\$1\fP(\\$2)\\$3\\$4\\$5\\$6\\$7\\$8
-. \}
-. \}
-. el \{\
-. tm rZ = \\n(rZ the arg is \\$3
-. tm Xr-XX Usage: .Xr manpage_name [section#] \\*(Pu
-. \}
-. \}
-.\}
-..
-.\"
-.\"
-.de Ex
-.tm Ex defunct, Use .Dl: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\" Display (one) Line of text.
-.de Dl
-.ie "\\*(iM"" \{\
-' ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-. in \\n(.iu+\\n(Dsu
-. mN \\$1
-. ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el \{\
-. nr cF \\n(.f
-.\" Literal font is none specified
-\&\\*(lI\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. ft \\n(cF
-. \}
-. in \\n(.iu-\\n(Dsu
-.\}
-.el \{\
-. mN \\$1
-. ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-. el \{\
-. nr cF \\n(.f
-. ds f1 \&\\*(lI\\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-. as f1 \&\f\\n(cF
-. \}
-.\}
-..
-.\"
-.\"
-.\" user set Tagged Paragraph Width (used in both Dp and Tp)
-.de Tw
-.ie \\n(.$==0 \{\
-. nr aa 0
-.\}
-.el \{\
-. mN \\$1
-. ie \\n(sW>2 \{\
-. nr tW (\\n(sW+3)*\\n(fWu)
-. \}
-. el \{\
-. ie \\n(mN .nr tW \\n(mN
-. el .nr tW \\$1
-. \}
-. nr tF 1
-.\}
-..
-.\"
-.de Dw
-.Tw \\$1
-..
-.\"
-.de Di
-.ie \\n(.$==0 \{\
-. nr tI \\n(Dsu
-.\}
-.el \{\
-. sW \\$1
-. if \\n(sW>=2 \{\
-. nr tI \\$1u
-. \}
-. if \\n(sW<2 \{\
-. if "\\$1"L" \{\
-. nr tI 0
-. \}
-. \}
-.\}
-..
-.\" tagged paragraph
-.\" initialize baby stack variables
-.nr np 0
-.nr p1 0
-.ds s\n(np
-.\"
-.de Tp
-.ie "\\$1"" .pE p s np
-.el \{\
-. ds iM Tp
-. mN \\$1
-. ie \\n(tF \{\
-. ds tC Tw
-. nr tC 1
-. nr tF 0
-. \}
-. el \{\
-. if !"Tw"\\*(s\\n(np" \{\
-. ie \\n(mN \{\
-. ds tC \\$1
-. nr tW \\n(mN
-. \}
-. el \{\
-. ds tC Tx
-. nr tW \\n(Tx
-. \}
-. if !"\\*(tC"\\*(s\\n(np" .nr tC 1
-. \}
-. \}
-. sp \\n(vVu
-. if !\\n(cR .ne 2
-. if \\n(tC \{\
-. nr np \\n(np+1
-. nr p\\n(np \\n(tW
-. ds s\\n(np \\*(tC
-. nr tC 0
-. ds tC
-. in \\n(.iu+\\n(p\\n(npu
-. \}
-. ie \\n(mN \{\
-. ds f1
-. \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. if !"\\$1"Cx" .pT st p np
-. \}
-. el \{\
-. br
-. ev 1
-. fi
-. di Td
-\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. br
-. di
-. ev
-. na
-. ds tD \\*(Td\\
-. pT di p np
-. \}
-.\}
-..
-.\"
-.\"
-.\" Complex Expression Macro
-.\"
-.\" TODO: add length across line boundary check (like Li)
-.de Cx
-.hy 0
-.ie \\n(.$==0 \{\
-. if "\\*(iM"Cx" \{\
-. ds iM
-. if \\n(oE .oE
-\&\\*(f1
-. ds f1
-. \}
-. if "\\*(iM"Tp" .pT st p np
-. if "\\*(iM"Dp" .pT st q mp
-.\}
-.el \{\
-. if "\\*(iM"" \{\
-. ds iM Cx
-. ds f1 \&
-. \}
-. mN \\$1
-.\" Here are the args: `\\$1' `\\$2' `\\$3' `\\$4'
-. ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el \{\
-. as f1 \&\\$1
-. if \\n(.$>1 .Cx \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-..
-.\" Prefix string in default font to content specified string
-.de Pf
-.Cx \\$1
-.\\$2 \\$3 \\$4 \\$5
-.Cx
-..
-.\" Suffix string in default font to content specified string
-.de Sf
-.Cx \\$1 \\$2
-.Cx \\$3
-.Cx
-..
-.\" Simple Option Begin
-.de Ob
-.hy 0
-.ie "\\*(iM"" \{\
-. ev 2
-. fi
-. di oB
-.\}
-.el \{\
-.tm shouldn't be here
-. as f1 \&[
-. mN \\$1
-. ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. el \{\
-. as f1 \&\\$1
-. if \\n(.$>1 .Oc \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-.\}
-..
-.de Oc
-.as f1 \&\\$1
-.if \\n(.$>1 .Oc \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.de Oe
-.hy 0
-.ie "\\*(iM"" \{\
-. br
-. di
-. ev
-. ds bO \\*(oB\\
-\&[\\*(bO\&]
-.\}
-.el \{\
-. as f1 \&]
-.\}
-..
-.\" White space for Cx
-.de Ws
-.Cx \&\ \&
-..
-.\" tagged paragraph
-.\" initialize baby stack variables
-.nr mp 0
-.nr q1 0
-.ds r\n(np
-.\"
-.\" Complex Dp tag
-.de Dc
-.Dp Cx \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-..
-.\" Complex Tp tag
-.de Tc
-.Tp Cx \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
-..
-.\" Tag with a flag and an argument with a space
-.de Ta
-.if "\\$2"" \{\
-. Tp Fl \\$1
-.\}
-.el \{\
-. Tp Fl \\$1
-. Cx \&\ \&
-. Ar \\$2 \\$3
-. Cx
-.\}
-..
-.de Da
-.Dp Cx Fl \\$1
-.Ws
-.Ar \\$2 \\$3
-.Cx
-..
-.de To
-.Tp Cx Fl \\$1
-.Ar \\$2 \\$3
-.Cx
-..
-.de Do
-.Dp Cx Fl \\$1
-.Ar \\$2 \\$3
-.Cx
-..
-.\" Blended tag toggle
-.de Bt
-.ie \\n(tP==0 .nr tP 1
-.el .nr tP 0
-..
-.\" Bullet paragraph
-.de Bu
-.Tp Sy \&\(bu
-..
-.\" Display tagged paragraph
-.de Dp
-.ie "\\$1"" \{\
-. pE q r mp
-. sp \\n(vVu
-.\}
-.el \{\
-. ds iM Dp
-. mN \\$1
-. ie \\n(tF \{\
-. ds tC Tw
-. nr tC 1
-. nr tF 0
-. \}
-. el \{\
-. if !"Tw"\\*(r\\n(mp" \{\
-. ie \\n(mN \{\
-. ds tC \\$1
-. nr tW \\n(mN
-. \}
-. el \{\
-. ds tC Tx
-. nr tW \\n(Tx
-. \}
-. if !"\\*(tC"\\*(r\\n(mp" .nr tC 1
-. \}
-. \}
-. if !\\n(cR .ne 2
-. if \\n(tC \{\
-. nr mp \\n(mp+1
-. nr q\\n(mp \\n(tW
-. ds r\\n(mp \\*(tC
-. nr tC 0
-. ds tC
-. ie \\n(tIu==\\n(Dsu .nr i\\n(mp \\n(Dsu
-. el \{\
-. nr i\\n(mp \\n(tIu
-. nr tI \\n(Dsu
-. \}
-. in \\n(.iu+\\n(i\\n(mpu
-. sp \\n(vVu
-. in \\n(.iu+\\n(\\q\\n(mpu
-. \}
-. ie \\n(mN \{\
-. \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. if !"\\$1"Cx" .pT st q mp
-. \}
-. el \{\
-. br
-. ev 1
-. fi
-. di Td
-\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. br
-. di
-. ev
-. na
-. ds tD \\*(Td\\
-. pT di q mp
-. \}
-.\}
-..
-.\"
-.\" .pE number_stack string_stack counter
-.de pE
-.ie "\\$3"mp" \{\
-. in \\n(.iu-(\\n(\\$1\\n(\\$3u)-(\\n(i\\n(mpu)
-. rr i\\n(mp
-.\}
-.el .in \\n(.iu-\\n(\\$1\\n(\\$3u
-.\" .in \\n(.iu-\\n(\\$1\\n(\\$3u
-.if \\n(\\$3<=0 .tm Extraneous call .Tp or .Dp
-.rr \\$1\\n(\\$3
-.rm \\$2\\n(\\$3
-.nr \\$3 \\n(\\$3-1
-.ds iM
-..
-.\"
-.\" .pT [st or di] number_stack counter
-.de pT
-.ie "\\$1"st" \{\
-. nr bb \\n(\\$2\\n(\\$3u
-. ti -\\n(bbu
-. ie (\\n(\\$2\\n(\\$3u-2n)<=\w'\\*(f1'u \{\&\\*(f1\\*(tP
-. if \\n(tP==0 .br
-. \}
-. el \\*(f1\h'|\\n(\\$2\\n(\\$3u'\c
-.\}
-.el \{\
-. ti -\\n(\\$2\\n(\\$3u
-. ie (\\n(\\$2\\n(\\$3u-2n)<=\\n(dlu \{\&\\*(tD\\*(tP
-. if !\\n(tP .br
-. \}
-. el \\*(tD\h'|\\n(\\$2\\n(\\$3u-'\c
-. if t 'ad
-.\}
-. ds iM
-. ds f1
-'fi
-..
-.\"
-.\" The new SH
-.\"
-.de Sh
-.\" set Sh state off, check for list state before calling indent (.In)
-.nr nS 0
-.nr sE 0
-.ie "\\$1"NAME" \{\
-.\" name state on, housekeep (headers & footers)
-. hK
-' in 0
-.\}
-.el \{\
-. if "\\$1"SYNOPSIS" .nr nS 1
-. in 0
-.\}
-.pL
-'sp
-.ns
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.if !\\n(cR .ne 3
-'fi
-\&\fB\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9
-\&\fP\&
-.in \\n(.iu+\\n(Tiu
-.if "\\$1"SEE" .nr sE 1
-.ns
-..
-.\"
-.\" Nd minus sign for an en dash used in .Sh Name
-.de Nd
-\&\-\& \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.de Ss
-.sp
-.ti -.25i
-\&\fB\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9
-\&\fP\&
-.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.if !\\n(cR .ne 2
-.br
-..
-.\" .if "\\$1"Ss" .in \\n(.iu+\\n(sIu
-.\"..
-.\"
-.\"
-.\" Column Macro
-.\"
-.hy 0
-.de Cw
-.ie \\n(.$==0 \{\
-. br
-. in \\n(.iu-\\n(eWu
-. ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i
-.\}
-.el \{\
-. Pp
-. if \\n(.$==1 \{\
-. ta \w'\\$1 'u
-. nr eW \w'\\$1 'u
-' in \\n(.iu+\\n(eWu
-. \}
-. if \\n(.$==2 \{\
-. ta \w'\\$1 'u +\w'\\$2 'u
-. nr eW \w'\\$1 'u+\w'\\$2 'u
-' in \\n(.iu+\\n(eWu
-. \}
-. if \\n(.$==3 \{\
-. ta \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u
-. nr eW \w'\\$1 'u+\w'\\$2 'u+\w'\\$3 'u
-' in \\n(.iu+\\n(eWu
-. \}
-. if \\n(.$==4 \{\
-. ta \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u +\w'\\$4 'u
-. nr eW \w'\\$1 'u+\w'\\$2 'u+\w'\\$3 'u +\w'\\$4 'u
-' in \\n(.iu+\\n(eWu
-. \}
-. if \\n(.$==5 \{\
-.ta \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u +\w'\\$4 'u +\w'\\$5 'u
-.nr eW \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u +\w'\\$4 'u +\w'\\$5 'u
-' in \\n(.iu+\\n(eWu
-. \}
-.\}
-..
-.de Cl
-.ti -\\n(eWu
-.mN \\$1
-.ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.el \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.nr dQ 0
-.de Ds
-.ie !"\\$1"" \{\
-. mN d\\$1
-. if \\n(mN \{\
-. nr dQ \\n(dQ+1
-. d\\$1
-. \}
-.\}
-.el .br
-.nf
-..
-.de Df
-.ie !"\\$1"" \{\
-. mN d\\$1
-. if \\n(mN \{\
-. nr dQ \\n(dQ+1
-. d\\$1
-. \}
-.\}
-.el .br
-..
-.de Dn
-\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.nf
-..
-.de dI
-.nr d\\n(dQ \\n(dIu
-.in \\n(.iu+\\n(dIu
-..
-.de dC
-.nr d\\n(dQ (\\n(.l-\\n(.i)/4u
-.in \\n(.iu+\\n(d\\n(dQu
-..
-.de dR
-.nr d\\n(dQ (\\n(.l/3)u
-.in \\n(.iu+\\n(d\\n(dQu
-..
-.de dL
-.nr aa 0
-..
-.de De
-.br
-.if \\n(d\\n(dQ \{\
-. in \\n(.iu-\\n(d\\n(dQu
-. rr d\\n(dQ
-. nr dQ \\n(dQ-1
-.\}
-.fi
-..
-.\"
-.de Fn
-.ie \\n(.$==0 \{\
-. tm Usage: .Fn function_name function_arg(s) ... \\*(Pu
-.\}
-.el \{\
-. nr cF \\n(.f
-. ie \\n(.$==1 .ds f1 \&\\*(nM\\$1\fP\\*(lP\fP\\*(rP\fP
-. el \{\
-. ds f1 \\*(nM\\$1\fP\\*(lP
-. nr aa 0
-. rC \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-. \}
-. if "\\*(iM"" \{\\&\\*(f1
-. ds f1
-. \}
-.\}
-..
-.\"
-.de rC
-.rZ \\$1
-.ie \\n(rZ \{\
-. as f1 \f\\n(cF\\*(rP\f\\n(cF\\$1\\$2\\$3\\$4\\$5\\$6\\$7
-.\}
-.el \{\
-. ie \\n(aa .as f1 \fP, \\*(aR\\$1
-. el .as f1 \\*(aR\\$1
-. nr aa 1
-. ie \\n(.$>1 .rC \\$2 \\$3 \\$4 \\$5 \\$6 \\$7
-. el .as f1 \fP\\*(rP\fP
-.\}
-..
diff --git a/share/tmac/tmac.e b/share/tmac/tmac.e
deleted file mode 100644
index dabaf7b..0000000
--- a/share/tmac/tmac.e
+++ /dev/null
@@ -1,41 +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.
-.\"
-.\" @(#)tmac.e 8.2 (Berkeley) 3/27/94
-.\"
-.\" If groff, use groff -me, else use local -me (w/ditroff, troff, nroff)
-.ie \n(.g \{\
-. so /usr/share/tmac/tmac.groff_me
-.\}
-.el \{\
-. so /usr/share/tmac/tmac.orig_me
-.\}
diff --git a/share/tmac/tmac.s b/share/tmac/tmac.s
deleted file mode 100644
index 8a80ceb..0000000
--- a/share/tmac/tmac.s
+++ /dev/null
@@ -1,41 +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.
-.\"
-.\" @(#)tmac.s 8.1 (Berkeley) 6/8/93
-.\"
-.\" If groff, use groff -ms, else use local -ms (w/ditroff, troff, nroff)
-.ie \n(.g \{\
-. so /usr/share/tmac/tmac.groff_ms
-.\}
-.el \{\
-. so /usr/old/lib/tmac/tmac.s
-.\}
diff --git a/share/tmac/tmac.sU b/share/tmac/tmac.sU
deleted file mode 100644
index 3c7a83d..0000000
--- a/share/tmac/tmac.sU
+++ /dev/null
@@ -1,46 +0,0 @@
-.\" Copyright (c) 1992, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)tmac.sU 8.1 (Berkeley) 6/8/93
-.\"
-.\" Modify -ms macros for typesetting manuals for Usenix distribution.
-.\" Differences: page numbers even on page 1, MH = Bell Labs,
-.\" default line length (and title length) 6.5i instead of 6i.
-.\"
-.so /usr/share/tmac/tmac.s
-.nr P1 1 \" page number on page 1
-.nr LL 6.5i
-.ll \\n(LLu
-.lt 6.5i
-.de MH
-AT&T Bell Laboratories
-Murray Hill, New Jersey 07974
-..
diff --git a/usr.bin/apropos/Makefile b/usr.bin/apropos/Makefile
deleted file mode 100644
index 028a42c..0000000
--- a/usr.bin/apropos/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= apropos
-SRCS= apropos.c config.c
-.PATH: ${.CURDIR}/../man
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/apropos/apropos.1 b/usr.bin/apropos/apropos.1
deleted file mode 100644
index eb68f37..0000000
--- a/usr.bin/apropos/apropos.1
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" Copyright (c) 1989, 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.
-.\"
-.\" @(#)apropos.1 8.1 (Berkeley) 6/29/93
-.\"
-.Dd June 29, 1993
-.Dt APROPOS 1
-.Os
-.Sh NAME
-.Nm apropos
-.Nd locate commands by keyword lookup
-.Sh SYNOPSIS
-.Nm apropos
-.Op Fl M Ar path
-.Op Fl m Ar path
-.Ar keyword ...
-.Sh DESCRIPTION
-.Nm Apropos
-shows which manual pages contain instances of any of the given
-.Ar keyword(s)
-in their title line.
-Each word is considered separately and case of letters is ignored.
-Words which are part of other words are considered; when looking for
-.Dq compile ,
-.Nm apropos
-will also list all instances of
-.Dq compiler .
-.Pp
-If the line output by
-.Nm apropos
-starts
-.Dq Li name(section) ...
-you can enter
-.Dq Li man section name
-to get
-its documentation.
-.Pp
-The options are as follows:
-.Bl -tag -width flag
-.It Fl M
-Override the list of standard directories
-.Nm apropos
-searches for a database named
-.Pa whatis.db .
-The supplied
-.Ar path
-must be a colon
-.Dq \&:
-separated list of directories.
-This search path may also be set using the environment variable
-.Ev MANPATH .
-.It Fl m
-Augment the list of standard directories
-.Nm apropos
-searches for its database.
-The supplied
-.Ar path
-must be a colon
-.Dq \&:
-separated list of directories.
-These directories will be searched before the standard directories,
-or the directories supplied with the
-.Fl M
-option or the
-.Ev MANPATH
-environment variable.
-.Sh ENVIRONMENT
-.Bl -tag -width MANPATH
-.It Ev MANPATH
-The standard search path used by
-.Xr man 1
-may be overridden by specifying a path in the
-.Ev MANPATH
-environment variable.
-The format of the path is a colon
-.Dq \&:
-separated list of directories.
-.El
-.Sh FILES
-.Bl -tag -width whatis.db -compact
-.It Pa whatis.db
-name of the apropos database
-.El
-.Sh SEE ALSO
-.Xr man 1 ,
-.Xr whatis 1 ,
-.Xr whereis 1
-.Sh HISTORY
-The
-.Nm apropos
-command appeared in
-.Bx 3.0 .
diff --git a/usr.bin/apropos/apropos.c b/usr.bin/apropos/apropos.c
deleted file mode 100644
index a0e0525..0000000
--- a/usr.bin/apropos/apropos.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 1987, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1987, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)apropos.c 8.7 (Berkeley) 4/2/94";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/queue.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../man/config.h"
-#include "../man/pathnames.h"
-
-static int *found, foundman;
-
-void apropos __P((char **, char *, int));
-void lowstr __P((char *, char *));
-int match __P((char *, char *));
-void usage __P((void));
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- ENTRY *ep;
- TAG *tp;
- int ch, rv;
- char *conffile, **p, *p_augment, *p_path;
-
- conffile = NULL;
- p_augment = p_path = NULL;
- while ((ch = getopt(argc, argv, "C:M:m:P:")) != EOF)
- switch (ch) {
- case 'C':
- conffile = optarg;
- break;
- case 'M':
- case 'P': /* backward compatible */
- p_path = optarg;
- break;
- case 'm':
- p_augment = optarg;
- break;
- case '?':
- default:
- usage();
- }
- argv += optind;
- argc -= optind;
-
- if (argc < 1)
- usage();
-
- if ((found = malloc((u_int)argc * sizeof(int))) == NULL)
- err(1, NULL);
- memset(found, 0, argc * sizeof(int));
-
- for (p = argv; *p; ++p) /* convert to lower-case */
- lowstr(*p, *p);
-
- if (p_augment)
- apropos(argv, p_augment, 1);
- if (p_path || (p_path = getenv("MANPATH")))
- apropos(argv, p_path, 1);
- else {
- config(conffile);
- ep = (tp = getlist("_whatdb")) == NULL ?
- NULL : tp->list.tqh_first;
- for (; ep != NULL; ep = ep->q.tqe_next)
- apropos(argv, ep->s, 0);
- }
-
- if (!foundman)
- errx(1, "no %s file found", _PATH_WHATIS);
-
- rv = 1;
- for (p = argv; *p; ++p)
- if (found[p - argv])
- rv = 0;
- else
- (void)printf("%s: nothing appropriate\n", *p);
- exit(rv);
-}
-
-void
-apropos(argv, path, buildpath)
- char **argv, *path;
- int buildpath;
-{
- char *end, *name, **p;
- char buf[LINE_MAX + 1], wbuf[LINE_MAX + 1];
-
- for (name = path; name; name = end) { /* through name list */
- if (end = strchr(name, ':'))
- *end++ = '\0';
-
- if (buildpath) {
- char hold[MAXPATHLEN + 1];
-
- (void)sprintf(hold, "%s/%s", name, _PATH_WHATIS);
- name = hold;
- }
-
- if (!freopen(name, "r", stdin))
- continue;
-
- foundman = 1;
-
- /* for each file found */
- while (fgets(buf, sizeof(buf), stdin)) {
- if (!strchr(buf, '\n')) {
- warnx("%s: line too long", name);
- continue;
- }
- lowstr(buf, wbuf);
- for (p = argv; *p; ++p)
- if (match(wbuf, *p)) {
- (void)printf("%s", buf);
- found[p - argv] = 1;
-
- /* only print line once */
- while (*++p)
- if (match(wbuf, *p))
- found[p - argv] = 1;
- break;
- }
- }
- }
-}
-
-/*
- * match --
- * match anywhere the string appears
- */
-int
-match(bp, str)
- char *bp, *str;
-{
- int len;
- char test;
-
- if (!*bp)
- return (0);
- /* backward compatible: everything matches empty string */
- if (!*str)
- return (1);
- for (test = *str++, len = strlen(str); *bp;)
- if (test == *bp++ && !strncmp(bp, str, len))
- return (1);
- return (0);
-}
-
-/*
- * lowstr --
- * convert a string to lower case
- */
-void
-lowstr(from, to)
- char *from, *to;
-{
- char ch;
-
- while ((ch = *from++) && ch != '\n')
- *to++ = isupper(ch) ? tolower(ch) : ch;
- *to = '\0';
-}
-
-/*
- * usage --
- * print usage message and die
- */
-void
-usage()
-{
-
- (void)fprintf(stderr,
- "usage: apropos [-C file] [-M path] [-m path] keyword ...\n");
- exit(1);
-}
diff --git a/usr.bin/ar/ar.5.5 b/usr.bin/ar/ar.5.5
deleted file mode 100644
index 29c8f8c..0000000
--- a/usr.bin/ar/ar.5.5
+++ /dev/null
@@ -1,145 +0,0 @@
-.\" Copyright (c) 1990, 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.
-.\"
-.\" @(#)ar.5.5 8.1 (Berkeley) 6/9/93
-.\"
-.Dd June 9, 1993
-.Dt AR 5
-.Os
-.Sh NAME
-.Nm ar
-.Nd archive (library) file format
-.Sh SYNOPSIS
-.Fd #include <ar.h>
-.Sh DESCRIPTION
-The archive command
-.Nm ar
-combines several files into one.
-Archives are mainly used as libraries of object files intended to be
-loaded using the link-editor
-.Xr ld 1 .
-.Pp
-A file created with
-.Nm ar
-begins with the ``magic'' string "!<arch>\en".
-The rest of the archive is made up of objects, each of which is composed
-of a header for a file, a possible file name, and the file contents.
-The header is portable between machine architectures, and, if the file
-contents are printable, the archive is itself printable.
-.Pp
-The header is made up of six variable length
-.Tn ASCII
-fields, followed by a
-two character trailer.
-The fields are the object name (16 characters), the file last modification
-time (12 characters), the user and group id's (each 6 characters), the file
-mode (8 characters) and the file size (10 characters).
-All numeric fields are in decimal, except for the file mode which is in
-octal.
-.Pp
-The modification time is the file
-.Fa st_mtime
-field, i.e.,
-.Dv CUT
-seconds since
-the epoch.
-The user and group id's are the file
-.Fa st_uid
-and
-.Fa st_gid
-fields.
-The file mode is the file
-.Fa st_mode
-field.
-The file size is the file
-.Fa st_size
-field.
-The two-byte trailer is the string "\`\en".
-.Pp
-Only the name field has any provision for overflow.
-If any file name is more than 16 characters in length or contains an
-embedded space, the string "#1/" followed by the
-.Tn ASCII
-length of the
-name is written in the name field.
-The file size (stored in the archive header) is incremented by the length
-of the name.
-The name is then written immediately following the archive header.
-.Pp
-Any unused characters in any of these fields are written as space
-characters.
-If any fields are their particular maximum number of characters in
-length, there will be no separation between the fields.
-.Pp
-Objects in the archive are always an even number of bytes long; files
-which are an odd number of bytes long are padded with a newline (``\en'')
-character, although the size in the header does not reflect this.
-.Sh SEE ALSO
-.Xr ar 1 ,
-.Xr stat 2
-.Sh HISTORY
-There have been at least four
-.Nm ar
-formats.
-The first was denoted by the leading ``magic'' number 0177555 (stored as
-type int).
-These archives were almost certainly created on a 16-bit machine, and
-contain headers made up of five fields.
-The fields are the object name (8 characters), the file last modification
-time (type long), the user id (type char), the file mode (type char) and
-the file size (type unsigned int).
-Files were padded to an even number of bytes.
-.Pp
-The second was denoted by the leading ``magic'' number 0177545 (stored as
-type int).
-These archives may have been created on either 16 or 32-bit machines, and
-contain headers made up of six fields.
-The fields are the object name (14 characters), the file last modification
-time (type long), the user and group id's (each type char), the file mode
-(type int) and the file size (type long).
-Files were padded to an even number of bytes.
-For more information on converting from this format see
-.Xr arcv 8 .
-.Pp
-The current archive format (without support for long character names and
-names with embedded spaces) was introduced in
-.Bx 4.0 .
-The headers were the same as the current format, with the exception that
-names longer than 16 characters were truncated, and names with embedded
-spaces (and often trailing spaces) were not supported.
-It has been extended for these reasons,
-as described above.
-This format first appeared in 4.4BSD.
-.Sh COMPATIBILITY
-No archive format is currently specified by any standard.
-.At V
-has historically distributed archives in a different format from
-all of the above.
diff --git a/usr.bin/bdes/Makefile b/usr.bin/bdes/Makefile
deleted file mode 100644
index 9166f72..0000000
--- a/usr.bin/bdes/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= bdes
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/bdes/bdes.1 b/usr.bin/bdes/bdes.1
deleted file mode 100644
index eecd81b..0000000
--- a/usr.bin/bdes/bdes.1
+++ /dev/null
@@ -1,304 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Matt Bishop of Dartmouth College.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce 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.
-.\"
-.\" @(#)bdes.1 8.1 (Berkeley) 6/29/93
-.\"
-.TH BDES 1 "June 29, 1993"
-.UC 6
-.SH NAME
-bdes \- encrypt/decrypt using the Data Encryption Standard
-.SH SYNOPSIS
-.nf
-.ft B
-bdes [ \-abdp ] [ \-F N ] [ \-f N ] [ \-k key ]
-.ti +5
-[ \-m N ] [ \-o N ] [ \-v vector ]
-.ft R
-.fi
-.SH DESCRIPTION
-.I Bdes
-implements all DES modes of operation described in FIPS PUB 81,
-including alternative cipher feedback mode and both authentication
-modes.
-.I Bdes
-reads from the standard input and writes to the standard output.
-By default, the input is encrypted using cipher block chaining mode.
-Using the same key for encryption and decryption preserves plain text.
-.PP
-All modes but the electronic code book mode require an initialization
-vector; if none is supplied, the zero vector is used.
-If no
-.I key
-is specified on the command line, the user is prompted for one (see
-.IR getpass (3)
-for more details).
-.PP
-The options are as follows:
-.TP
-\-a
-The key and initialization vector strings are to be taken as ASCII,
-suppressing the special interpretation given to leading ``0X'', ``0x'',
-``0B'', and ``0b'' characters.
-This flag applies to
-.I both
-the key and initialization vector.
-.TP
-\-b
-Use electronic code book mode.
-.TP
-\-d
-Decrypt the input.
-.TP
-\-F
-Use
-.IR N -bit
-alternative cipher feedback mode.
-Currently
-.I N
-must be a multiple of 7 between 7 and 56 inclusive (this does not conform
-to the alternative CFB mode specification).
-.TP
-\-f
-Use
-.IR N -bit
-cipher feedback mode.
-Currently
-.I N
-must be a multiple of 8 between 8 and 64 inclusive (this does not conform
-to the standard CFB mode specification).
-.TP
-\-k
-Use
-.I key
-as the cryptographic key.
-.TP
-\-m
-Compute a message authentication code (MAC) of
-.I N
-bits on the input.
-The value of
-.I N
-must be between 1 and 64 inclusive; if
-.I N
-is not a multiple of 8, enough 0 bits will be added to pad the MAC length
-to the nearest multiple of 8.
-Only the MAC is output.
-MACs are only available in cipher block chaining mode or in cipher feedback
-mode.
-.TP
-\-o
-Use
-.IR N -bit
-output feedback mode.
-Currently
-.I N
-must be a multiple of 8 between 8 and 64 inclusive (this does not conform
-to the OFB mode specification).
-.TP
-\-p
-Disable the resetting of the parity bit.
-This flag forces the parity bit of the key to be used as typed, rather than
-making each character be of odd parity.
-It is used only if the key is given in ASCII.
-.TP
-\-v
-Set the initialization vector to
-.IR vector ;
-the vector is interpreted in the same way as the key.
-The vector is ignored in electronic codebook mode.
-.PP
-The key and initialization vector are taken as sequences of ASCII
-characters which are then mapped into their bit representations.
-If either begins with ``0X'' or ``0x'',
-that one is taken as a sequence of hexadecimal digits indicating the
-bit pattern;
-if either begins with ``0B'' or ``0b'',
-that one is taken as a sequence of binary digits indicating the bit pattern.
-In either case,
-only the leading 64 bits of the key or initialization vector
-are used,
-and if fewer than 64 bits are provided, enough 0 bits are appended
-to pad the key to 64 bits.
-.PP
-According to the DES standard, the low-order bit of each character in the
-key string is deleted.
-Since most ASCII representations set the high-order bit to 0, simply
-deleting the low-order bit effectively reduces the size of the key space
-from 2\u\s-356\s0\d to 2\u\s-348\s0\d keys.
-To prevent this, the high-order bit must be a function depending in part
-upon the low-order bit; so, the high-order bit is set to whatever value
-gives odd parity.
-This preserves the key space size.
-Note this resetting of the parity bit is
-.I not
-done if the key is given in binary or hex, and can be disabled for ASCII
-keys as well.
-.PP
-The DES is considered a very strong cryptosystem, and other than table lookup
-attacks, key search attacks, and Hellman's time-memory tradeoff (all of which
-are very expensive and time-consuming), no cryptanalytic methods for breaking
-the DES are known in the open literature.
-No doubt the choice of keys and key security are the most vulnerable aspect
-of
-.IR bdes .
-.SH IMPLEMENTATION NOTES
-For implementors wishing to write software compatible with this program,
-the following notes are provided.
-This software is believed to be compatible with the implementation of the
-data encryption standard distributed by Sun Microsystems, Inc.
-.PP
-In the ECB and CBC modes, plaintext is encrypted in units of 64 bits (8 bytes,
-also called a block).
-To ensure that the plaintext file is encrypted correctly,
-.I bdes
-will (internally) append from 1 to 8 bytes, the last byte containing an
-integer stating how many bytes of that final block are from the plaintext
-file, and encrypt the resulting block.
-Hence, when decrypting, the last block may contain from 0 to 7 characters
-present in the plaintext file, and the last byte tells how many.
-Note that if during decryption the last byte of the file does not contain an
-integer between 0 and 7, either the file has been corrupted or an incorrect
-key has been given.
-A similar mechanism is used for the OFB and CFB modes, except that those
-simply require the length of the input to be a multiple of the mode size,
-and the final byte contains an integer between 0 and one less than the number
-of bytes being used as the mode.
-(This was another reason that the mode size must be a multiple of 8 for those
-modes.)
-.PP
-Unlike Sun's implementation, unused bytes of that last block are not filled
-with random data, but instead contain what was in those byte positions in
-the preceding block.
-This is quicker and more portable, and does not weaken the encryption
-significantly.
-.PP
-If the key is entered in ASCII, the parity bits of the key characters are set
-so that each key character is of odd parity.
-Unlike Sun's implementation, it is possible to enter binary or hexadecimal
-keys on the command line, and if this is done, the parity bits are
-.I not
-reset.
-This allows testing using arbitrary bit patterns as keys.
-.PP
-The Sun implementation always uses an initialization vector of 0
-(that is, all zeroes).
-By default,
-.I bdes
-does too, but this may be changed from the command line.
-.SH SEE ALSO
-crypt(1), crypt(3), getpass(3)
-.sp
-.IR "Data Encryption Standard" ,
-Federal Information Processing Standard #46,
-National Bureau of Standards,
-U.S. Department of Commerce,
-Washington DC
-(Jan. 1977)
-.sp
-.IR "DES Modes of Operation" ,
-Federal Information Processing Standard #81,
-National Bureau of Standards,
-U.S. Department of Commerce
-Washington DC
-(Dec. 1980)
-.sp
-Dorothy Denning,
-.IR "Cryptography and Data Security" ,
-Addison-Wesley Publishing Co.,
-Reading, MA
-\(co1982.
-.sp
-Matt Bishop,
-.IR "Implementation Notes on bdes(1)" ,
-Technical Report PCS-TR-91-158,
-Department of Mathematics and Computer Science,
-Dartmouth College,
-Hanover, NH 03755
-(Apr. 1991).
-.SH DISCLAIMER
-.nf
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-.fi
-.SH BUGS
-There is a controversy raging over whether the DES will still be secure
-in a few years.
-The advent of special-purpose hardware could reduce the cost of any of the
-methods of attack named above so that they are no longer computationally
-infeasible.
-.PP
-As the key or key schedule is stored in memory, the encryption can be
-compromised if memory is readable.
-Additionally, programs which display programs' arguments may compromise the
-key and initialization vector, if they are specified on the command line.
-To avoid this
-.I bdes
-overwrites its arguments, however, the obvious race cannot currently be
-avoided.
-.PP
-Certain specific keys should be avoided because they introduce potential
-weaknesses; these keys, called the
-.I weak
-and
-.I semiweak
-keys, are (in hex notation, where p is either 0 or 1, and P is either
-e or f):
-.sp
-.nf
-.in +10n
-.ta \w'0x0p0p0p0p0p0p0p0p\0\0\0'u+5n
-0x0p0p0p0p0p0p0p0p 0x0p1P0p1P0p0P0p0P
-0x0pep0pep0pfp0pfp 0x0pfP0pfP0pfP0pfP
-0x1P0p1P0p0P0p0P0p 0x1P1P1P1P0P0P0P0P
-0x1Pep1Pep0Pfp0Pfp 0x1PfP1PfP0PfP0PfP
-0xep0pep0pfp0pfp0p 0xep1Pep1pfp0Pfp0P
-0xepepepepepepepep 0xepfPepfPfpfPfpfP
-0xfP0pfP0pfP0pfP0p 0xfP1PfP1PfP0PfP0P
-0xfPepfPepfPepfPep 0xfPfPfPfPfPfPfPfP
-.fi
-.in -10n
-.sp
-This is inherent in the DES algorithm (see Moore and Simmons,
-\*(LqCycle structure of the DES with weak and semi-weak keys,\*(Rq
-.I "Advances in Cryptology \- Crypto '86 Proceedings" ,
-Springer-Verlag New York, \(co1987, pp. 9-32.)
diff --git a/usr.bin/bdes/bdes.c b/usr.bin/bdes/bdes.c
deleted file mode 100644
index f702e01..0000000
--- a/usr.bin/bdes/bdes.c
+++ /dev/null
@@ -1,1046 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Matt Bishop of Dartmouth College.
- *
- * The United States Government has rights in this work pursuant
- * to contract no. NAG 2-680 between the National Aeronautics and
- * Space Administration and Dartmouth College.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)bdes.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * BDES -- DES encryption package for Berkeley Software Distribution 4.4
- * options:
- * -a key is in ASCII
- * -b use ECB (electronic code book) mode
- * -d invert (decrypt) input
- * -f b use b-bit CFB (cipher feedback) mode
- * -F b use b-bit CFB (cipher feedback) alternative mode
- * -k key use key as the cryptographic key
- * -m b generate a MAC of length b
- * -o b use b-bit OFB (output feedback) mode
- * -p don't reset the parity bit
- * -v v use v as the initialization vector (ignored for ECB)
- * note: the last character of the last block is the integer indicating
- * how many characters of that block are to be output
- *
- * Author: Matt Bishop
- * Department of Mathematics and Computer Science
- * Dartmouth College
- * Hanover, NH 03755
- * Email: Matt.Bishop@dartmouth.edu
- * ...!decvax!dartvax!Matt.Bishop
- *
- * See Technical Report PCS-TR91-158, Department of Mathematics and Computer
- * Science, Dartmouth College, for a detailed description of the implemen-
- * tation and differences between it and Sun's. The DES is described in
- * FIPS PUB 46, and the modes in FIPS PUB 81 (see either the manual page
- * or the technical report for a complete reference).
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-/*
- * BSD and System V systems offer special library calls that do
- * block moves and fills, so if possible we take advantage of them
- */
-#define MEMCPY(dest,src,len) bcopy((src),(dest),(len))
-#define MEMZERO(dest,len) bzero((dest),(len))
-
-/* Hide the calls to the primitive encryption routines. */
-#define FASTWAY
-#ifdef FASTWAY
-#define DES_KEY(buf) \
- if (des_setkey(buf)) \
- err("des_setkey", 0);
-#define DES_XFORM(buf) \
- if (des_cipher(buf, buf, 0L, (inverse ? -1 : 1))) \
- err("des_cipher", 0);
-#else
-#define DES_KEY(buf) { \
- char bits1[64]; /* bits of key */ \
- expand(buf, bits1); \
- if (setkey(bits1)) \
- err("setkey", 0); \
- }
-#define DES_XFORM(buf) { \
- char bits1[64]; /* bits of message */ \
- expand(buf, bits1); \
- if (encrypt(bits1, inverse)) \
- err("encrypt", 0); \
- compress(bits1, buf); \
- }
-#endif
-
-/*
- * this does an error-checking write
- */
-#define READ(buf, n) fread(buf, sizeof(char), n, stdin)
-#define WRITE(buf,n) \
- if (fwrite(buf, sizeof(char), n, stdout) != n) \
- err(bn, NULL);
-
-/*
- * some things to make references easier
- */
-typedef char Desbuf[8];
-#define CHAR(x,i) (x[i])
-#define UCHAR(x,i) (x[i])
-#define BUFFER(x) (x)
-#define UBUFFER(x) (x)
-
-/*
- * global variables and related macros
- */
-#define KEY_DEFAULT 0 /* interpret radix of key from key */
-#define KEY_ASCII 1 /* key is in ASCII characters */
-int keybase = KEY_DEFAULT; /* how to interpret the key */
-
-enum { /* encrypt, decrypt, authenticate */
- MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE
-} mode = MODE_ENCRYPT;
-enum { /* ecb, cbc, cfb, cfba, ofb? */
- ALG_ECB, ALG_CBC, ALG_CFB, ALG_OFB, ALG_CFBA
-} alg = ALG_CBC;
-
-Desbuf ivec; /* initialization vector */
-char bits[] = { /* used to extract bits from a char */
- '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001'
-};
-int inverse; /* 0 to encrypt, 1 to decrypt */
-int macbits = -1; /* number of bits in authentication */
-int fbbits = -1; /* number of feedback bits */
-int pflag; /* 1 to preserve parity bits */
-
-main(ac, av)
- int ac; /* arg count */
- char **av; /* arg vector */
-{
- extern int optind; /* option (argument) number */
- extern char *optarg; /* argument to option if any */
- register int i; /* counter in a for loop */
- register char *p; /* used to obtain the key */
- Desbuf msgbuf; /* I/O buffer */
- int kflag; /* command-line encryptiooon key */
- int argc; /* the real arg count */
- char **argv; /* the real argument vector */
-
- /*
- * Hide the arguments from ps(1) by making private copies of them
- * and clobbering the global (visible to ps(1)) ones.
- */
- argc = ac;
- ac = 1;
- argv = malloc((argc + 1) * sizeof(char *));
- for (i = 0; i < argc; ++i) {
- argv[i] = strdup(av[i]);
- MEMZERO(av[i], strlen(av[i]));
- }
- argv[argc] = NULL;
-
- /* initialize the initialization vctor */
- MEMZERO(ivec, 8);
-
- /* process the argument list */
- kflag = 0;
- while ((i = getopt(argc, argv, "abdF:f:k:m:o:pv:")) != EOF)
- switch(i) {
- case 'a': /* key is ASCII */
- keybase = KEY_ASCII;
- break;
- case 'b': /* use ECB mode */
- alg = ALG_ECB;
- break;
- case 'd': /* decrypt */
- mode = MODE_DECRYPT;
- break;
- case 'F': /* use alternative CFB mode */
- alg = ALG_CFBA;
- if ((fbbits = setbits(optarg, 7)) > 56 || fbbits == 0)
- err(-1, "-F: number must be 1-56 inclusive");
- else if (fbbits == -1)
- err(-1, "-F: number must be a multiple of 7");
- break;
- case 'f': /* use CFB mode */
- alg = ALG_CFB;
- if ((fbbits = setbits(optarg, 8)) > 64 || fbbits == 0)
- err(-1, "-f: number must be 1-64 inclusive");
- else if (fbbits == -1)
- err(-1, "-f: number must be a multiple of 8");
- break;
- case 'k': /* encryption key */
- kflag = 1;
- cvtkey(BUFFER(msgbuf), optarg);
- break;
- case 'm': /* number of bits for MACing */
- mode = MODE_AUTHENTICATE;
- if ((macbits = setbits(optarg, 1)) > 64)
- err(-1, "-m: number must be 0-64 inclusive");
- break;
- case 'o': /* use OFB mode */
- alg = ALG_OFB;
- if ((fbbits = setbits(optarg, 8)) > 64 || fbbits == 0)
- err(-1, "-o: number must be 1-64 inclusive");
- else if (fbbits == -1)
- err(-1, "-o: number must be a multiple of 8");
- break;
- case 'p': /* preserve parity bits */
- pflag = 1;
- break;
- case 'v': /* set initialization vector */
- cvtkey(BUFFER(ivec), optarg);
- break;
- default: /* error */
- usage();
- }
-
- if (!kflag) {
- /*
- * if the key's not ASCII, assume it is
- */
- keybase = KEY_ASCII;
- /*
- * get the key
- */
- p = getpass("Enter key: ");
- /*
- * copy it, nul-padded, into the key area
- */
- cvtkey(BUFFER(msgbuf), p);
- }
-
- makekey(msgbuf);
- inverse = (alg == ALG_CBC || alg == ALG_ECB) && mode == MODE_DECRYPT;
-
- switch(alg) {
- case ALG_CBC:
- switch(mode) {
- case MODE_AUTHENTICATE: /* authenticate using CBC mode */
- cbcauth();
- break;
- case MODE_DECRYPT: /* decrypt using CBC mode */
- cbcdec();
- break;
- case MODE_ENCRYPT: /* encrypt using CBC mode */
- cbcenc();
- break;
- }
- break;
- case ALG_CFB:
- switch(mode) {
- case MODE_AUTHENTICATE: /* authenticate using CFB mode */
- cfbauth();
- break;
- case MODE_DECRYPT: /* decrypt using CFB mode */
- cfbdec();
- break;
- case MODE_ENCRYPT: /* encrypt using CFB mode */
- cfbenc();
- break;
- }
- break;
- case ALG_CFBA:
- switch(mode) {
- case MODE_AUTHENTICATE: /* authenticate using CFBA mode */
- err(-1, "can't authenticate with CFBA mode");
- break;
- case MODE_DECRYPT: /* decrypt using CFBA mode */
- cfbadec();
- break;
- case MODE_ENCRYPT: /* encrypt using CFBA mode */
- cfbaenc();
- break;
- }
- break;
- case ALG_ECB:
- switch(mode) {
- case MODE_AUTHENTICATE: /* authenticate using ECB mode */
- err(-1, "can't authenticate with ECB mode");
- break;
- case MODE_DECRYPT: /* decrypt using ECB mode */
- ecbdec();
- break;
- case MODE_ENCRYPT: /* encrypt using ECB mode */
- ecbenc();
- break;
- }
- break;
- case ALG_OFB:
- switch(mode) {
- case MODE_AUTHENTICATE: /* authenticate using OFB mode */
- err(-1, "can't authenticate with OFB mode");
- break;
- case MODE_DECRYPT: /* decrypt using OFB mode */
- ofbdec();
- break;
- case MODE_ENCRYPT: /* encrypt using OFB mode */
- ofbenc();
- break;
- }
- break;
- }
- exit(0);
-}
-
-/*
- * print a warning message and, possibly, terminate
- */
-err(n, s)
- int n; /* offending block number */
- char *s; /* the message */
-{
- if (n > 0)
- (void)fprintf(stderr, "bdes (block %d): ", n);
- else
- (void)fprintf(stderr, "bdes: ");
- (void)fprintf(stderr, "%s\n", s ? s : strerror(errno));
- exit(1);
-}
-
-/*
- * map a hex character to an integer
- */
-tobinhex(c, radix)
- char c; /* char to be converted */
- int radix; /* base (2 to 16) */
-{
- switch(c) {
- case '0': return(0x0);
- case '1': return(0x1);
- case '2': return(radix > 2 ? 0x2 : -1);
- case '3': return(radix > 3 ? 0x3 : -1);
- case '4': return(radix > 4 ? 0x4 : -1);
- case '5': return(radix > 5 ? 0x5 : -1);
- case '6': return(radix > 6 ? 0x6 : -1);
- case '7': return(radix > 7 ? 0x7 : -1);
- case '8': return(radix > 8 ? 0x8 : -1);
- case '9': return(radix > 9 ? 0x9 : -1);
- case 'A': case 'a': return(radix > 10 ? 0xa : -1);
- case 'B': case 'b': return(radix > 11 ? 0xb : -1);
- case 'C': case 'c': return(radix > 12 ? 0xc : -1);
- case 'D': case 'd': return(radix > 13 ? 0xd : -1);
- case 'E': case 'e': return(radix > 14 ? 0xe : -1);
- case 'F': case 'f': return(radix > 15 ? 0xf : -1);
- }
- /*
- * invalid character
- */
- return(-1);
-}
-
-/*
- * convert the key to a bit pattern
- */
-cvtkey(obuf, ibuf)
- char *obuf; /* bit pattern */
- char *ibuf; /* the key itself */
-{
- register int i, j; /* counter in a for loop */
- int nbuf[64]; /* used for hex/key translation */
-
- /*
- * just switch on the key base
- */
- switch(keybase) {
- case KEY_ASCII: /* ascii to integer */
- (void)strncpy(obuf, ibuf, 8);
- return;
- case KEY_DEFAULT: /* tell from context */
- /*
- * leading '0x' or '0X' == hex key
- */
- if (ibuf[0] == '0' && (ibuf[1] == 'x' || ibuf[1] == 'X')) {
- ibuf = &ibuf[2];
- /*
- * now translate it, bombing on any illegal hex digit
- */
- for (i = 0; ibuf[i] && i < 16; i++)
- if ((nbuf[i] = tobinhex(ibuf[i], 16)) == -1)
- err(-1, "bad hex digit in key");
- while (i < 16)
- nbuf[i++] = 0;
- for (i = 0; i < 8; i++)
- obuf[i] =
- ((nbuf[2*i]&0xf)<<4) | (nbuf[2*i+1]&0xf);
- /* preserve parity bits */
- pflag = 1;
- return;
- }
- /*
- * leading '0b' or '0B' == binary key
- */
- if (ibuf[0] == '0' && (ibuf[1] == 'b' || ibuf[1] == 'B')) {
- ibuf = &ibuf[2];
- /*
- * now translate it, bombing on any illegal binary digit
- */
- for (i = 0; ibuf[i] && i < 16; i++)
- if ((nbuf[i] = tobinhex(ibuf[i], 2)) == -1)
- err(-1, "bad binary digit in key");
- while (i < 64)
- nbuf[i++] = 0;
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- obuf[i] = (obuf[i]<<1)|nbuf[8*i+j];
- /* preserve parity bits */
- pflag = 1;
- return;
- }
- /*
- * no special leader -- ASCII
- */
- (void)strncpy(obuf, ibuf, 8);
- }
-}
-
-/*
- * convert an ASCII string into a decimal number:
- * 1. must be between 0 and 64 inclusive
- * 2. must be a valid decimal number
- * 3. must be a multiple of mult
- */
-setbits(s, mult)
- char *s; /* the ASCII string */
- int mult; /* what it must be a multiple of */
-{
- register char *p; /* pointer in a for loop */
- register int n = 0; /* the integer collected */
-
- /*
- * skip white space
- */
- while (isspace(*s))
- s++;
- /*
- * get the integer
- */
- for (p = s; *p; p++) {
- if (isdigit(*p))
- n = n * 10 + *p - '0';
- else {
- err(-1, "bad decimal digit in MAC length");
- }
- }
- /*
- * be sure it's a multiple of mult
- */
- return((n % mult != 0) ? -1 : n);
-}
-
-/*****************
- * DES FUNCTIONS *
- *****************/
-/*
- * This sets the DES key and (if you're using the deszip version)
- * the direction of the transformation. This uses the Sun
- * to map the 64-bit key onto the 56 bits that the key schedule
- * generation routines use: the old way, which just uses the user-
- * supplied 64 bits as is, and the new way, which resets the parity
- * bit to be the same as the low-order bit in each character. The
- * new way generates a greater variety of key schedules, since many
- * systems set the parity (high) bit of each character to 0, and the
- * DES ignores the low order bit of each character.
- */
-makekey(buf)
- Desbuf buf; /* key block */
-{
- register int i, j; /* counter in a for loop */
- register int par; /* parity counter */
-
- /*
- * if the parity is not preserved, flip it
- */
- if (!pflag) {
- for (i = 0; i < 8; i++) {
- par = 0;
- for (j = 1; j < 8; j++)
- if ((bits[j]&UCHAR(buf, i)) != 0)
- par++;
- if ((par&01) == 01)
- UCHAR(buf, i) = UCHAR(buf, i)&0177;
- else
- UCHAR(buf, i) = (UCHAR(buf, i)&0177)|0200;
- }
- }
-
- DES_KEY(UBUFFER(buf));
-}
-
-/*
- * This encrypts using the Electronic Code Book mode of DES
- */
-ecbenc()
-{
- register int n; /* number of bytes actually read */
- register int bn; /* block number */
- Desbuf msgbuf; /* I/O buffer */
-
- for (bn = 0; (n = READ(BUFFER(msgbuf), 8)) == 8; bn++) {
- /*
- * do the transformation
- */
- DES_XFORM(UBUFFER(msgbuf));
- WRITE(BUFFER(msgbuf), 8);
- }
- /*
- * at EOF or last block -- in either ase, the last byte contains
- * the character representation of the number of bytes in it
- */
- bn++;
- MEMZERO(&CHAR(msgbuf, n), 8 - n);
- CHAR(msgbuf, 7) = n;
- DES_XFORM(UBUFFER(msgbuf));
- WRITE(BUFFER(msgbuf), 8);
-
-}
-
-/*
- * This decrypts using the Electronic Code Book mode of DES
- */
-ecbdec()
-{
- register int n; /* number of bytes actually read */
- register int c; /* used to test for EOF */
- register int bn; /* block number */
- Desbuf msgbuf; /* I/O buffer */
-
- for (bn = 1; (n = READ(BUFFER(msgbuf), 8)) == 8; bn++) {
- /*
- * do the transformation
- */
- DES_XFORM(UBUFFER(msgbuf));
- /*
- * if the last one, handle it specially
- */
- if ((c = getchar()) == EOF) {
- n = CHAR(msgbuf, 7);
- if (n < 0 || n > 7)
- err(bn, "decryption failed (block corrupted)");
- }
- else
- (void)ungetc(c, stdin);
- WRITE(BUFFER(msgbuf), n);
- }
- if (n > 0)
- err(bn, "decryption failed (incomplete block)");
-}
-
-/*
- * This encrypts using the Cipher Block Chaining mode of DES
- */
-cbcenc()
-{
- register int n; /* number of bytes actually read */
- register int bn; /* block number */
- Desbuf msgbuf; /* I/O buffer */
-
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(BUFFER(msgbuf), 8)) == 8; bn++) {
- for (n = 0; n < 8; n++)
- CHAR(msgbuf, n) ^= CHAR(ivec, n);
- DES_XFORM(UBUFFER(msgbuf));
- MEMCPY(BUFFER(ivec), BUFFER(msgbuf), 8);
- WRITE(BUFFER(msgbuf), 8);
- }
- /*
- * at EOF or last block -- in either case, the last byte contains
- * the character representation of the number of bytes in it
- */
- bn++;
- MEMZERO(&CHAR(msgbuf, n), 8 - n);
- CHAR(msgbuf, 7) = n;
- for (n = 0; n < 8; n++)
- CHAR(msgbuf, n) ^= CHAR(ivec, n);
- DES_XFORM(UBUFFER(msgbuf));
- WRITE(BUFFER(msgbuf), 8);
-
-}
-
-/*
- * This decrypts using the Cipher Block Chaining mode of DES
- */
-cbcdec()
-{
- register int n; /* number of bytes actually read */
- Desbuf msgbuf; /* I/O buffer */
- Desbuf ibuf; /* temp buffer for initialization vector */
- register int c; /* used to test for EOF */
- register int bn; /* block number */
-
- for (bn = 0; (n = READ(BUFFER(msgbuf), 8)) == 8; bn++) {
- /*
- * do the transformation
- */
- MEMCPY(BUFFER(ibuf), BUFFER(msgbuf), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (c = 0; c < 8; c++)
- UCHAR(msgbuf, c) ^= UCHAR(ivec, c);
- MEMCPY(BUFFER(ivec), BUFFER(ibuf), 8);
- /*
- * if the last one, handle it specially
- */
- if ((c = getchar()) == EOF) {
- n = CHAR(msgbuf, 7);
- if (n < 0 || n > 7)
- err(bn, "decryption failed (block corrupted)");
- }
- else
- (void)ungetc(c, stdin);
- WRITE(BUFFER(msgbuf), n);
- }
- if (n > 0)
- err(bn, "decryption failed (incomplete block)");
-}
-
-/*
- * This authenticates using the Cipher Block Chaining mode of DES
- */
-cbcauth()
-{
- register int n, j; /* number of bytes actually read */
- Desbuf msgbuf; /* I/O buffer */
- Desbuf encbuf; /* encryption buffer */
-
- /*
- * do the transformation
- * note we DISCARD the encrypted block;
- * we only care about the last one
- */
- while ((n = READ(BUFFER(msgbuf), 8)) == 8) {
- for (n = 0; n < 8; n++)
- CHAR(encbuf, n) = CHAR(msgbuf, n) ^ CHAR(ivec, n);
- DES_XFORM(UBUFFER(encbuf));
- MEMCPY(BUFFER(ivec), BUFFER(encbuf), 8);
- }
- /*
- * now compute the last one, right padding with '\0' if need be
- */
- if (n > 0) {
- MEMZERO(&CHAR(msgbuf, n), 8 - n);
- for (n = 0; n < 8; n++)
- CHAR(encbuf, n) = CHAR(msgbuf, n) ^ CHAR(ivec, n);
- DES_XFORM(UBUFFER(encbuf));
- }
- /*
- * drop the bits
- * we write chars until fewer than 7 bits,
- * and then pad the last one with 0 bits
- */
- for (n = 0; macbits > 7; n++, macbits -= 8)
- (void)putchar(CHAR(encbuf, n));
- if (macbits > 0) {
- CHAR(msgbuf, 0) = 0x00;
- for (j = 0; j < macbits; j++)
- CHAR(msgbuf, 0) |= (CHAR(encbuf, n)&bits[j]);
- (void)putchar(CHAR(msgbuf, 0));
- }
-}
-
-/*
- * This encrypts using the Cipher FeedBack mode of DES
- */
-cfbenc()
-{
- register int n; /* number of bytes actually read */
- register int nbytes; /* number of bytes to read */
- register int bn; /* block number */
- char ibuf[8]; /* input buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 8;
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(ibuf, nbytes)) == nbytes; bn++) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < 8 - nbytes; n++)
- UCHAR(ivec, n) = UCHAR(ivec, n+nbytes);
- for (n = 0; n < nbytes; n++)
- UCHAR(ivec, 8-nbytes+n) = ibuf[n] ^ UCHAR(msgbuf, n);
- WRITE(&CHAR(ivec, 8-nbytes), nbytes);
- }
- /*
- * at EOF or last block -- in either case, the last byte contains
- * the character representation of the number of bytes in it
- */
- bn++;
- MEMZERO(&ibuf[n], nbytes - n);
- ibuf[nbytes - 1] = n;
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < nbytes; n++)
- ibuf[n] ^= UCHAR(msgbuf, n);
- WRITE(ibuf, nbytes);
-}
-
-/*
- * This decrypts using the Cipher Block Chaining mode of DES
- */
-cfbdec()
-{
- register int n; /* number of bytes actually read */
- register int c; /* used to test for EOF */
- register int nbytes; /* number of bytes to read */
- register int bn; /* block number */
- char ibuf[8]; /* input buffer */
- char obuf[8]; /* output buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 8;
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(ibuf, nbytes)) == nbytes; bn++) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (c = 0; c < 8 - nbytes; c++)
- CHAR(ivec, c) = CHAR(ivec, c+nbytes);
- for (c = 0; c < nbytes; c++) {
- CHAR(ivec, 8-nbytes+c) = ibuf[c];
- obuf[c] = ibuf[c] ^ UCHAR(msgbuf, c);
- }
- /*
- * if the last one, handle it specially
- */
- if ((c = getchar()) == EOF) {
- n = obuf[nbytes-1];
- if (n < 0 || n > nbytes-1)
- err(bn, "decryption failed (block corrupted)");
- }
- else
- (void)ungetc(c, stdin);
- WRITE(obuf, n);
- }
- if (n > 0)
- err(bn, "decryption failed (incomplete block)");
-}
-
-/*
- * This encrypts using the alternative Cipher FeedBack mode of DES
- */
-cfbaenc()
-{
- register int n; /* number of bytes actually read */
- register int nbytes; /* number of bytes to read */
- register int bn; /* block number */
- char ibuf[8]; /* input buffer */
- char obuf[8]; /* output buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 7;
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(ibuf, nbytes)) == nbytes; bn++) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < 8 - nbytes; n++)
- UCHAR(ivec, n) = UCHAR(ivec, n+nbytes);
- for (n = 0; n < nbytes; n++)
- UCHAR(ivec, 8-nbytes+n) = (ibuf[n] ^ UCHAR(msgbuf, n))
- |0200;
- for (n = 0; n < nbytes; n++)
- obuf[n] = CHAR(ivec, 8-nbytes+n)&0177;
- WRITE(obuf, nbytes);
- }
- /*
- * at EOF or last block -- in either case, the last byte contains
- * the character representation of the number of bytes in it
- */
- bn++;
- MEMZERO(&ibuf[n], nbytes - n);
- ibuf[nbytes - 1] = ('0' + n)|0200;
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < nbytes; n++)
- ibuf[n] ^= UCHAR(msgbuf, n);
- WRITE(ibuf, nbytes);
-}
-
-/*
- * This decrypts using the alternative Cipher Block Chaining mode of DES
- */
-cfbadec()
-{
- register int n; /* number of bytes actually read */
- register int c; /* used to test for EOF */
- register int nbytes; /* number of bytes to read */
- register int bn; /* block number */
- char ibuf[8]; /* input buffer */
- char obuf[8]; /* output buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 7;
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(ibuf, nbytes)) == nbytes; bn++) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (c = 0; c < 8 - nbytes; c++)
- CHAR(ivec, c) = CHAR(ivec, c+nbytes);
- for (c = 0; c < nbytes; c++) {
- CHAR(ivec, 8-nbytes+c) = ibuf[c]|0200;
- obuf[c] = (ibuf[c] ^ UCHAR(msgbuf, c))&0177;
- }
- /*
- * if the last one, handle it specially
- */
- if ((c = getchar()) == EOF) {
- if ((n = (obuf[nbytes-1] - '0')) < 0
- || n > nbytes-1)
- err(bn, "decryption failed (block corrupted)");
- }
- else
- (void)ungetc(c, stdin);
- WRITE(obuf, n);
- }
- if (n > 0)
- err(bn, "decryption failed (incomplete block)");
-}
-
-
-/*
- * This encrypts using the Output FeedBack mode of DES
- */
-ofbenc()
-{
- register int n; /* number of bytes actually read */
- register int c; /* used to test for EOF */
- register int nbytes; /* number of bytes to read */
- register int bn; /* block number */
- char ibuf[8]; /* input buffer */
- char obuf[8]; /* output buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 8;
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(ibuf, nbytes)) == nbytes; bn++) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < 8 - nbytes; n++)
- UCHAR(ivec, n) = UCHAR(ivec, n+nbytes);
- for (n = 0; n < nbytes; n++) {
- UCHAR(ivec, 8-nbytes+n) = UCHAR(msgbuf, n);
- obuf[n] = ibuf[n] ^ UCHAR(msgbuf, n);
- }
- WRITE(obuf, nbytes);
- }
- /*
- * at EOF or last block -- in either case, the last byte contains
- * the character representation of the number of bytes in it
- */
- bn++;
- MEMZERO(&ibuf[n], nbytes - n);
- ibuf[nbytes - 1] = n;
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (c = 0; c < nbytes; c++)
- ibuf[c] ^= UCHAR(msgbuf, c);
- WRITE(ibuf, nbytes);
-}
-
-/*
- * This decrypts using the Output Block Chaining mode of DES
- */
-ofbdec()
-{
- register int n; /* number of bytes actually read */
- register int c; /* used to test for EOF */
- register int nbytes; /* number of bytes to read */
- register int bn; /* block number */
- char ibuf[8]; /* input buffer */
- char obuf[8]; /* output buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 8;
- /*
- * do the transformation
- */
- for (bn = 1; (n = READ(ibuf, nbytes)) == nbytes; bn++) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (c = 0; c < 8 - nbytes; c++)
- CHAR(ivec, c) = CHAR(ivec, c+nbytes);
- for (c = 0; c < nbytes; c++) {
- CHAR(ivec, 8-nbytes+c) = UCHAR(msgbuf, c);
- obuf[c] = ibuf[c] ^ UCHAR(msgbuf, c);
- }
- /*
- * if the last one, handle it specially
- */
- if ((c = getchar()) == EOF) {
- n = obuf[nbytes-1];
- if (n < 0 || n > nbytes-1)
- err(bn, "decryption failed (block corrupted)");
- }
- else
- (void)ungetc(c, stdin);
- /*
- * dump it
- */
- WRITE(obuf, n);
- }
- if (n > 0)
- err(bn, "decryption failed (incomplete block)");
-}
-
-/*
- * This authenticates using the Cipher FeedBack mode of DES
- */
-cfbauth()
-{
- register int n, j; /* number of bytes actually read */
- register int nbytes; /* number of bytes to read */
- char ibuf[8]; /* input buffer */
- Desbuf msgbuf; /* encryption buffer */
-
- /*
- * do things in bytes, not bits
- */
- nbytes = fbbits / 8;
- /*
- * do the transformation
- */
- while ((n = READ(ibuf, nbytes)) == nbytes) {
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < 8 - nbytes; n++)
- UCHAR(ivec, n) = UCHAR(ivec, n+nbytes);
- for (n = 0; n < nbytes; n++)
- UCHAR(ivec, 8-nbytes+n) = ibuf[n] ^ UCHAR(msgbuf, n);
- }
- /*
- * at EOF or last block -- in either case, the last byte contains
- * the character representation of the number of bytes in it
- */
- MEMZERO(&ibuf[n], nbytes - n);
- ibuf[nbytes - 1] = '0' + n;
- MEMCPY(BUFFER(msgbuf), BUFFER(ivec), 8);
- DES_XFORM(UBUFFER(msgbuf));
- for (n = 0; n < nbytes; n++)
- ibuf[n] ^= UCHAR(msgbuf, n);
- /*
- * drop the bits
- * we write chars until fewer than 7 bits,
- * and then pad the last one with 0 bits
- */
- for (n = 0; macbits > 7; n++, macbits -= 8)
- (void)putchar(CHAR(msgbuf, n));
- if (macbits > 0) {
- CHAR(msgbuf, 0) = 0x00;
- for (j = 0; j < macbits; j++)
- CHAR(msgbuf, 0) |= (CHAR(msgbuf, n)&bits[j]);
- (void)putchar(CHAR(msgbuf, 0));
- }
-}
-
-#ifndef FASTWAY
-/*
- * change from 8 bits/Uchar to 1 bit/Uchar
- */
-expand(from, to)
- Desbuf from; /* 8bit/unsigned char string */
- char *to; /* 1bit/char string */
-{
- register int i, j; /* counters in for loop */
-
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- *to++ = (CHAR(from, i)>>(7-j))&01;
-}
-
-/*
- * change from 1 bit/char to 8 bits/Uchar
- */
-compress(from, to)
- char *from; /* 1bit/char string */
- Desbuf to; /* 8bit/unsigned char string */
-{
- register int i, j; /* counters in for loop */
-
- for (i = 0; i < 8; i++) {
- CHAR(to, i) = 0;
- for (j = 0; j < 8; j++)
- CHAR(to, i) = ((*from++)<<(7-j))|CHAR(to, i);
- }
-}
-#endif
-
-/*
- * message about usage
- */
-usage()
-{
- (void)fprintf(stderr, "%s\n",
-"usage: bdes [-abdp] [-F bit] [-f bit] [-k key] [-m bit] [-o bit] [-v vector]");
- exit(1);
-}
diff --git a/usr.bin/bdes/bdes.ps b/usr.bin/bdes/bdes.ps
deleted file mode 100644
index 471c267..0000000
--- a/usr.bin/bdes/bdes.ps
+++ /dev/null
@@ -1,2945 +0,0 @@
-%!
-%%BoundingBox: (atend)
-%%Pages: (atend)
-%%DocumentFonts: (atend)
-%%EndComments
-%
-% FrameMaker PostScript Prolog 2.0, for use with FrameMaker 2.0
-% Copyright (c) 1986,87,89 by Frame Technology, Inc. All rights reserved.
-%
-% Known Problems:
-% Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1
-/FMversion (2.0) def
-% Set up Color vs. Black-and-White
- /FMPrintInColor systemdict /colorimage known def
-% Uncomment this line to force b&w on color printer
-% /FMPrintInColor false def
-/FrameDict 190 dict def
-systemdict /errordict known not {/errordict 10 dict def
- errordict /rangecheck {stop} put} if
-% The readline in 23.0 doesn't recognize cr's as nl's on AppleTalk
-FrameDict /tmprangecheck errordict /rangecheck get put
-errordict /rangecheck {FrameDict /bug true put} put
-FrameDict /bug false put
-mark
-% Some PS machines read past the CR, so keep the following 3 lines together!
-currentfile 5 string readline
-00
-0000000000
-cleartomark
-errordict /rangecheck FrameDict /tmprangecheck get put
-FrameDict /bug get {
- /readline {
- /gstring exch def
- /gfile exch def
- /gindex 0 def
- {
- gfile read pop
- dup 10 eq {exit} if
- dup 13 eq {exit} if
- gstring exch gindex exch put
- /gindex gindex 1 add def
- } loop
- pop
- gstring 0 gindex getinterval true
- } def
- } if
-/FMVERSION {
- FMversion ne {
- /Times-Roman findfont 18 scalefont setfont
- 100 100 moveto
- (FrameMaker version does not match postscript_prolog!)
- dup =
- show showpage
- } if
- } def
-/FMLOCAL {
- FrameDict begin
- 0 def
- end
- } def
- /gstring FMLOCAL
- /gfile FMLOCAL
- /gindex FMLOCAL
- /orgxfer FMLOCAL
- /orgproc FMLOCAL
- /organgle FMLOCAL
- /orgfreq FMLOCAL
- /yscale FMLOCAL
- /xscale FMLOCAL
- /manualfeed FMLOCAL
- /paperheight FMLOCAL
- /paperwidth FMLOCAL
-/FMDOCUMENT {
- array /FMfonts exch def
- /#copies exch def
- FrameDict begin
- 0 ne dup {setmanualfeed} if
- /manualfeed exch def
- /paperheight exch def
- /paperwidth exch def
- setpapername
- manualfeed {true} {papersize} ifelse
- {manualpapersize} {false} ifelse
- {desperatepapersize} if
- /yscale exch def
- /xscale exch def
- currenttransfer cvlit /orgxfer exch def
- currentscreen cvlit /orgproc exch def
- /organgle exch def /orgfreq exch def
- end
- } def
- /pagesave FMLOCAL
- /orgmatrix FMLOCAL
- /landscape FMLOCAL
-/FMBEGINPAGE {
- FrameDict begin
- /pagesave save def
- 3.86 setmiterlimit
- /landscape exch 0 ne def
- landscape {
- 90 rotate 0 exch neg translate pop
- }
- {pop pop}
- ifelse
- xscale yscale scale
- /orgmatrix matrix def
- gsave
- } def
-/FMENDPAGE {
- grestore
- pagesave restore
- end
- showpage
- } def
-/FMDEFINEFONT {
- FrameDict begin
- findfont
- ReEncode
- 2 index exch
- definefont exch
- scalefont
- FMfonts 3 1 roll
- put
- end
- } bind def
-/FMNORMALIZEGRAPHICS {
- newpath
- 0.0 0.0 moveto
- 1 setlinewidth
- 0 setlinecap
- 0 0 0 sethsbcolor
- 0 setgray
- } bind def
- /fx FMLOCAL
- /fy FMLOCAL
- /fh FMLOCAL
- /fw FMLOCAL
- /llx FMLOCAL
- /lly FMLOCAL
- /urx FMLOCAL
- /ury FMLOCAL
-/FMBEGINEPSF {
- end
- /FMEPSF save def
- /showpage {} def
- FMNORMALIZEGRAPHICS
- [/fy /fx /fh /fw /ury /urx /lly /llx] {exch def} forall
- fx fy translate
- rotate
- fw urx llx sub div fh ury lly sub div scale
- llx neg lly neg translate
- } bind def
-/FMENDEPSF {
- FMEPSF restore
- FrameDict begin
- } bind def
-FrameDict begin
-/setmanualfeed {
-%%BeginFeature *ManualFeed True
- statusdict /manualfeed true put
-%%EndFeature
- } def
-/max {2 copy lt {exch} if pop} bind def
-/min {2 copy gt {exch} if pop} bind def
-/inch {72 mul} def
-/pagedimen {
- paperheight sub abs 16 lt exch
- paperwidth sub abs 16 lt and
- {/papername exch def} {pop} ifelse
- } def
- /papersizedict FMLOCAL
-/setpapername {
- /papersizedict 14 dict def
- papersizedict begin
- /papername /unknown def
- /Letter 8.5 inch 11.0 inch pagedimen
- /LetterSmall 7.68 inch 10.16 inch pagedimen
- /Tabloid 11.0 inch 17.0 inch pagedimen
- /Ledger 17.0 inch 11.0 inch pagedimen
- /Legal 8.5 inch 14.0 inch pagedimen
- /Statement 5.5 inch 8.5 inch pagedimen
- /Executive 7.5 inch 10.0 inch pagedimen
- /A3 11.69 inch 16.5 inch pagedimen
- /A4 8.26 inch 11.69 inch pagedimen
- /A4Small 7.47 inch 10.85 inch pagedimen
- /B4 10.125 inch 14.33 inch pagedimen
- /B5 7.16 inch 10.125 inch pagedimen
- end
- } def
-/papersize {
- papersizedict begin
- /Letter {lettertray} def
- /LetterSmall {lettertray lettersmall} def
- /Tabloid {11x17tray} def
- /Ledger {ledgertray} def
- /Legal {legaltray} def
- /Statement {statementtray} def
- /Executive {executivetray} def
- /A3 {a3tray} def
- /A4 {a4tray} def
- /A4Small {a4tray a4small} def
- /B4 {b4tray} def
- /B5 {b5tray} def
- /unknown {unknown} def
- papersizedict dup papername known {papername} {/unknown} ifelse get
- end
- /FMdicttop countdictstack 1 add def
- statusdict begin stopped end
- countdictstack -1 FMdicttop {pop end} for
- } def
-/manualpapersize {
- papersizedict begin
- /Letter {letter} def
- /LetterSmall {lettersmall} def
- /Tabloid {11x17} def
- /Ledger {ledger} def
- /Legal {legal} def
- /Statement {statement} def
- /Executive {executive} def
- /A3 {a3} def
- /A4 {a4} def
- /A4Small {a4small} def
- /B4 {b4} def
- /B5 {b5} def
- /unknown {unknown} def
- papersizedict dup papername known {papername} {/unknown} ifelse get
- end
- stopped
- } def
-/desperatepapersize {
- statusdict /setpageparams known
- {
- paperwidth paperheight 0 1
- statusdict begin
- {setpageparams} stopped pop
- end
- } if
- } def
-/savematrix {
- orgmatrix currentmatrix pop
- } bind def
-/restorematrix {
- orgmatrix setmatrix
- } bind def
-/dmatrix matrix def
-/dpi 72 0 dmatrix defaultmatrix dtransform
- dup mul exch dup mul add sqrt def
-/freq dpi 18.75 div 8 div round dup 0 eq {pop 1} if 8 mul dpi exch div def
-/sangle 1 0 dmatrix defaultmatrix dtransform exch atan def
-/DiacriticEncoding [
-/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/.notdef /.notdef /.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 /quotesingle /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 /asciicircum /underscore /grave /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 /asciitilde /.notdef /Adieresis /Aring /Ccedilla /Eacute
-/Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis
-/atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis
-/iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve
-/ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex
-/udieresis /dagger /.notdef /cent /sterling /section /bullet
-/paragraph /germandbls /registered /copyright /trademark /acute
-/dieresis /.notdef /AE /Oslash /.notdef /.notdef /.notdef /.notdef
-/yen /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
-/ordfeminine /ordmasculine /.notdef /ae /oslash /questiondown
-/exclamdown /logicalnot /.notdef /florin /.notdef /.notdef
-/guillemotleft /guillemotright /ellipsis /.notdef /Agrave /Atilde
-/Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright
-/quoteleft /quoteright /.notdef /.notdef /ydieresis /Ydieresis
-/fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl
-/periodcentered /quotesinglbase /quotedblbase /perthousand
-/Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute
-/Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve
-/Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron
-/breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron
-] def
-/ReEncode {
- dup
- length
- dict begin
- {
- 1 index /FID ne
- {def}
- {pop pop} ifelse
- } forall
- Encoding StandardEncoding eq
- {
- /Encoding DiacriticEncoding def
- }if
- currentdict
- end
- } bind def
-/graymode true def
- /bwidth FMLOCAL
- /bpside FMLOCAL
- /bstring FMLOCAL
- /onbits FMLOCAL
- /offbits FMLOCAL
- /xindex FMLOCAL
- /yindex FMLOCAL
- /x FMLOCAL
- /y FMLOCAL
-/setpattern {
- /bwidth exch def
- /bpside exch def
- /bstring exch def
- /onbits 0 def /offbits 0 def
- freq sangle landscape {90 add} if
- {/y exch def
- /x exch def
- /xindex x 1 add 2 div bpside mul cvi def
- /yindex y 1 add 2 div bpside mul cvi def
- bstring yindex bwidth mul xindex 8 idiv add get
- 1 7 xindex 8 mod sub bitshift and 0 ne
- {/onbits onbits 1 add def 1}
- {/offbits offbits 1 add def 0}
- ifelse
- }
- setscreen
- {} settransfer
- offbits offbits onbits add div FMsetgray
- /graymode false def
- } bind def
-/grayness {
- FMsetgray
- graymode not {
- /graymode true def
- orgxfer cvx settransfer
- orgfreq organgle orgproc cvx setscreen
- } if
- } bind def
- /HUE FMLOCAL
- /SAT FMLOCAL
- /BRIGHT FMLOCAL
- /Colors FMLOCAL
-FMPrintInColor
-
- {
- /HUE 0 def
- /SAT 0 def
- /BRIGHT 0 def
- % array of arrays Hue and Sat values for the separations [HUE BRIGHT]
- /Colors
- [[0 0 ] % black
- [0 0 ] % white
- [0.00 1.0] % red
- [0.37 1.0] % green
- [0.60 1.0] % blue
- [0.50 1.0] % cyan
- [0.83 1.0] % magenta
- [0.16 1.0] % comment / yellow
- ] def
-
- /BEGINBITMAPCOLOR {
- BITMAPCOLOR} def
- /BEGINBITMAPCOLORc {
- BITMAPCOLORc} def
- /K {
- Colors exch get dup
- 0 get /HUE exch store
- 1 get /BRIGHT exch store
- HUE 0 eq BRIGHT 0 eq and
- {1.0 SAT sub setgray}
- {HUE SAT BRIGHT sethsbcolor}
- ifelse
- } def
- /FMsetgray {
- /SAT exch 1.0 exch sub store
- HUE 0 eq BRIGHT 0 eq and
- {1.0 SAT sub setgray}
- {HUE SAT BRIGHT sethsbcolor}
- ifelse
- } bind def
- }
-
- {
- /BEGINBITMAPCOLOR {
- BITMAPGRAY} def
- /BEGINBITMAPCOLORc {
- BITMAPGRAYc} def
- /FMsetgray {setgray} bind def
- /K {
- pop
- } def
- }
-ifelse
-/normalize {
- transform round exch round exch itransform
- } bind def
-/dnormalize {
- dtransform round exch round exch idtransform
- } bind def
-/lnormalize {
- 0 dtransform exch cvi 2 idiv 2 mul 1 add exch idtransform pop
- } bind def
-/H {
- lnormalize setlinewidth
- } bind def
-/Z {
- setlinecap
- } bind def
-/X {
- fillprocs exch get exec
- } bind def
-/V {
- gsave eofill grestore
- } bind def
-/N {
- stroke
- } bind def
-/M {newpath moveto} bind def
-/E {lineto} bind def
-/D {curveto} bind def
-/O {closepath} bind def
- /n FMLOCAL
-/L {
- /n exch def
- newpath
- normalize
- moveto
- 2 1 n {pop normalize lineto} for
- } bind def
-/Y {
- L
- closepath
- } bind def
- /x1 FMLOCAL
- /x2 FMLOCAL
- /y1 FMLOCAL
- /y2 FMLOCAL
- /rad FMLOCAL
-/R {
- /y2 exch def
- /x2 exch def
- /y1 exch def
- /x1 exch def
- x1 y1
- x2 y1
- x2 y2
- x1 y2
- 4 Y
- } bind def
-/RR {
- /rad exch def
- normalize
- /y2 exch def
- /x2 exch def
- normalize
- /y1 exch def
- /x1 exch def
- newpath
- x1 y1 rad add moveto
- x1 y2 x2 y2 rad arcto
- x2 y2 x2 y1 rad arcto
- x2 y1 x1 y1 rad arcto
- x1 y1 x1 y2 rad arcto
- closepath
- 16 {pop} repeat
- } bind def
-/C {
- grestore
- gsave
- R
- clip
- } bind def
-/U {
- grestore
- gsave
- } bind def
-/F {
- FMfonts exch get
- setfont
- } bind def
-/T {
- moveto show
- } bind def
-/RF {
- rotate
- 0 ne {-1 1 scale} if
- } bind def
-/TF {
- gsave
- moveto
- RF
- show
- grestore
- } bind def
-/P {
- moveto
- 0 32 3 2 roll widthshow
- } bind def
-/PF {
- gsave
- moveto
- RF
- 0 32 3 2 roll widthshow
- grestore
- } bind def
-/S {
- moveto
- 0 exch ashow
- } bind def
-/SF {
- gsave
- moveto
- RF
- 0 exch ashow
- grestore
- } bind def
-/B {
- moveto
- 0 32 4 2 roll 0 exch awidthshow
- } bind def
-/BF {
- gsave
- moveto
- RF
- 0 32 4 2 roll 0 exch awidthshow
- grestore
- } bind def
- /x FMLOCAL
- /y FMLOCAL
- /dx FMLOCAL
- /dy FMLOCAL
- /dl FMLOCAL
- /t FMLOCAL
- /t2 FMLOCAL
- /Cos FMLOCAL
- /Sin FMLOCAL
- /r FMLOCAL
-/W {
- dnormalize
- /dy exch def
- /dx exch def
- normalize
- /y exch def
- /x exch def
- /dl dx dx mul dy dy mul add sqrt def
- dl 0.0 gt {
- /t currentlinewidth def
- savematrix
- /Cos dx dl div def
- /Sin dy dl div def
- /r [Cos Sin Sin neg Cos 0.0 0.0] def
- /t2 t 2.5 mul 3.5 max def
- newpath
- x y translate
- r concat
- 0.0 0.0 moveto
- dl t 2.7 mul sub 0.0 rlineto
- stroke
- restorematrix
- x dx add y dy add translate
- r concat
- t 0.67 mul setlinewidth
- t 1.61 mul neg 0.0 translate
- 0.0 0.0 moveto
- t2 1.7 mul neg t2 2.0 div moveto
- 0.0 0.0 lineto
- t2 1.7 mul neg t2 2.0 div neg lineto
- stroke
- t setlinewidth
- restorematrix
- } if
- } bind def
-/G {
- gsave
- newpath
- normalize translate 0.0 0.0 moveto
- dnormalize scale
- 0.0 0.0 1.0 5 3 roll arc
- closepath fill
- grestore
- } bind def
-/A {
- gsave
- savematrix
- newpath
- 2 index 2 div add exch 3 index 2 div sub exch
- normalize 2 index 2 div sub exch 3 index 2 div add exch
- translate
- scale
- 0.0 0.0 1.0 5 3 roll arc
- restorematrix
- stroke
- grestore
- } bind def
- /x FMLOCAL
- /y FMLOCAL
- /w FMLOCAL
- /h FMLOCAL
- /xx FMLOCAL
- /yy FMLOCAL
- /ww FMLOCAL
- /hh FMLOCAL
- /FMsaveobject FMLOCAL
- /FMoptop FMLOCAL
- /FMdicttop FMLOCAL
-/BEGINPRINTCODE {
- /FMdicttop countdictstack 1 add def
- /FMoptop count 4 sub def
- /FMsaveobject save def
- userdict begin
- /showpage {} def
- FMNORMALIZEGRAPHICS
- 3 index neg 3 index neg translate
- } bind def
-/ENDPRINTCODE {
- count -1 FMoptop {pop pop} for
- countdictstack -1 FMdicttop {pop end} for
- FMsaveobject restore
- } bind def
-/gn {
- 0
- { 46 mul
- cf read pop
- 32 sub
- dup 46 lt {exit} if
- 46 sub add
- } loop
- add
- } bind def
- /str FMLOCAL
-/cfs {
- /str sl string def
- 0 1 sl 1 sub {str exch val put} for
- str def
- } bind def
-/ic [
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223
- 0
- {0 hx} {1 hx} {2 hx} {3 hx} {4 hx} {5 hx} {6 hx} {7 hx} {8 hx} {9 hx}
- {10 hx} {11 hx} {12 hx} {13 hx} {14 hx} {15 hx} {16 hx} {17 hx} {18 hx}
- {19 hx} {gn hx} {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12}
- {13} {14} {15} {16} {17} {18} {19} {gn} {0 wh} {1 wh} {2 wh} {3 wh}
- {4 wh} {5 wh} {6 wh} {7 wh} {8 wh} {9 wh} {10 wh} {11 wh} {12 wh}
- {13 wh} {14 wh} {gn wh} {0 bl} {1 bl} {2 bl} {3 bl} {4 bl} {5 bl} {6 bl}
- {7 bl} {8 bl} {9 bl} {10 bl} {11 bl} {12 bl} {13 bl} {14 bl} {gn bl}
- {0 fl} {1 fl} {2 fl} {3 fl} {4 fl} {5 fl} {6 fl} {7 fl} {8 fl} {9 fl}
- {10 fl} {11 fl} {12 fl} {13 fl} {14 fl} {gn fl}
- ] def
- /sl FMLOCAL
- /val FMLOCAL
- /ws FMLOCAL
- /im FMLOCAL
- /bs FMLOCAL
- /cs FMLOCAL
- /len FMLOCAL
- /pos FMLOCAL
-/ms {
- /sl exch def
- /val 255 def
- /ws cfs
- /im cfs
- /val 0 def
- /bs cfs
- /cs cfs
- } bind def
-400 ms
-/ip {
- is
- 0
- cf cs readline pop
- { ic exch get exec
- add
- } forall
- pop
-
- } bind def
-/wh {
- /len exch def
- /pos exch def
- ws 0 len getinterval im pos len getinterval copy pop
- pos len
- } bind def
-/bl {
- /len exch def
- /pos exch def
- bs 0 len getinterval im pos len getinterval copy pop
- pos len
- } bind def
-/s1 1 string def
-/fl {
- /len exch def
- /pos exch def
- /val cf s1 readhexstring pop 0 get def
- pos 1 pos len add 1 sub {im exch val put} for
- pos len
- } bind def
-/hx {
- 3 copy getinterval
- cf exch readhexstring pop pop
- } bind def
- /h FMLOCAL
- /w FMLOCAL
- /d FMLOCAL
- /lb FMLOCAL
- /bitmapsave FMLOCAL
- /is FMLOCAL
- /cf FMLOCAL
-/wbytes {
- dup
- 8 eq {pop} {1 eq {7 add 8 idiv} {3 add 4 idiv} ifelse} ifelse
- } bind def
-/BEGINBITMAPBWc {
- 1 {} COMMONBITMAPc
- } bind def
-/BEGINBITMAPGRAYc {
- 8 {} COMMONBITMAPc
- } bind def
-/BEGINBITMAP2BITc {
- 2 {} COMMONBITMAPc
- } bind def
-/COMMONBITMAPc {
- /r exch def
- /d exch def
- gsave
- translate rotate scale /h exch def /w exch def
- /lb w d wbytes def
- sl lb lt {lb ms} if
- /bitmapsave save def
- r
- /is im 0 lb getinterval def
- ws 0 lb getinterval is copy pop
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
- {ip} image
- bitmapsave restore
- grestore
- } bind def
-/BEGINBITMAPBW {
- 1 {} COMMONBITMAP
- } bind def
-/BEGINBITMAPGRAY {
- 8 {} COMMONBITMAP
- } bind def
-/BEGINBITMAP2BIT {
- 2 {} COMMONBITMAP
- } bind def
-/COMMONBITMAP {
- /r exch def
- /d exch def
- gsave
- translate rotate scale /h exch def /w exch def
- /bitmapsave save def
- r
- /is w d wbytes string def
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
- {cf is readhexstring pop} image
- bitmapsave restore
- grestore
- } bind def
- /proc1 FMLOCAL
- /proc2 FMLOCAL
- /newproc FMLOCAL
-/Fmcc {
- /proc2 exch cvlit def
- /proc1 exch cvlit def
- /newproc proc1 length proc2 length add array def
- newproc 0 proc1 putinterval
- newproc proc1 length proc2 putinterval
- newproc cvx
-} bind def
-/ngrayt 256 array def
-/nredt 256 array def
-/nbluet 256 array def
-/ngreent 256 array def
- /gryt FMLOCAL
- /blut FMLOCAL
- /grnt FMLOCAL
- /redt FMLOCAL
- /indx FMLOCAL
- /cynu FMLOCAL
- /magu FMLOCAL
- /yelu FMLOCAL
- /k FMLOCAL
- /u FMLOCAL
-/colorsetup {
- currentcolortransfer
- /gryt exch def
- /blut exch def
- /grnt exch def
- /redt exch def
- 0 1 255 {
- /indx exch def
- /cynu 1 red indx get 255 div sub def
- /magu 1 green indx get 255 div sub def
- /yelu 1 blue indx get 255 div sub def
- /k cynu magu min yelu min def
- /u k currentundercolorremoval exec def
- nredt indx 1 0 cynu u sub max sub redt exec put
- ngreent indx 1 0 magu u sub max sub grnt exec put
- nbluet indx 1 0 yelu u sub max sub blut exec put
- ngrayt indx 1 k currentblackgeneration exec sub gryt exec put
- } for
- {255 mul cvi nredt exch get}
- {255 mul cvi ngreent exch get}
- {255 mul cvi nbluet exch get}
- {255 mul cvi ngrayt exch get}
- setcolortransfer
- {pop 0} setundercolorremoval
- {} setblackgeneration
- } bind def
- /tran FMLOCAL
-/fakecolorsetup {
- /tran 256 string def
- 0 1 255 {/indx exch def
- tran indx
- red indx get 77 mul
- green indx get 151 mul
- blue indx get 28 mul
- add add 256 idiv put} for
- currenttransfer
- {255 mul cvi tran exch get 255.0 div}
- exch Fmcc settransfer
-} bind def
-/BITMAPCOLOR {
- /d 8 def
- gsave
- translate rotate scale /h exch def /w exch def
- /bitmapsave save def
- colorsetup
- /is w d wbytes string def
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
- {cf is readhexstring pop} {is} {is} true 3 colorimage
- bitmapsave restore
- grestore
- } bind def
-/BITMAPCOLORc {
- /d 8 def
- gsave
- translate rotate scale /h exch def /w exch def
- /lb w d wbytes def
- sl lb lt {lb ms} if
- /bitmapsave save def
- colorsetup
- /is im 0 lb getinterval def
- ws 0 lb getinterval is copy pop
- /cf currentfile def
- w h d [w 0 0 h neg 0 h]
- {ip} {is} {is} true 3 colorimage
- bitmapsave restore
- grestore
- } bind def
-/BITMAPGRAY {
- 8 {fakecolorsetup} COMMONBITMAP
- } bind def
-/BITMAPGRAYc {
- 8 {fakecolorsetup} COMMONBITMAPc
- } bind def
-/ENDBITMAP {
- } bind def
-end
-%%EndProlog
-%%BeginSetup
-(2.0) FMVERSION
-1 1 612 792 0 1 16 FMDOCUMENT
-/fillprocs 32 array def
-fillprocs 0 { 0.000000 grayness } put
-fillprocs 1 { 0.100000 grayness } put
-fillprocs 2 { 0.300000 grayness } put
-fillprocs 3 { 0.500000 grayness } put
-fillprocs 4 { 0.700000 grayness } put
-fillprocs 5 { 0.900000 grayness } put
-fillprocs 6 { 0.970000 grayness } put
-fillprocs 7 { 1.000000 grayness } put
-fillprocs 8 {<0f87c3e1f0783c1e> 8 1 setpattern } put
-fillprocs 9 {<0f1e3c78f0e1c387> 8 1 setpattern } put
-fillprocs 10 {<cccccccccccccccc> 8 1 setpattern } put
-fillprocs 11 {<ffff0000ffff0000> 8 1 setpattern } put
-fillprocs 12 {<8142241818244281> 8 1 setpattern } put
-fillprocs 13 {<8040201008040201> 8 1 setpattern } put
-fillprocs 14 {<03060c183060c081> 8 1 setpattern } put
-fillprocs 15 {} put
-fillprocs 16 { 1.000000 grayness } put
-fillprocs 17 { 0.900000 grayness } put
-fillprocs 18 { 0.700000 grayness } put
-fillprocs 19 { 0.500000 grayness } put
-fillprocs 20 { 0.300000 grayness } put
-fillprocs 21 { 0.100000 grayness } put
-fillprocs 22 { 0.030000 grayness } put
-fillprocs 23 { 0.000000 grayness } put
-fillprocs 24 {<f0783c1e0f87c3e1> 8 1 setpattern } put
-fillprocs 25 {<f0e1c3870f1e3c78> 8 1 setpattern } put
-fillprocs 26 {<3333333333333333> 8 1 setpattern } put
-fillprocs 27 {<0000ffff0000ffff> 8 1 setpattern } put
-fillprocs 28 {<7ebddbe7e7dbbd7e> 8 1 setpattern } put
-fillprocs 29 {<7fbfdfeff7fbfdfe> 8 1 setpattern } put
-fillprocs 30 {<fcf9f3e7cf9f3f7e> 8 1 setpattern } put
-fillprocs 31 {} put
-%%EndSetup
-0 12 /Helvetica-Bold FMDEFINEFONT
-1 12 /Helvetica-BoldOblique FMDEFINEFONT
-%%Page: "-1" 1
-%%BeginPaperSize: Letter
-%%EndPaperSize
-612 792 0 FMBEGINPAGE
-144 144 468 396 R
-7 X
-0 K
-V
-0 F
-0 X
-1.2 (IMPLEMENT) 178.34 388 S
-1.2 (A) 258.88 388 S
-1.2 (TION NOTES ON ) 267.85 388 S
-1 F
-1.2 (bdes) 382.61 388 S
-0 F
-1.2 (\0501\051) 415.4 388 S
-1.2 (Matt Bishop) 265.09 338 S
-1.2 (T) 197.74 288 S
-1.2 (echnical Report PCS-TR91-158) 205.38 288 S
-FMENDPAGE
-%%EndPage: "-1" 2
-%%Page: "0" 2
-612 792 0 FMBEGINPAGE
-72 72 540 720 R
-7 X
-0 K
-V
-FMENDPAGE
-%%EndPage: "0" 3
-0 12 /Times-Roman FMDEFINEFONT
-1 18 /Times-Bold FMDEFINEFONT
-2 18 /Times-BoldItalic FMDEFINEFONT
-3 12 /Times-Italic FMDEFINEFONT
-4 12 /Times-Bold FMDEFINEFONT
-5 10 /Times-Roman FMDEFINEFONT
-6 12 /Courier FMDEFINEFONT
-7 12 /Courier-Oblique FMDEFINEFONT
-8 12 /ZapfDingbats FMDEFINEFONT
-9 12 /Symbol FMDEFINEFONT
-10 12 /Courier-Bold FMDEFINEFONT
-%%Page: "1" 3
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 1 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-1 F
-0 X
-(Implementation Notes on ) 179.84 708 T
-2 F
-(bdes) 378.21 708 T
-1 F
-(\0501\051) 411.19 708 T
-0 F
-( ) 432.17 708 T
-3 F
-(Matt Bishop) 276.51 676 T
-0 F
-(Department of Mathematics and Computer Science) 182.92 656 T
-(Dartmouth College) 259.86 642 T
-(Hanover) 257.45 628 T
-(, NH 03755) 298.26 628 T
-3 F
-(ABSTRACT) 277.68 602 T
-0 F
-0.27 (This note describes the implementation of ) 108 582 P
-3 F
-0.27 (bdes) 314.13 582 P
-0 F
-0.27 (, the \336le encryption program being) 336.12 582 P
-0.36 (distributed in the 4.4 release of the Berkeley Software Distribution. It implements) 108 568 P
-(all modes of the Data Encryption Standard program.) 108 554 T
-4 F
-(1. Intr) 72 528 T
-(oduction) 104.43 528 T
-0 F
--0.09 (The Data Encryption Standard is a standard endorsed by the federal government. It is con-) 108 504 P
--0.56 (siderably stronger than the algorithm used by the ) 72 484 P
-5 F
--0.47 (UNIX) 305.36 484 P
-0 F
--0.56 (\252 ) 330.34 484 P
-3 F
--0.56 (crypt) 344.53 484 P
-0 F
--0.56 (\0501\051 program, and therefore is a more) 369.18 484 P
-0.11 (suitable candidate for protecting information, especially information contained in ) 72 464 P
-5 F
-0.09 (ASCII) 466.05 464 P
-0 F
-0.11 ( \336les. The) 492.14 464 P
--0.65 (program ) 72 444 P
-3 F
--0.65 (bdes) 114.99 444 P
-0 F
--0.65 (\0501\051 implements the DES and all of its modes, including the two authentication modes.) 136.97 444 P
--0.59 (Because others may wish to write software compatible with this program, this note presents) 108 420 P
--0.04 (the layout of the encrypted \336les produced by ) 72 400 P
-3 F
--0.04 (bdes) 288.86 400 P
-0 F
--0.04 ( as well as internal details relevant to the imple-) 310.85 400 P
--0.15 (mentation. Whereever possible and appropriate, the description of the ) 72 380 P
-3 F
--0.15 (des) 408.04 380 P
-0 F
--0.15 (\0501\051 program given in [4]) 424.03 380 P
--0.2 (has been followed; thus, ) 72 360 P
-3 F
--0.2 (bdes) 190.77 360 P
-0 F
--0.2 ( is completely compatible with that program. However) 212.75 360 P
--0.2 (, ) 473.33 360 P
-3 F
--0.2 (bdes) 479.12 360 P
-0 F
--0.2 ( also of-) 501.11 360 P
-(fers several extensions to ) 72 340 T
-3 F
-(des) 195.9 340 T
-0 F
-( that are not compatible, and these will be explicitly pointed out.) 211.89 340 T
--0.14 (In this note, strings typed as shown will be in ) 108 316 P
-6 F
--0.34 (Courier Roman font) 326.78 316 P
-0 F
--0.14 (, and strings to be) 455.62 316 P
--0.42 (chosen by the user will be in ) 72 296 P
-7 F
--1 (Courier Oblique font) 209.32 296 P
-0 F
--0.42 (. The space character \050) 351.24 296 P
-5 F
--0.35 (ASCII) 457.79 296 P
-0 F
--0.42 ( <) 483.88 296 P
-5 F
--0.35 (SP) 493.23 296 P
-0 F
--0.42 (>, octal) 504.34 296 P
--0.43 (40, decimal 32, hex 20\051 will be represented as \322) 72 276 P
-8 F
--0.47 (z) 296.98 276 P
-0 F
--0.43 (\323 and the newline character \050) 301.96 276 P
-5 F
--0.35 (ASCII) 438.03 276 P
-0 F
--0.43 ( <) 464.13 276 P
-5 F
--0.35 (NL) 473.46 276 P
-0 F
--0.43 (>, octal 12,) 486.79 276 P
--0.05 (decimal 10, hex a\051 as \322) 72 256 P
-9 F
--0.05 (\277) 181.65 256 P
-0 F
--0.05 (\323. Because it is often more convenient to represent arbitrary characters as) 189.54 256 P
-1.13 (a sequence of hexadecimal digits, that representation will often be used; these digits will be in) 72 236 P
-10 F
-(Courier Bold font) 72 216 T
-0 F
-( with spaces often inserted for readability) 194.33 216 T
-(.) 392.07 216 T
-4 F
-(2. Overview and Use) 72 184 T
-3 F
--0.39 (Bdes) 108 160 P
-0 F
--0.39 ( implements the Data Encryption Standard algorithm in software, and enables the user) 131.32 160 P
--0.61 (to encrypt data using any of the four modes of operation of the DES \050Electronic Code Book, Cipher) 72 140 P
-72 72 540 720 C
-72 72 540 117 C
-72 72 549 108 R
-7 X
-0 K
-V
-5 F
-0 X
-(This work is based on work funded by grant NAG2-680 from the National
-Aeronautics and Space Administration to ) 72 101.33 T
-(Dartmouth College.) 72 89.33 T
-(UNIX is a Registered T) 72 77.33 T
-(rademark of A) 166.58 77.33 T
-(T&T Bell Laboratories.) 223.75 77.33 T
-72 72 540 720 C
-0 0 612 792 C
-72 126 225 126 2 L
-7 X
-0 K
-V
-0.5 H
-2 Z
-0 X
-N
-FMENDPAGE
-%%EndPage: "1" 4
-%%Page: "2" 4
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 2 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
-0.31 (Block Chaining, ) 72 712 P
-3 F
-0.31 (k) 154.25 712 P
-0 F
-0.31 (-bit Cipher Feed Back, and ) 159.58 712 P
-3 F
-0.31 (k) 293.71 712 P
-0 F
-0.31 (-bit Output Feed Back\051 as well as the Alternate ) 299.04 712 P
-3 F
-0.31 (k) 530.68 712 P
-0 F
-0.31 (-) 536.01 712 P
--0.04 (bit Cipher Feed Back mode. Further) 72 692 P
--0.04 (, ) 244.52 692 P
-3 F
--0.04 (bdes) 250.48 692 P
-0 F
--0.04 ( supports message authentication code generation based) 272.46 692 P
-(on both the Cipher Block Chaining mode and the ) 72 672 T
-3 F
-(k) 310.86 672 T
-0 F
-(-bit Cipher Feed Back mode.) 316.19 672 T
-0.07 (By default, ) 108 648 P
-3 F
-0.07 (bdes) 164.43 648 P
-0 F
-0.07 ( encrypts an input \336le using Cipher Block Chaining mode, and is invoked) 186.41 648 P
--0.4 (as a \336lter) 72 628 P
--0.4 (. The key may be speci\336ed either on the command line or may be typed to the prompt. So,) 114.51 628 P
-(if the input \336le ) 72 608 T
-7 F
-(inputf) 145.96 608 T
-(ile) 189.14 608 T
-0 F
-( contains the message) 210.73 608 T
-6 F
-(a) 253.9 584 T
-8 F
-(z) 261.1 584 T
-6 F
-(test) 266.07 584 T
-8 F
-(z) 294.86 584 T
-6 F
-(message) 299.83 584 T
-9 F
-(\277) 350.21 584 T
-0 F
-(then the following command encrypts it using the key ) 72 560 T
-6 F
-(abcdefgh) 333.5 560 T
-0 F
-(:) 391.07 560 T
-6 F
-(bdes -k abcdefgh < ) 158.48 536 T
-7 F
-(inputf) 295.21 536 T
-(ile) 338.38 536 T
-6 F
-( > ) 359.97 536 T
-7 F
-(outputf) 381.56 536 T
-(ile) 431.93 536 T
-0 F
-(The option ) 72 512 T
-4 F
-(-k) 127.3 512 T
-0 F
-( indicates the next ar) 137.96 512 T
-(gument is the key) 237.01 512 T
-(. Now ) 321.17 512 T
-7 F
-(outputf) 353.48 512 T
-(ile) 403.86 512 T
-0 F
-( contains) 425.45 512 T
-10 F
-(16 0e eb af 68 a0 d0 19 f1 a2 9b 31 0d 8a 01 c3) 136.89 488 T
-0 F
-0.06 (Other modes are speci\336ed using command-line options, as is control of the way the key is) 108 464 P
-(interpreted. The next sections contain several examples, and the Appendix has the manual page.) 72 444 T
-4 F
-(3. Keys and Parity) 72 412 T
-0 F
-0.58 (The key consists of 64 bits, and may be presented in any of hex, binary) 108 388 P
-0.58 (, or as a string of) 456.48 388 P
-5 F
-0.12 (ASCII) 72 368 P
-0 F
-0.14 ( characters. If the key is given in hex or binary) 98.1 368 P
-0.14 (, it is used as is with no changes. However) 322.21 368 P
-0.14 (, if) 526.53 368 P
--0.27 (the key is given in ) 72 348 P
-5 F
--0.23 (ASCII) 161.59 348 P
-0 F
--0.27 (, a delicate problem arises: by convention, the parity bit is usually set to 0.) 187.69 348 P
--0.47 (This high-order bit is generally ignored by applications; but the DES
-does not do so. Instead, it dis-) 72 328 P
--0.14 (cards the low-order bit, ef) 72 308 P
--0.14 (fectively reducing the size of the space of possible keys from 2) 195.44 308 P
-5 F
--0.12 (56) 495.97 312.8 P
-0 F
--0.14 ( to 2) 505.97 308 P
-5 F
--0.12 (48) 527.01 312.8 P
-0 F
--0.14 (.) 537 308 P
--0.46 ( T) 108 284 P
--0.46 (o preserve the size of the key space, the value of the parity bit must be related to the value) 117.03 284 P
--0.09 (in the low-order bit, so the program sets the high-order bit to make each character in the key be of) 72 264 P
--0.7 (odd parity) 72 244 P
--0.7 (. \050Note that the initial value of the parity bit is ) 119.49 244 P
-3 F
--0.7 (not) 334.99 244 P
-0 F
--0.7 ( used in this computation.\051 For example,) 350.31 244 P
-(if the key is ) 72 224 T
-6 F
-(abcdefgh) 131.29 224 T
-0 F
-(, the actual key bits used are determined as follows:) 188.86 224 T
-5 F
-(ASCII) 99 200 T
-0 F
-( key) 125.1 200 T
-6 F
-(a) 243 200 T
-(b) 279 200 T
-(c) 315 200 T
-(d) 351 200 T
-(e) 387 200 T
-(f) 423 200 T
-(g) 459 200 T
-(h) 495 200 T
-5 F
-(ASCII) 99 180 T
-0 F
-( key bits \050hex\051) 125.1 180 T
-10 F
-(61) 243 180 T
-(62) 279 180 T
-(63) 315 180 T
-(64) 351 180 T
-(65) 387 180 T
-(66) 423 180 T
-(67) 459 180 T
-(68) 495 180 T
-0 F
-(parity) 99 160 T
-(odd) 243 160 T
-(odd) 279 160 T
-(even) 315 160 T
-(odd) 351 160 T
-(even) 387 160 T
-(even) 423 160 T
-(odd) 459 160 T
-(odd) 495 160 T
-(key bits used \050hex\051) 99 140 T
-10 F
-(61) 243 140 T
-(62) 279 140 T
-(e3) 315 140 T
-(64) 351 140 T
-(e5) 387 140 T
-(e6) 423 140 T
-(67) 459 140 T
-(68) 495 140 T
-0 F
-0.18 (This convention \050as opposed to requiring even parity) 108 120 P
-0.18 (, or simply copying the low-order bit) 362 120 P
--0.41 (to the high-order bit\051 was chosen to provide compatibility with the encryption program ) 72 100 P
-3 F
--0.41 (des) 486.77 100 P
-0 F
--0.41 ( distrib-) 502.76 100 P
--0.52 (uted by Sun Microsystems, Inc. [4]. Whether the key is entered on the command line or on the key-) 72 80 P
-FMENDPAGE
-%%EndPage: "2" 5
-%%Page: "3" 5
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 3 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
-1.89 (board, by default it is processed into the same key schedule generated by Sun\325) 72 712 P
-1.89 (s ) 471.02 712 P
-3 F
-1.89 (des) 480.58 712 P
-0 F
-1.89 (, so \336les) 496.56 712 P
-(encrypted on a Sun can be decrypted using ) 72 692 T
-3 F
-(bdes) 280.51 692 T
-0 F
-( \050and vice versa\051.) 302.49 692 T
--0.3 (If the user does not wish to use the Sun convention, the option \320) 108 668 P
-4 F
--0.3 (p) 411.9 668 P
-0 F
--0.3 ( will disable the parity bit) 418.57 668 P
--0.62 (changing; with it, the parity bit is that of the character typed. This
-is useful when the key is a known) 72 648 P
-5 F
-(ASCII) 72 628 T
-0 F
-( string and the \336le was encrypted on a system which does not alter parity bits.) 98.1 628 T
--0.24 (A key may be represented as a bit vector) 108 604 P
--0.24 (, rather than an ) 300.74 604 P
-5 F
--0.2 (ASCII) 374.7 604 P
-0 F
--0.24 ( string, in one of two ways. It) 400.8 604 P
-0.19 (may be represented as a string of up to 16 hexadecimal digits; if fewer than 16 are given, the key) 72 584 P
-0.16 (is right \336lled with 0 bits. Or) 72 564 P
-0.16 (, it may be represented as a string of up to 64 binary digits, and again) 206.11 564 P
-0.15 (if fewer than 64 are given, the key is right-\336lled with 0 bits. Bit
-vector keys must be given on the) 72 544 P
-0.51 (command line, and must begin with the characters ) 72 524 P
-6 F
-1.24 (0x) 320.28 524 P
-0 F
-0.51 ( or ) 334.67 524 P
-6 F
-1.24 (0X) 351.69 524 P
-0 F
-0.51 ( \050for hexadecimal\051 or ) 366.08 524 P
-6 F
-1.24 (0b) 472.71 524 P
-0 F
-0.51 ( or ) 487.1 524 P
-6 F
-1.24 (0B) 504.12 524 P
-0 F
-0.51 ( \050for) 518.51 524 P
-(binary\051. For example, all of the following strings generate the same key schedule:) 72 504 T
-5 F
-(ASCII) 72 480 T
-0 F
-( key) 98.1 480 T
-6 F
-(abcdefgh) 180 480 T
-0 F
-(hexadecimal key) 72 460 T
-6 F
-(0x6162e364e5e66768) 180 460 T
-0 F
-(binary key) 72 440 T
-6 F
-(0b0110000101100010111000110110100011100101111000-) 180 440 T
-(1100110011101101000) 180 420 T
-0 F
--0.14 ( Note that giving the key on the command line as ) 108 396 P
-6 F
--0.34 (0x6162636465666768) 345.27 396 P
-0 F
--0.14 ( will ) 474.8 396 P
-3 F
--0.14 (not) 499.17 396 P
-0 F
--0.14 ( reset) 514.5 396 P
-0.25 (the parity bits, because it is interpreted as a sequence of hex digits, not ) 72 376 P
-5 F
-0.21 (ASCII) 416.58 376 P
-0 F
-0.25 ( characters. The dif-) 442.68 376 P
-0.69 (ference in interpretation is that here the user can specify all bits of the key exactly) 72 356 P
-0.69 (, whereas \050on) 474.34 356 P
-0.25 (most terminals\051 it is not possible to control how the parity bit of ) 72 336 P
-5 F
-0.21 (ASCII) 384.76 336 P
-0 F
-0.25 ( characters is set. On some) 410.85 336 P
-0.36 (systems, it is possible to use a \322Meta\323 key to set the parity bit for an ) 72 316 P
-5 F
-0.3 (ASCII) 407.23 316 P
-0 F
-0.36 ( character; should this) 433.33 316 P
--0.3 (be the case and the user desire ) 72 296 P
-3 F
--0.3 (bdes) 218.09 296 P
-0 F
--0.3 ( not to reset the parity bit, the option ) 240.07 296 P
-4 F
--0.3 (\320p) 415.25 296 P
-0 F
--0.3 ( will force the parity bit) 427.92 296 P
-(to be used as typed.) 72 276 T
-4 F
-(4. Encryption Output Repr) 72 244 T
-(esentation) 211.05 244 T
-0 F
-0.01 (All modes of the DES output ciphertext in blocks; the size of the block is 64 bits \0508 bytes\051) 108 220 P
--0.25 (for ECB and CBC modes, and ) 72 200 P
-3 F
--0.25 (k) 218.74 200 P
-0 F
--0.25 ( bits for the ) 224.07 200 P
-3 F
--0.25 (k) 281.02 200 P
-0 F
--0.25 (-bit CFB and OFB modes, and there are as many out-) 286.35 200 P
--0.5 (put blocks as input blocks. However) 72 180 P
--0.5 (, as the length of the input is usually not a multiple of the block) 243.55 180 P
--0.35 (size, some padding is necessary; but as padding must be done by appending characters, these char-) 72 160 P
-0.29 (acters must be distinguished from the input characters somehow) 72 140 P
-0.29 (. The mechanism used is that the) 381.35 140 P
-0.31 (last character of the \050decrypted\051 last block is the
-\050integer\051 number of characters from the input in) 72 120 P
-(the last block.) 72 100 T
-FMENDPAGE
-%%EndPage: "3" 6
-%%Page: "4" 6
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 4 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
--0.59 (For example, suppose ) 108 712 P
-7 F
--1.41 (inputf) 214.16 712 P
--1.41 (ile) 257.34 712 P
-0 F
--0.59 ( contains \322) 278.93 712 P
-6 F
--1.41 (This) 329.04 712 P
-8 F
--0.65 (z) 357.83 712 P
-6 F
--1.41 (is) 362.8 712 P
-8 F
--0.65 (z) 377.2 712 P
-6 F
--1.41 (a) 382.17 712 P
-8 F
--0.65 (z) 389.37 712 P
-6 F
--1.41 (test) 394.35 712 P
-9 F
--0.59 (\277) 423.13 712 P
-0 F
--0.59 (\323, and it is encrypted in) 431.02 712 P
-(CBC mode using the key \322) 72 692 T
-6 F
-(abcdef#@) 200.93 692 T
-0 F
-(\323 and the initialization vector ) 258.5 692 T
-6 F
-(0x0) 401.4 692 T
-0 F
-(; the command is) 422.99 692 T
-6 F
-(bdes -k abcdef#@ < ) 158.48 668 T
-7 F
-(inputf) 295.21 668 T
-(ile) 338.38 668 T
-6 F
-( > ) 359.97 668 T
-7 F
-(outputf) 381.56 668 T
-(ile) 431.93 668 T
-0 F
-(as CBC is the default encryption mode and ) 72 644 T
-6 F
-(0x0) 281.2 644 T
-0 F
-( the default initialization vector:) 302.79 644 T
-(text) 72 620 T
-6 F
-(T) 117 620 T
-(h) 144 620 T
-(i) 171 620 T
-(s) 198 620 T
-8 F
-(z) 225 620 T
-6 F
-(i) 252 620 T
-(s) 279 620 T
-8 F
-(z) 306 620 T
-6 F
-(a) 333 620 T
-8 F
-(z) 360 620 T
-6 F
-(t) 387 620 T
-(e) 414 620 T
-(s) 441 620 T
-(t) 468 620 T
-9 F
-(\277) 495 620 T
-0 F
-(hex) 72 600 T
-10 F
-(54) 117 600 T
-(68) 144 600 T
-(69) 171 600 T
-(73) 198 600 T
-(20) 225 600 T
-(69) 252 600 T
-(73) 279 600 T
-(20) 306 600 T
-(61) 333 600 T
-(20) 360 600 T
-(74) 387 600 T
-(65) 414 600 T
-(73) 441 600 T
-(74) 468 600 T
-(0a) 495 600 T
-0 F
-(input) 72 580 T
-10 F
-(54) 117 580 T
-(68) 144 580 T
-(69) 171 580 T
-(73) 198 580 T
-(20) 225 580 T
-(69) 252 580 T
-(73) 279 580 T
-(20) 306 580 T
-(61) 333 580 T
-(20) 360 580 T
-(74) 387 580 T
-(65) 414 580 T
-(73) 441 580 T
-(74) 468 580 T
-(0a) 495 580 T
-(07) 522 580 T
-0 F
-(output) 72 560 T
-10 F
-(a5) 117 560 T
-(5f) 144 560 T
-(81) 171 560 T
-(53) 198 560 T
-(51) 225 560 T
-(98) 252 560 T
-(47) 279 560 T
-(02) 306 560 T
-(db) 333 560 T
-(5a) 360 560 T
-(c5) 387 560 T
-(fe) 414 560 T
-(50) 441 560 T
-(3d) 468 560 T
-(40) 495 560 T
-(ce) 522 560 T
-0 F
-0.04 (Notice that the text is 15 characters long, so there are 7 bytes following the last full block.) 108 540 P
-3 F
-0.22 (Bdes) 72 520 P
-0 F
-0.22 ( pads this to a full block by appending one byte containing the ) 95.32 520 P
-5 F
-0.19 (ASCII) 399.67 520 P
-0 F
-0.22 ( character with numeric) 425.77 520 P
-(value 7 \050the ) 72 500 T
-5 F
-(ASCII) 131.62 500 T
-0 F
-( character <) 157.71 500 T
-5 F
-(BEL) 214.42 500 T
-0 F
-(>\051. The result is then encrypted.) 233.3 500 T
-0.44 (As another example, suppose ) 108 476 P
-7 F
-1.07 (inputf) 253.34 476 P
-1.07 (ile) 296.52 476 P
-0 F
-0.44 ( contains \322) 318.11 476 P
-6 F
-1.07 (test) 370.29 476 P
-0 F
-0.44 (\323, and it is encrypted in ECB) 399.08 476 P
-(mode using the key \322) 72 456 T
-6 F
-(abcdef#@) 173.93 456 T
-0 F
-(\323; the command is) 231.5 456 T
-6 F
-(bdes -b \320k abcdef#@ < ) 147.69 432 T
-7 F
-(inputf) 306 432 T
-(ile) 349.18 432 T
-6 F
-( > ) 370.76 432 T
-7 F
-(outputf) 392.35 432 T
-(ile) 442.73 432 T
-0 F
-(because the option ) 72 408 T
-4 F
-(\320b) 164.26 408 T
-0 F
-( signi\336es ECB mode:) 176.93 408 T
-(text) 72 384 T
-6 F
-(t) 144 384 T
-(e) 171 384 T
-(s) 198 384 T
-(t) 225 384 T
-0 F
-(hex) 72 364 T
-10 F
-(74) 144 364 T
-(65) 171 364 T
-(73) 198 364 T
-(74) 225 364 T
-0 F
-(input) 72 344 T
-10 F
-(74) 144 344 T
-(65) 171 344 T
-(73) 198 344 T
-(74) 225 344 T
-(00) 252 344 T
-(00) 279 344 T
-(00) 306 344 T
-(04) 333 344 T
-0 F
-(output) 72 324 T
-10 F
-(0d) 144 324 T
-(8a) 171 324 T
-(6e) 198 324 T
-(57) 225 324 T
-(9c) 252 324 T
-(8f) 279 324 T
-(27) 306 324 T
-(5d) 333 324 T
-0 F
--0.31 (Finally) 108 304 P
--0.31 (, if the length of the message is indeed a multiple of the block size, an extra block of) 141.21 304 P
-0.83 (all 0 bits is added. Suppose ) 72 284 P
-7 F
-1.99 (inputf) 210.57 284 P
-1.99 (ile) 253.74 284 P
-0 F
-0.83 ( contains \322) 275.33 284 P
-6 F
-1.99 (test) 328.28 284 P
-9 F
-0.83 (\277) 357.07 284 P
-0 F
-0.83 (\323, and it is encrypted in 40-bit CFB) 364.96 284 P
-1.51 (mode using the key \322) 72 264 P
-6 F
-3.62 (abcdef#@) 179.96 264 P
-0 F
-1.51 (\323 and the initialization vector ) 237.53 264 P
-6 F
-3.62 (0x0123456789abcdef) 387.97 264 P
-0 F
-1.51 (; the) 517.5 264 P
-(command is) 72 244 T
-6 F
--0.99 (bdes -f40 -v0x0123456789abcdef -kabcdef#@ < ) 72 220 P
-7 F
--0.99 (inputf) 383.67 220 P
--0.99 (ile) 426.85 220 P
-6 F
--0.99 ( > ) 448.43 220 P
-7 F
--0.99 (outputf) 468.04 220 P
--0.99 (ile) 518.41 220 P
-0 F
-0.16 (because the option ) 72 196 P
-4 F
-0.16 (\320f40 ) 164.75 196 P
-0 F
-0.16 (signi\336es 40-bit CFB mode, and ) 189.89 196 P
-4 F
-0.16 (-v0x01234566789abcdef) 343.96 196 P
-0 F
-0.16 ( sets the initial-) 465.89 196 P
-(ization vector \050note that spaces between the option and its ar) 72 176 T
-(gument are optional\051:) 361.57 176 T
-(text) 72 152 T
-6 F
-(t) 144 152 T
-(e) 171 152 T
-(s) 198 152 T
-(t) 225 152 T
-9 F
-(\277) 252 152 T
-0 F
-(hex) 72 132 T
-10 F
-(74) 144 132 T
-(65) 171 132 T
-(73) 198 132 T
-(74) 225 132 T
-(0a) 252 132 T
-0 F
-(input) 72 112 T
-10 F
-(74) 144 112 T
-(65) 171 112 T
-(73) 198 112 T
-(74) 225 112 T
-(0a) 252 112 T
-(00) 279 112 T
-(00) 306 112 T
-(00) 333 112 T
-(00) 360 112 T
-(00) 387 112 T
-0 F
-(output) 72 92 T
-10 F
-(e2) 144 92 T
-(c2) 171 92 T
-(69) 198 92 T
-(a4) 225 92 T
-(5b) 252 92 T
-(3c) 279 92 T
-(3d) 306 92 T
-(b3) 333 92 T
-(f5) 360 92 T
-(3c) 387 92 T
-FMENDPAGE
-%%EndPage: "4" 7
-1 12 /Times-BoldItalic FMDEFINEFONT
-2 14 /Symbol FMDEFINEFONT
-%%Page: "5" 7
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 5 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
-(Note here the block size is 40 bits \0505 bytes\051, not 64 bits \0508 bytes\051.) 108 712 T
--0.4 (This technique allows complete compatibility with Sun\325) 108 688 P
--0.4 (s ) 374.11 688 P
-3 F
--0.4 (des) 381.37 688 P
-0 F
--0.4 ( program. In Sun\325) 397.36 688 P
--0.4 (s implemen-) 480.77 688 P
-0.02 (tation, padding is done with random bytes rather than bytes containing all zero bits. Cryptograph-) 72 668 P
-0.85 (ically) 72 648 P
-0.85 (, this makes no dif) 97.87 648 P
-0.85 (ference, as the DES is a suf) 189.32 648 P
-0.85 (\336ciently good random cipher to obscure the) 325.74 648 P
-(input \050see for example [2], Chapter 6\051, and known plaintext attacks are very dif) 72 628 T
-(\336cult [1].) 451.82 628 T
-4 F
-(5. Differ) 72 596 T
-(ences Between the Standard CFB and OFB Modes and ) 114.41 596 T
-1 F
-(bdes) 397.26 596 T
-0 F
--0.11 (The UNIX operating system treats all \336les as streams of 8-bit bytes. In order to implement) 108 572 P
--0.08 (the CFB and OFB modes properly) 72 552 P
--0.08 (, it would be necessary to read ) 235.74 552 P
-3 F
--0.08 (k) 383.74 552 P
-0 F
--0.08 ( bits from the \336le, where ) 389.07 552 P
-3 F
--0.08 (k) 509.51 552 P
-0 F
--0.08 ( is an) 514.84 552 P
-0.98 (integer between 1 and 64 inclusive. However) 72 532 P
-0.98 (, this would require considerable buf) 294.22 532 P
-0.98 (fering and be) 474.77 532 P
-0.23 (quite inef) 72 512 P
-0.23 (\336cient and prohibitively slow) 117.65 512 P
-0.23 (. For these reasons, the current implementation of ) 258.48 512 P
-3 F
-0.23 (bdes) 501.48 512 P
-0 F
-0.23 ( re-) 523.46 512 P
-0.47 (quires that ) 72 492 P
-3 F
-0.47 (k) 126.23 492 P
-0 F
-0.47 ( be a multiple of 8, so that an integral number of bytes will always be read from the) 131.56 492 P
-(\336le. Other than this change, this mode is implemented as described in [3].) 72 472 T
--0.58 (A similar observation holds for the alternate CFB mode described in [3]. Here, only the low) 108 448 P
-0.23 (7 bits of each byte are signi\336cant, and hence the parameter ) 72 428 P
-3 F
-0.23 (k) 358.95 428 P
-0 F
-0.23 ( is an integer from 1 to 56 inclusive;) 364.28 428 P
-(bdes requires k to be a multiple of 7. The high-order bit is retained for encryption and decryption,) 72 408 T
-(but output \050whether from encryption or decryption\051 always has the high-order bit set to zero.) 72 388 T
-4 F
-(6. Message Authentication Code Modes) 72 356 T
-0 F
-0.57 (The Data Encryption Standard provides two modes of authentication, each providing be-) 108 332 P
-1.27 (tween 1 and 64 bits of authentication data. In both cases an ) 72 312 P
-3 F
-1.27 (n) 373.32 312 P
-0 F
-1.27 (-bit message authentication code) 379.32 312 P
-0.62 (\050MAC\051 is generated, where 1) 72 292 P
-2 F
-0.73 ( ) 214.71 292 P
-9 F
-0.62 (\243) 218.94 292 P
-0 F
-0.62 ( ) 225.52 292 P
-3 F
-0.62 (n) 229.15 292 P
-0 F
-0.62 ( ) 235.14 292 P
-9 F
-0.62 (\243) 238.76 292 P
-0 F
-0.62 ( 64. The \336rst is based on the CBC encryption mode, and the) 245.35 292 P
-(second on CFB mode. Both work the same.) 72 272 T
-0.13 (First, the \336le is padded to a multiple of the block size by appending enough zero bits. It is) 108 248 P
--0.16 (then encrypted using the standard CBC \050or CFB\051 algorithm, but
-all encrypted text is discarded ex-) 72 228 P
--0.44 (cept for the last block. The ) 72 208 P
-3 F
--0.44 (n) 200.9 208 P
-0 F
--0.44 ( leading bits of the last block are used as the MAC. Note that the block) 206.9 208 P
-(size constrains the number of bits available as the MAC.) 72 188 T
-0.71 (The implementation allows the user to specify that the MAC is to be computed in either) 108 164 P
--0.01 (CBC or CFB mode, and the user can specify any number of bits from 1 to 64 inclusive. However) 72 144 P
--0.01 (,) 537 144 P
--0.11 (because the UNIX operating system can only output bits in multiples of 8, if the number of bits of) 72 124 P
--0.08 (MAC is not a multiple of 8, the MAC will be right-padded with the minimum number of zero bits) 72 104 P
--0.31 (necessary to make the MAC length be a multiple of 8. However) 72 84 P
--0.31 (, note that as the standard \050[3], Ap-) 374.6 84 P
-FMENDPAGE
-%%EndPage: "5" 8
-%%Page: "6" 8
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 6 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
--0.14 (pendix F\051 requires an incomplete \336nal block be right-padded with
-zeroes, the technique of forcing) 72 712 P
-(the last octet to contain the number of bytes in the message is ) 72 692 T
-3 F
-(not) 369.47 692 T
-0 F
-( used here.) 384.8 692 T
--0.39 (For example, suppose ) 108 668 P
-7 F
--0.94 (inputf) 214.76 668 P
--0.94 (ile) 257.93 668 P
-0 F
--0.39 ( contains \322) 279.52 668 P
-6 F
--0.94 (This) 330.04 668 P
-8 F
--0.43 (z) 358.82 668 P
-6 F
--0.94 (is) 363.8 668 P
-8 F
--0.43 (z) 378.19 668 P
-6 F
--0.94 (a) 383.17 668 P
-8 F
--0.43 (z) 390.36 668 P
-6 F
--0.94 (test) 395.34 668 P
-9 F
--0.39 (\277) 424.13 668 P
-0 F
--0.39 (\323, and a 64-bit MAC is) 432.02 668 P
--0.73 (to be generated using CBC mode, the key \322) 72 648 P
-6 F
--1.74 (abcdef#@) 274.39 648 P
-0 F
--0.73 (\323 and the initialization vector ) 331.96 648 P
-6 F
--1.74 (0x0) 471.23 648 P
-0 F
--0.73 (; the com-) 492.82 648 P
-(mand is) 72 628 T
-6 F
-(bdes -m 64 -k abcdef#@ < ) 136.89 604 T
-7 F
-(inputf) 316.79 604 T
-(ile) 359.97 604 T
-6 F
-( > ) 381.56 604 T
-7 F
-(outputf) 403.15 604 T
-(ile) 453.52 604 T
-0 F
-(as CBC is the default encryption mode and ) 72 580 T
-6 F
-(0x0) 281.2 580 T
-0 F
-( the default initialization vector:) 302.79 580 T
-(text) 72 556 T
-6 F
-(T) 117 556 T
-(h) 144 556 T
-(i) 171 556 T
-(s) 198 556 T
-8 F
-(z) 225 556 T
-6 F
-(i) 252 556 T
-(s) 279 556 T
-8 F
-(z) 306 556 T
-6 F
-(a) 333 556 T
-8 F
-(z) 360 556 T
-6 F
-(t) 387 556 T
-(e) 414 556 T
-(s) 441 556 T
-(t) 468 556 T
-9 F
-(\277) 495 556 T
-0 F
-(hex) 72 536 T
-10 F
-(54) 117 536 T
-(68) 144 536 T
-(69) 171 536 T
-(73) 198 536 T
-(20) 225 536 T
-(69) 252 536 T
-(73) 279 536 T
-(20) 306 536 T
-(61) 333 536 T
-(20) 360 536 T
-(74) 387 536 T
-(65) 414 536 T
-(73) 441 536 T
-(74) 468 536 T
-(0a) 495 536 T
-0 F
-(input) 72 516 T
-10 F
-(54) 117 516 T
-(68) 144 516 T
-(69) 171 516 T
-(73) 198 516 T
-(20) 225 516 T
-(69) 252 516 T
-(73) 279 516 T
-(20) 306 516 T
-(61) 333 516 T
-(20) 360 516 T
-(74) 387 516 T
-(65) 414 516 T
-(73) 441 516 T
-(74) 468 516 T
-(0a) 495 516 T
-(00) 522 516 T
-0 F
-(output) 72 496 T
-10 F
-(43) 117 496 T
-(18) 144 496 T
-(de) 171 496 T
-(74) 198 496 T
-(24) 225 496 T
-(a9) 252 496 T
-(65) 279 496 T
-(d1) 306 496 T
-0 F
-0.04 (Notice that the text is 15 characters long, so there are 7 bytes following the last full block.) 108 476 P
-3 F
-(Bdes) 72 456 T
-0 F
-( pads this to a full block by appending a zero-\336lled byte. The result is then encrypted and the) 95.32 456 T
-(last block of output is used as the MAC.) 72 436 T
-0.06 (As another example, suppose we used the same text, and wanted a 36-bit MAC to be gen-) 108 412 P
-6.91 (erated using 40-bit CFB mode, the key \322) 72 392 P
-6 F
-16.58 (abcdef#@) 314.9 392 P
-0 F
-6.91 (\323 and the initialization vector) 372.47 392 P
-6 F
-(0x0123456789abcdef) 72 372 T
-0 F
-(; the command is) 201.53 372 T
-6 F
-(bdes -m 36 -f 40 -v 0x0123456789abcdef < ) 79.32 348 T
-7 F
-(inputf) 374.36 348 T
-(ile) 417.54 348 T
-6 F
-( > ) 439.13 348 T
-7 F
-(outputf) 460.71 348 T
-(ile) 511.09 348 T
-0 F
--0.19 (where ) 72 324 P
-4 F
--0.19 (\320m 36) 104.11 324 P
-0 F
--0.19 ( is the option to generate a 36-bit MAC, ) 134.91 324 P
-4 F
--0.19 (\320f 40) 327.79 324 P
-0 F
--0.19 ( indicates 40-bit CFB is to be used, and) 352.58 324 P
-4 F
--0.31 (\320v 0x123456789abcdef) 72 304 P
-0 F
--0.31 ( sets the initialization vector) 186.62 304 P
--0.31 (. Note that, as the key is not given on the com-) 319.95 304 P
-(mand line, the user will be prompted for it. It gives:) 72 284 T
-(text) 72 260 T
-6 F
-(T) 117 260 T
-(h) 144 260 T
-(i) 171 260 T
-(s) 198 260 T
-8 F
-(z) 225 260 T
-6 F
-(i) 252 260 T
-(s) 279 260 T
-8 F
-(z) 306 260 T
-6 F
-(a) 333 260 T
-8 F
-(z) 360 260 T
-6 F
-(t) 387 260 T
-(e) 414 260 T
-(s) 441 260 T
-(t) 468 260 T
-9 F
-(\277) 495 260 T
-0 F
-(hex) 72 240 T
-10 F
-(54) 117 240 T
-(68) 144 240 T
-(69) 171 240 T
-(73) 198 240 T
-(20) 225 240 T
-(69) 252 240 T
-(73) 279 240 T
-(20) 306 240 T
-(61) 333 240 T
-(20) 360 240 T
-(74) 387 240 T
-(65) 414 240 T
-(73) 441 240 T
-(74) 468 240 T
-(0a) 495 240 T
-0 F
-(input) 72 220 T
-10 F
-(54) 117 220 T
-(68) 144 220 T
-(69) 171 220 T
-(73) 198 220 T
-(20) 225 220 T
-(69) 252 220 T
-(73) 279 220 T
-(20) 306 220 T
-(61) 333 220 T
-(20) 360 220 T
-(74) 387 220 T
-(65) 414 220 T
-(73) 441 220 T
-(74) 468 220 T
-(0a) 495 220 T
-0 F
-(output) 72 200 T
-10 F
-(2b) 117 200 T
-(18) 144 200 T
-(68) 171 200 T
-(2d) 198 200 T
-(60) 225 200 T
-0 F
-0.19 (Note that the MAC is padded on the right by four zero bits to produce \336ve characters that) 108 180 P
-(can be output.) 72 160 T
-4 F
-(7. Differ) 72 128 T
-(ences Between ) 114.41 128 T
-1 F
-(bdes) 191.01 128 T
-4 F
-( and Sun\325) 212.99 128 T
-(s DES Implementation) 261.88 128 T
-0 F
-0.02 (The program ) 108 104 P
-3 F
-0.02 (bdes) 173.33 104 P
-0 F
-0.02 ( is designed to be completely compatible with Sun Microsystems, Inc.\325) 195.31 104 P
-0.02 (s) 535.33 104 P
-0.57 (implementation of the Data Encryption Standard, called ) 72 84 P
-3 F
-0.57 (des) 347.14 84 P
-0 F
-0.57 ( and described in [4]. Thus, \336les en-) 363.13 84 P
-FMENDPAGE
-%%EndPage: "6" 9
-%%Page: "7" 9
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 7 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
-0.44 (crypted using ) 72 712 P
-3 F
-0.44 (des) 140.84 712 P
-0 F
-0.44 ( can be decrypted using ) 156.83 712 P
-3 F
-0.44 (bdes) 275.29 712 P
-0 F
-0.44 (, and vice versa, provided modes common to both) 297.27 712 P
--0.34 (are used. However) 72 692 P
--0.34 (, ) 160.41 692 P
-3 F
--0.34 (bdes) 166.06 692 P
-0 F
--0.34 ( does not allow \336les to be named on the command line, nor does it support) 188.05 692 P
--0.68 (hardware devices \050and so the ) 72 672 P
-4 F
--0.68 (-s) 210.83 672 P
-0 F
--0.68 ( and ) 219.49 672 P
-4 F
--0.68 (-f) 241.45 672 P
-0 F
--0.68 ( options of Sun\325) 249.44 672 P
--0.68 (s ) 323.71 672 P
-3 F
--0.68 (des) 330.7 672 P
-0 F
--0.68 ( are not available\051. Further) 346.69 672 P
--0.68 (, as encryption) 471.07 672 P
--0.05 (is the default, the Sun ) 72 652 P
-3 F
--0.05 (des) 179.01 652 P
-0 F
--0.05 ( ) 195 652 P
-4 F
--0.05 (-e) 197.95 652 P
-0 F
--0.05 ( option is not recognized. As the manual page to ) 207.27 652 P
-3 F
--0.05 (bdes) 441.6 652 P
-0 F
--0.05 ( is in the appen-) 463.59 652 P
-(dix, these dif) 72 632 T
-(ferences will not be elaborated upon further) 134.08 632 T
-(.) 343.24 632 T
-0.44 (Sun\325) 108 608 P
-0.44 (s ) 130 608 P
-3 F
-0.44 (des) 138.1 608 P
-0 F
-0.44 ( supports the use of special-purpose hardware to encrypt and decrypt. Although) 154.09 608 P
-3 F
-1.33 (bdes) 72 588 P
-0 F
-1.33 ( does not directly support the use of such hardware, it uses the library routine ) 93.98 588 P
-3 F
-1.33 (encrypt) 487.05 588 P
-0 F
-1.33 (\0503\051,) 523.02 588 P
--0.09 (which may) 72 568 P
--0.09 (. Hardware support was not included directly to support as lar) 124.1 568 P
--0.09 (ge a number of platforms) 419.11 568 P
-(as possible with installers needing to know as little about the hardware as possible.) 72 548 T
--0.08 (Sun\325) 108 524 P
--0.08 (s ) 130 524 P
-3 F
--0.08 (des) 137.58 524 P
-0 F
--0.08 ( supports only the CBC and ECB encryption modes; ) 153.57 524 P
-3 F
--0.08 (bdes) 407.07 524 P
-0 F
--0.08 ( supports all modes de-) 429.05 524 P
-0.26 (scribed in [3] \050although CFB and OFB are not completely supported\051 as well as both CBC-based) 72 504 P
-(and CFB-based MACs.) 72 484 T
-0.15 (Although input with length not a multiple of the block size is handled in the same way by) 108 460 P
--0.47 (both ) 72 440 P
-3 F
--0.47 (des) 95.85 440 P
-0 F
--0.47 ( and ) 111.84 440 P
-3 F
--0.47 (bdes) 134.21 440 P
-0 F
--0.47 (, dif) 156.19 440 P
--0.47 (ferent values of the padding bytes are used in all but the last byte of the input.) 174.82 440 P
-(Where ) 72 420 T
-3 F
-(bdes) 106.96 420 T
-0 F
-( puts zero bytes, ) 128.94 420 T
-3 F
-(des) 209.89 420 T
-0 F
-( puts bytes containing random values. The reason for Sun\325) 225.87 420 T
-(s doing) 505.02 420 T
-0.47 (so is to prevent a known plaintext attack on the \336le should an
-attacker determine that the input\325) 72 400 P
-0.47 (s) 535.33 400 P
--0.29 (length were a multiple of the block size. W) 72 380 P
--0.29 (ith ) 276.05 380 P
-3 F
--0.29 (bdes) 291.43 380 P
-0 F
--0.29 (, the plaintext contents of the last block of input) 313.41 380 P
-0.31 (for such a \336le is known \050a block with all bits zero\051. W) 72 360 P
-0.31 (ith ) 333.99 360 P
-3 F
-0.31 (des) 349.96 360 P
-0 F
-0.31 (, the plaintext contents of that block) 365.95 360 P
-0.73 (are not known. Cryptanalytically) 72 340 P
-0.73 (, given the information about the strength of the DES currently) 231.29 340 P
-0.2 (known, it is widely believed that known plaintext attacks are infeasible
-\050see for example [1]\051 and) 72 320 P
-1.86 (so initializing and invoking the pseudorandom number generator seems unnecessary) 72 300 P
-1.86 (. But this) 492.63 300 P
-(means that ciphertexts produced from a plaintext by ) 72 280 T
-3 F
-(bdes) 324.48 280 T
-0 F
-( and ) 346.47 280 T
-3 F
-(des) 369.78 280 T
-0 F
-( will dif) 385.77 280 T
-(fer in the last block.) 423.54 280 T
-4 F
-(Refer) 72 248 T
-(ences) 100.41 248 T
-0 F
-([1]) 72 224 T
-0.37 (D. Denning, \322The Data Encryption Standard: Fifteen Y) 108 224 P
-0.37 (ears of Public Scrutiny) 374.87 224 P
-0.37 (,\323 ) 484.8 224 P
-3 F
-0.37 (Pr) 496.49 224 P
-0.37 (oceed-) 508.04 224 P
--0.47 (ings of the Sixth Annual Computer Security Applications Confer) 108 204 P
--0.47 (ence) 411.65 204 P
-0 F
--0.47 ( pp. x\320xv \050Dec. 1990\051.) 433.62 204 P
-([2]) 72 180 T
-(A. Konheim, ) 108 180 T
-3 F
-(Cryptography: A Primer) 173.29 180 T
-0 F
-(, John W) 291.4 180 T
-(iley and Sons, Inc., New Y) 333.9 180 T
-(ork, NY \0501981\051.) 461.94 180 T
-([3]) 72 156 T
-3 F
-0.63 (DES Modes of Operation) 108 156 P
-0 F
-0.63 (, Federal Information Processing Standards Publication 81, Na-) 231.47 156 P
--0.07 (tional Bureau of Standards, U.S. Department of Commerce, W) 108 136 P
--0.07 (ashington, DC \050Dec. 1980\051.) 407.62 136 P
-([4]) 72 112 T
-3 F
-(UNIX User) 108 112 T
-(\325) 162.74 112 T
-(s Manual) 165.18 112 T
-0 F
-(, Sun Microsystems Inc., Mountain V) 210.16 112 T
-(iew) 390 112 T
-(, CA \050Mar) 406.54 112 T
-(. 1988\051.) 455.51 112 T
-4 F
-(Appendix. The UNIX System Manual Page for ) 72 80 T
-1 F
-(bdes) 313.2 80 T
-FMENDPAGE
-%%EndPage: "7" 10
-1 11 /Times-Bold FMDEFINEFONT
-%%Page: "8" 10
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 8 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-1 F
-0 X
-(NAME) 72 712.67 T
-0 F
-(bdes - encrypt/decrypt using the Data Encryption Standard) 108 689 T
-1 F
-(SYNOPSIS) 72 663.67 T
-4 F
-(bdes) 108 640 T
-0 F
-( [) 131.33 640 T
-3 F
-( ) 138.32 640 T
-4 F
-(-abdp) 141.32 640 T
-0 F
-( ] [ ) 171.31 640 T
-4 F
-(-F) 188.3 640 T
-0 F
-( ) 199.62 640 T
-3 F
-(b) 202.62 640 T
-0 F
-( ] [ ) 208.61 640 T
-4 F
-(-f) 225.6 640 T
-0 F
-( ) 233.58 640 T
-3 F
-(b) 236.58 640 T
-0 F
-( ] [ ) 242.58 640 T
-4 F
-(-k) 259.56 640 T
-0 F
-( ) 270.22 640 T
-3 F
-(key) 273.22 640 T
-0 F
-( ] [ ) 289.2 640 T
-4 F
-(-m) 306.18 640 T
-0 F
-( ) 320.16 640 T
-3 F
-(b) 323.16 640 T
-0 F
-( ] [ ) 329.16 640 T
-4 F
-(-o) 346.14 640 T
-0 F
-( ) 356.13 640 T
-3 F
-(b) 359.13 640 T
-0 F
-( ] [ ) 365.13 640 T
-4 F
-(-v) 382.11 640 T
-0 F
-( ) 392.1 640 T
-3 F
-(vector) 395.1 640 T
-0 F
-( ]) 425.07 640 T
-1 F
-(DESCRIPTION) 72 614.67 T
-3 F
--0.69 (Bdes) 108 591 P
-0 F
--0.69 ( reads from the standard input and writes on the standard output. It implements all DES) 131.32 591 P
--0.09 (modes of operation described in FIPS PUB 81 including alternative cipher feedback mode) 108 577 P
-0.74 (and both authentication modes. All modes but the electronic code book mode require an) 108 563 P
--0.14 (initialization vector; if none is supplied, the zero vector is used. T) 108 549 P
--0.14 (o protect the key and ini-) 420.44 549 P
-0.29 (tialization vector from being read by) 108 535 P
-3 F
-0.29 ( ps) 284.98 535 P
-0 F
-0.29 (\0501\051, ) 298.94 535 P
-3 F
-0.29 (bdes ) 319.21 535 P
-0 F
-0.29 (hides its ar) 344.48 535 P
-0.29 (guments on entry) 396.81 535 P
-0.29 (. If no ) 479.89 535 P
-3 F
-0.29 (key ) 512.74 535 P
-0 F
-0.29 (is) 532 535 P
--0.61 (given, one is requested from the controlling terminal if that can be opened, or from the stan-) 108 521 P
-(dard input if not.) 108 507 T
--0.17 (The key and initialization vector are taken as sequences of ) 108 489 P
-5 F
--0.14 (ASCII) 389.38 489 P
-0 F
--0.17 ( characters which are then) 415.48 489 P
--0.35 (mapped into their bit representations. If either begins with
-\3240x\325 or \3240X\325, that one is taken as) 108 475 P
-1.02 (a sequence of hexadecimal digits indicating the bit pattern; if either begins with \3240b\325 or) 108 461 P
--0.73 (\3240B\325, that one is taken as a sequence of binary digits
-indicating the bit pattern. In either case,) 108 447 P
--0.37 (only the leading 64 bits of the key or initialization vector are used, and if fewer than 64 bits) 108 433 P
-0.35 (are provided, enough 0 bits are appended to pad the key to 64 bits. Note that if the key is) 108 419 P
-0.03 (not entered on the command line, it is interpreted in the same way) 108 405 P
-0.03 (, because with 4.4 BSD,) 424.31 405 P
--0.36 (the password reading function ) 108 391 P
-3 F
--0.36 (getpass) 254.45 391 P
-0 F
--0.36 (\0503\051 allows enough characters for either hex or binary) 290.43 391 P
-(keys to be entered.) 108 377 T
-0.04 (According to the DES standard, the low-order bit of each character in the key string is de-) 108 359 P
--0.18 (leted. Since most ) 108 345 P
-5 F
--0.15 (ASCII) 192.75 345 P
-0 F
--0.18 ( representations set the high-order bit to 0, simply deleting the low-) 218.84 345 P
--0.29 (order bit ef) 108 331 P
--0.29 (fectively reduces the size of the key space from 2) 160.49 331 P
-5 F
--0.24 (56) 394.67 335.8 P
-0 F
--0.29 ( to 2) 404.67 331 P
-5 F
--0.24 (48) 425.41 335.8 P
-0 F
--0.29 ( keys. T) 435.4 331 P
--0.29 (o prevent this,) 472.29 331 P
--0.46 (the high-order bit must be a function depending in part upon the low-order bit; so, the high-) 108 317 P
-0.11 (order bit is set to whatever value gives odd parity) 108 303 P
-0.11 (. This preserves the key space size. Note) 345.05 303 P
-(this resetting of the parity bit is ) 108 289 T
-3 F
-(not) 260.92 289 T
-0 F
-( done if the key is given in binary or hex.) 276.24 289 T
--0.38 (By default, the standard input is encrypted using cipher block chaining mode and is written) 108 271 P
-0.18 (to the standard output. Using the same key for encryption and decryption preserves plain-) 108 257 P
-(text, so) 108 243 T
-( bdes ) 225.81 225 T
-3 F
-(key) 253.79 225 T
-0 F
-( < plaintext | bdes \320i ) 269.77 225 T
-3 F
-(key) 370.21 225 T
-0 F
-( ) 386.19 225 T
-(is a very expensive equivalent of ) 108 201 T
-3 F
-(cat) 268.54 201 T
-0 F
-(\0501\051.) 283.2 201 T
-(Options are:) 108 183 T
-( ) 108 165 T
-4 F
-(\320a) 111 165 T
-0 F
--0.75 (The key and initialization vector strings are to be taken as ) 144 165 P
-5 F
--0.62 (ASCII) 415.89 165 P
-0 F
--0.75 ( suppressing the spe-) 441.98 165 P
-0.3 (cial interpretation given to leading \3240x\325, \3240X\325, \3240b\325,
-and \3240B\325 characters. Note this) 144 151 P
-(\337ag applies to ) 144 137 T
-3 F
-(both) 214.29 137 T
-0 F
-( the key and initialization vector) 235.62 137 T
-(.) 389.85 137 T
-4 F
-(\320b) 108 119 T
-0 F
-(Use electronic code book mode.) 144 119 T
-4 F
-(\320d) 108 101 T
-0 F
-(Decrypt the input.) 144 101 T
-FMENDPAGE
-%%EndPage: "8" 11
-%%Page: "9" 11
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 9 of 11) 479.71 34.7 T
-72 72 540 720 R
-7 X
-V
-4 F
-0 X
-(\320f) 108 712 T
-0 F
-( ) 117.99 712 T
-3 F
-(b) 120.99 712 T
-0 F
--0.29 (Use ) 144 712 P
-3 F
--0.29 (b) 165.36 712 P
-0 F
--0.29 (-bit cipher feedback mode. Currently ) 171.35 712 P
-3 F
--0.29 (b) 350.42 712 P
-0 F
--0.29 ( must be a multiple of 8 between 8 and) 356.42 712 P
-(64 inclusive \050this does not conform to the standard CFB mode speci\336cation\051.) 144 698 T
-4 F
-(\320F) 108 680 T
-0 F
-( ) 121.32 680 T
-3 F
-(b) 124.32 680 T
-0 F
--0.29 (Use ) 144 680 P
-3 F
--0.29 (b) 165.36 680 P
-0 F
--0.29 (-bit alternative cipher feedback mode. Currently ) 171.36 680 P
-3 F
--0.29 (b) 403.77 680 P
-0 F
--0.29 ( must be a multiple of 7 be-) 409.77 680 P
--0.12 (tween 7 and 56 inclusive \050this does not conform to the alternative CFB mode spec-) 144 666 P
-(i\336cation\051.) 144 652 T
-4 F
-(\320k) 108 634 T
-0 F
-( ) 120.67 634 T
-3 F
-(key) 123.66 634 T
-0 F
-0.37 (Use the string ) 144 616 P
-3 F
-0.37 (key) 214.74 616 P
-0 F
-0.37 ( as the cryptographic key) 230.72 616 P
-0.37 (. If this ar) 352.01 616 P
-0.37 (gument is not given, the user) 399.54 616 P
-(will be prompted for the key) 144 602 T
-(.) 280.12 602 T
-4 F
-(\320m) 108 584 T
-0 F
-( ) 123.99 584 T
-3 F
-(b) 126.99 584 T
-0 F
-0.71 (Compute a message authentication code \050MAC\051 of ) 144 584 P
-3 F
-0.71 (b) 395.78 584 P
-0 F
-0.71 ( bits on the input. ) 401.77 584 P
-3 F
-0.71 (b) 491.94 584 P
-0 F
-0.71 ( must be) 497.94 584 P
-0.11 (between 1 and 64 inclusive; if ) 144 570 P
-3 F
-0.11 (b) 291.87 570 P
-0 F
-0.11 ( is not a multiple of 8, enough 0 bits will be added) 297.86 570 P
--0.44 (to pad the MAC length to the nearest multiple of 8. Only the MAC is output. MACs) 144 556 P
-(are only available in cipher block chaining mode or in cipher feedback mode.) 144 542 T
-4 F
-(\320o) 108 524 T
-0 F
-( ) 119.99 524 T
-3 F
-(b) 122.99 524 T
-0 F
--0.34 (Use ) 144 524 P
-3 F
--0.34 (b) 165.31 524 P
-0 F
--0.34 (-bit output feedback mode. Currently ) 171.31 524 P
-3 F
--0.34 (b) 350.83 524 P
-0 F
--0.34 ( must be a multiple of 8 between 8 and) 356.83 524 P
-(64 inclusive \050this does not conform to the OFB mode speci\336cation\051.) 144 510 T
-4 F
-(\320p) 108 492 T
-0 F
--0.14 (Disable the resetting of the parity bit. This \337ag forces the parity bit of the key to be) 144 492 P
-0.03 (used as typed, rather than making each character be of odd parity) 144 478 P
-0.03 (. It is used only if) 455.91 478 P
-(the key is given in ) 144 464 T
-5 F
-(ASCII) 234.95 464 T
-0 F
-(.) 261.04 464 T
-4 F
-(\320v) 108 446 T
-0 F
-( ) 119.99 446 T
-3 F
-(vector) 122.99 446 T
-0 F
--0.5 (Set the initialization vector to ) 144 428 P
-3 F
--0.5 (v) 286.44 428 P
-0 F
--0.5 (; the vector is interpreted in the same way as the key) 291.76 428 P
--0.5 (.) 537 428 P
-(The vector is ignored in electronic codebook mode.) 144 414 T
--0.55 (The DES is considered a very strong cryptosystem, and other than table lookup attacks, key) 108 396 P
-0.24 (search attacks, and Hellman\325) 108 382 P
-0.24 (s time-memory tradeof) 246.61 382 P
-0.24 (f \050all of which are very expensive and) 356.8 382 P
-0.66 (time-consuming\051, no cryptanalytic methods for breaking the DES are known in the open) 108 368 P
-0.33 (literature. No doubt the choice of keys and key security are the most vulnerable aspect of) 108 354 P
-3 F
-(bdes) 108 340 T
-0 F
-(.) 129.98 340 T
-4 F
-(IMPLEMENT) 72 314 T
-(A) 146.41 314 T
-(TION NOTES) 154.18 314 T
-0 F
-0.57 (For implementors wishing to write software compatible with this program, the following) 108 290 P
--0.23 (notes are provided. This software is completely compatible with the implementation of the) 108 276 P
-(data encryption standard distributed by Sun Microsystems, Inc.) 108 262 T
-0.11 (In the ECB and CBC modes, plaintext is encrypted in units of 64 bits \0508 bytes, also called) 108 244 P
-0.52 (a block\051. T) 108 230 P
-0.52 (o ensure that the plaintext \336le is encrypted correctly) 160.49 230 P
-0.52 (, ) 413.01 230 P
-3 F
-0.52 (bdes ) 419.53 230 P
-0 F
-0.52 (will \050internally\051 ap-) 445.03 230 P
-0.29 (pend from 1 to 8 bytes, the last byte containing an integer stating how many bytes of that) 108 216 P
--0.71 (\336nal block are from the plaintext \336le, and encrypt the resulting block. Hence, when decrypt-) 108 202 P
-0.27 (ing, the last block may contain from 0 to 7 characters present in the plaintext \336le, and the) 108 188 P
--0.59 (last byte tells how many) 108 174 P
--0.59 (. Note that if during decryption the last byte of the \336le does not con-) 221.46 174 P
-0.41 (tain an integer between 0 and 7, either the \336le has been corrupted or an incorrect key has) 108 160 P
-0.48 (been given. A similar mechanism is used for the OFB and CFB modes, except that those) 108 146 P
-0.26 (simply require the length of the input to be a multiple of the mode size, and the \336nal byte) 108 132 P
--0.73 (contains an integer between 0 and one less than the number of bytes being used as the mode.) 108 118 P
-(\050This was another reason that the mode size must be a multiple of 8 for those modes.\051) 108 104 T
-FMENDPAGE
-%%EndPage: "9" 12
-%%Page: "10" 12
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 10 of 11) 473.71 34.7 T
-72 72 540 720 R
-7 X
-V
-0 X
-0.94 (Unlike Sun\325) 108 712 P
-0.94 (s implementation, unused bytes of that last block are not \336lled with random) 166.58 712 P
-0.57 (data, but instead contain what was in those byte positions in the preceding block. This is) 108 698 P
-(quicker and more portable, and does not weaken the encryption signi\336cantly) 108 684 T
-(.) 473.95 684 T
-0.36 (If the key is entered in ) 108 666 P
-5 F
-0.3 (ASCII) 220.76 666 P
-0 F
-0.36 (, the parity bits of the key characters are set so that each key) 246.85 666 P
-1.03 (character is of odd parity) 108 652 P
-1.03 (. Unlike Sun\325) 231.23 652 P
-1.03 (s implementation, it is possible to enter binary or) 296.92 652 P
--0.57 (hexadecimal keys on the command line, and if this is done, the parity bits are ) 108 638 P
-3 F
--0.57 (not ) 472.85 638 P
-0 F
--0.57 (reset. This) 490.61 638 P
-(allows testing using arbitrary bit patterns as keys.) 108 624 T
-0.64 (The Sun implementation always uses an initialization vector of 0 \050that is, all zeroes\051. By) 108 606 P
-(default, ) 108 592 T
-3 F
-(bdes ) 147.3 592 T
-0 F
-(does too, but this may be changed from the command line.) 172.29 592 T
-4 F
-(FILES) 72 566 T
-0 F
-(/dev/tty) 108 542 T
-(controlling terminal for typed key) 180 542 T
-4 F
-(SEE ALSO) 72 516 T
-3 F
-(crypt) 108 492 T
-0 F
-(\0501\051, ) 132.65 492 T
-3 F
-(crypt) 152.63 492 T
-0 F
-(\0503\051) 177.27 492 T
-3 F
--0.4 (Data Encryption Standar) 108 474 P
--0.4 (d) 228.02 474 P
-0 F
--0.4 (, Federal Information Processing Standard #46, National Bureau) 234.02 474 P
-(of Standards, U.S. Department of Commerce, W) 108 460 T
-(ashington DC \050Jan. 1977\051.) 340.2 460 T
-3 F
-0.16 (DES) 108 442 P
-0 F
-0.16 ( ) 129.98 442 P
-3 F
-0.16 (Modes of Operation, ) 133.15 442 P
-0 F
-0.16 (Federal Information Processing Standard #81, National Bureau) 236.24 442 P
-(of Standards, U.S. Department of Commerce, W) 108 428 T
-(ashington DC \050Dec. 1980\051.) 340.2 428 T
-2.75 (Dorothy Denning, ) 108 410 P
-3 F
-2.75 (Cryptography and Data Security) 203.77 410 P
-0 F
-2.75 (, Addison-W) 368.8 410 P
-2.75 (esley Publishing Co.,) 432.55 410 P
-(Reading, MA \2511982.) 108 396 T
--0.19 ( Matt Bishop, \322Implementation Notes on ) 108 378 P
-3 F
--0.19 (bdes) 305.76 378 P
-0 F
--0.19 (\0501\051\323, T) 327.75 378 P
--0.19 (echnical Report PCS-TR-91-158, De-) 359.35 378 P
-0.34 (partment of Mathematics and Computer Science, Dartmouth College, Hanover) 108 364 P
-0.34 (, NH \050Apr) 488.01 364 P
-0.34 (.) 537 364 P
-(1991\051.) 108 350 T
-4 F
-(CAUTION) 72 324 T
-0 F
--0.55 (Certain speci\336c keys should be avoided because they introduce potential weaknesses; these) 108 300 P
--0.44 (keys, called the ) 108 286 P
-3 F
--0.44 (weak) 183.95 286 P
-0 F
--0.44 ( and ) 208.6 286 P
-3 F
--0.44 (semiweak) 231.03 286 P
-0 F
--0.44 ( keys, are \050in hex notation, where ) 277.66 286 P
-6 F
--1.06 (p) 437.45 286 P
-0 F
--0.44 ( is either ) 444.64 286 P
-6 F
--1.06 (0) 487.63 286 P
-0 F
--0.44 ( or ) 494.82 286 P
-6 F
--1.06 (1) 509.93 286 P
-0 F
--0.44 (, and) 517.12 286 P
-6 F
-(P) 108 272 T
-0 F
-( is either ) 115.2 272 T
-6 F
-(e) 159.5 272 T
-0 F
-( or ) 166.7 272 T
-6 F
-(f) 182.68 272 T
-0 F
-(\051:) 189.88 272 T
-6 F
-(0x0p0p0p0p0p0p0p0p) 144 254 T
-(0x0p1P0p1P0p0P0p0P) 360 254 T
-(0x0pep0pep0pfp0pfp) 144 236 T
-(0x0pfP0pfP0pfP0pfP) 360 236 T
-(0x1P0p1P0p0P0p0P0p) 144 218 T
-(0x1P1P1P1P0P0P0P0P) 360 218 T
-(0x1Pep1Pep0Pfp0Pfp) 144 200 T
-(0x1PfP1PfP0PfP0PfP) 360 200 T
-(0xep0pep0pfp0pfp0p) 144 182 T
-(0xep1Pep1pfp0Pfp0P) 360 182 T
-(0xepepepepepepepep) 144 164 T
-(0xepfPepfPfpfPfpfP) 360 164 T
-(0xfP0pfP0pfP0pfP0p) 144 146 T
-(0xfP1PfP1PfP0PfP0P) 360 146 T
-(0xfPepfPepfPepfPep) 144 128 T
-(0xfPfPfPfPfPfPfPfP) 360 128 T
-0 F
-0.13 (The weakness of these keys is inherent in the DES algorithm \050see for example Moore and) 108 110 P
--0.57 (Simmons, \322Cycle structure of the DES with weak and semi-weak keys,\323) 108 96 P
-3 F
--0.57 ( Advances in Cryp-) 449.43 96 P
-(tology \320 Crypto \32486 Pr) 108 82 T
-(oceedings) 216.83 82 T
-0 F
-(, Springer) 264.79 82 T
-(-V) 311.85 82 T
-(erlag New Y) 323.17 82 T
-(ork, \2511987, pp. 9-32\051.) 383.25 82 T
-FMENDPAGE
-%%EndPage: "10" 13
-%%Page: "11" 13
-612 792 0 FMBEGINPAGE
-72 745.99 540 756 R
-7 X
-0 K
-V
-72 32.69 540 42.7 R
-V
-0 F
-0 X
-(Page 11 of 11) 473.71 34.7 T
-72 72 540 720 R
-7 X
-V
-4 F
-0 X
-(BUGS) 72 712 T
-0 F
--0.18 (There is a controversy raging over whether the DES will still be secure in a few years. The) 108 688 P
-0.31 (advent of special-purpose hardware could reduce the cost of any of the methods of attack) 108 674 P
-(named above so that they are no longer computationally infeasible.) 108 660 T
-0.32 (Programs which display programs\325 ar) 108 642 P
-0.32 (guments may compromise the key and initialization) 289.59 642 P
-0.76 (vector if they are speci\336ed on the command line. T) 108 628 P
-0.76 (o avoid this ) 358.46 628 P
-3 F
-0.76 (bdes) 419.7 628 P
-0 F
-0.76 ( overwrites its ar) 441.68 628 P
-0.76 (gu-) 524.01 628 P
-(ments. However) 108 614 T
-(, the obvious race cannot currently be avoided.) 186.12 614 T
-0.25 (As the key or key schedule is kept in memory throughout the run of this program, the en-) 108 596 P
-(cryption can be compromised if memory is readable.) 108 582 T
--0.4 (There is no warranty of merchantability nor any warranty of \336tness for a particular purpose) 108 564 P
-0.05 (nor any other warranty) 108 550 P
-0.05 (, either express or implied, as to the accuracy of the enclosed mate-) 216.95 550 P
-(rials or as to their suitability for any particular purpose.) 108 536 T
--0.06 (Accordingly) 108 518 P
--0.06 (, the user assumes full responsibility for their use. Further) 167.18 518 P
--0.06 (, the author assumes) 442.93 518 P
--0.25 (no obligation to furnish any assistance of any kind whatsoever) 108 504 P
--0.25 (, or to furnish any additional) 404.69 504 P
-(information or documentation.) 108 490 T
-4 F
-(AUTHOR) 72 464 T
-0 F
--0.54 (Matt Bishop, Department of Mathematics and Computer Science, Bradley Hall, Dartmouth) 108 440 P
-(College, Hanover) 108 426 T
-(, NH 03755) 192.12 426 T
-(Electronic mail addresses:) 108 408 T
-(Internet: Matt.Bishop@dartmouth.edu) 108 390 T
-(UUCP: decvax!dartvax!Matt.Bishop) 108 372 T
-FMENDPAGE
-%%EndPage: "11" 14
-%%Trailer
-%%BoundingBox: 0 0 612 792
-%%Pages: 13 1
-%%DocumentFonts: Helvetica-Bold
-%%+ Helvetica-BoldOblique
-%%+ Times-Roman
-%%+ Times-Bold
-%%+ Times-BoldItalic
-%%+ Times-Italic
-%%+ Courier
-%%+ Courier-Oblique
-%%+ ZapfDingbats
-%%+ Symbol
-%%+ Courier-Bold
diff --git a/usr.bin/compress/zcat.sh b/usr.bin/compress/zcat.sh
deleted file mode 100644
index c4931e4..0000000
--- a/usr.bin/compress/zcat.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh -
-#
-# Copyright (c) 1992, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. 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.
-#
-# @(#)zcat.sh 8.1 (Berkeley) 6/6/93
-#
-
-uncompress -c $*
diff --git a/usr.bin/diff/diff/diff.1 b/usr.bin/diff/diff/diff.1
deleted file mode 100644
index 1b5c078..0000000
--- a/usr.bin/diff/diff/diff.1
+++ /dev/null
@@ -1,387 +0,0 @@
-.\" Copyright (c) 1980, 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.
-.\"
-.\" @(#)diff.1 8.1 (Berkeley) 6/30/93
-.\"
-.Dd June 30, 1993
-.Dt DIFF 1
-.Os BSD 4
-.Sh NAME
-.Nm diff
-.Nd differential file and directory comparator
-.Sh SYNOPSIS
-.Nm diff
-.Op Fl cefhn
-.Op Fl biwt
-.Ar file1 file2
-.Nm diff
-.Op Fl D Ns Ar string
-.Op Fl biw
-.Ar file1 file2
-.Nm diff
-.Op Fl l
-.Op Fl r
-.Op Fl s
-.Op Fl cefhn
-.Op Fl biwt
-.Op Fl S Ns Ar name
-.Ar dir1 dir2
-.Sh DESCRIPTION
-The
-.Nm diff
-utility compares the contents of
-.Ar file1
-and
-.Ar file2
-and writes to the standard output the list of changes necessary to
-convert one file into the other.
-No output is produced if the files are identical.
-.Pp
-Output options (mutually exclusive):
-.Bl -tag -width Ds
-.It Fl c
-produces a diff with lines of context.
-The default is to present 3 lines of context and may be changed, e.g., to 10, by
-.Fl c10 .
-With
-.Fl c
-the output format is modified slightly:
-the output beginning with identification of the files involved and
-their creation dates and then each change is separated
-by a line with a dozen *'s.
-The lines removed from
-.Ar file1
-are marked with `\(mi '; those added to
-.Ar file2
-are marked `+ '. Lines which are changed from one
-file to the other are marked in both files with `! '.
-Changes which lie within <context> lines of each other are grouped
-together on output. (This is a change from the previous ``diff -c''
-but the resulting output is usually much easier to interpret.)
-.It Fl e
-produces output in a form suitable as input for the editor utility,
-.Xr ed 1 ,
-which can then be used to convert file1 into file2.
-.Pp
-Extra commands are added to the output when comparing directories with
-.Fl e ,
-so that the result is a
-.Xr sh 1
-script for converting text files which are common to the two directories
-from their state in
-.Ar dir1
-to their state in
-.Ar dir2 .
-.It Fl f
-identical output to that of the
-.Fl e
-flag, but in reverse order. It cannot
-be digested by
-.Xr ed 1 .
-.It Fl h
-Invokes an alternate algorithm which can handle files of very long lengths.
-There is a trade off. The algorithm can only deal with changes which are
-clearly delimited and brief. Long sections of changes and overlaps will
-confuse it.
-.It Fl n
-produces a script similar to that of
-.Fl e ,
-but in the opposite order and with a count of changed lines on each
-insert or delete command. This is the form used by
-.Xr rcsdiff 1 .
-.It Fl D Ns Ar string
-creates a merged version of
-.Ar file1
-and
-.Ar file2
-on the standard output, with C preprocessor controls included so that
-a compilation of the result without defining
-.Ar string
-is equivalent
-to compiling
-.Ar file1 ,
-while defining
-.Ar string
-will yield
-.Ar file2 .
-.El
-.Pp
-Comparison options:
-.Bl -tag -width Ds
-.It Fl b
-causes trailing blanks (spaces and tabs) to be ignored, and other
-strings of blanks to compare equal.
-.It Fl i
-ignores the case of letters. E.g., ``A'' will compare equal to ``a''.
-.It Fl t
-will expand tabs in output lines. Normal or
-.Fl c
-output adds character(s) to the front of each line which may screw up
-the indentation of the original source lines and make the output listing
-difficult to interpret. This option will preserve the original source's
-indentation.
-.It Fl w
-is similar to
-.Fl b
-but causes whitespace (blanks and tabs) to be totally ignored. E.g.,
-``if\ (\ a\ ==\ b\ )'' will compare equal to ``if(a==b)''.
-.El
-.Pp
-Directory comparison options:
-.Bl -tag -width Ds
-.It Fl l
-long output format; each text file
-.Nm diff Ns \'d
-is piped through
-.Xr pr 1
-to paginate it,
-other differences are remembered and summarized
-after all text file differences are reported.
-.It Fl r
-causes application of
-.Nm diff
-recursively to common subdirectories encountered.
-.It Fl s
-causes
-.Nm diff
-to report files which are the same, which are otherwise not mentioned.
-.It Fl S Ns Ar name
-re-starts a directory
-.Nm diff
-in the middle beginning with file
-.Ar name .
-.El
-.Pp
-If both arguments are directories,
-.Nm diff
-sorts the contents of the directories by name, and then runs the
-regular file
-.Nm diff
-algorithm, producing a change list,
-on text files which are different.
-Binary files which differ,
-common subdirectories, and files which appear in only one directory
-are described as such.
-.Pp
-If only one of
-.Ar file1
-and
-.Ar file2
-is a directory,
-.Nm diff
-is applied to the non-directory file and the file contained in
-the directory file with a filename that is the same as the
-last component of the non-directory file.
-.Pp
-If either
-.Ar file1
-or
-.Ar file2
-is
-.Sq Fl ,
-the standard input is
-used in its place.
-.Ss Output Style
-The default (without
-.Fl e ,
-.Fl c ,
-or
-.Fl n
-.\" -C
-options)
-output contains lines of these forms, where
-.Va XX , YY , ZZ , QQ
-are line numbers respective of file order.
-.Pp
-.Bl -tag -width "XX,YYcZZ,QQ" -compact
-.It Li XX Ns Ic a Ns Li YY
-At (the end of) line
-.Va XX
-of
-.Ar file1 ,
-append the contents
-of line
-.Va YY
-of
-.Ar file2
-to make them equal.
-.It Li XX Ns Ic a Ns Li YY,ZZ
-Same as above, but append the range of lines,
-.Va YY
-through
-.Va ZZ
-of
-.Ar file2
-to line
-.Va XX
-of file1.
-.It Li XX Ns Ic d Ns Li YY
-At line
-.Va XX
-delete
-the line. The value
-.Va YY
-tells to which line the change
-would bring
-.Ar file1
-in line with
-.Ar file1 .
-.It Li XX,YY Ns Ic d Ns Li ZZ
-Delete the range of lines
-.Va XX
-through
-.Va YY
-in
-.Ar file1 .
-.It Li XX Ns Ic c Ns Li YY
-Change the line
-.Va XX
-in
-.Ar file1
-to the line
-.Va YY
-in
-.Ar file2.
-.It Li XX,YY Ns Ic c Ns Li ZZ
-Replace the range of specified lines with the line
-.Va ZZ .
-.It Li XX,YY Ns Ic c Ns Li ZZ,QQ
-Replace the range
-.Va XX , Ns YY
-from
-.Ar file1
-with the range
-.Va ZZ , Ns QQ
-from
-.Ar file2 .
-.El
-.Pp
-These lines resemble
-.Xr ed 1
-subcommands to convert
-.Ar file1
-into
-.Ar file2 .
-The line numbers before the action letters pertain to
-.Ar file1 ;
-those after pertain to
-.Ar file2 .
-Thus, by exchanging
-.Ic a
-for
-.Ic d
-and reading the line in reverse order, one can also
-determine how to convert
-.Ar file2
-into
-.Ar file1 .
-As in
-.Xr ed 1 ,
-identical
-pairs (where num1 = num2) are abbreviated as a single
-number.
-.Sh ENVIRONMENT
-.Bl -tag -width TMPDIR
-.It Ev TMPDIR
-If the environment variable
-.Ev TMPDIR
-exists,
-.Nm diff
-will use the directory specified by
-.Ev TMPDIR
-as the temporary directory.
-.El
-.Sh FILES
-.Bl -tag -width /usr/bin/diffh -compact
-.It Pa /tmp/d?????
-.It Pa /usr/bin/diffh
-Alternate algorithm version (used by option
-.Fl h ) .
-.It Pa /usr/bin/diff
-for directory diffs
-.It Pa /usr/bin/pr
-used by the
-.Fl l
-option.
-.El
-.Sh SEE ALSO
-.Xr cmp 1 ,
-.Xr cc 1 ,
-.Xr comm 1 ,
-.Xr ed 1 ,
-.Xr diff3 1
-.br
-.ne 1i
-.Sh DIAGNOSTICS
-The
-.Nm diff
-utility exits with one of the following values:
-.Pp
-.Bl -tag -width Ds -compact -offset indent
-.It \&0
-No differences were found.
-.It \&1
-Differences were found.
-.It "\&>\&1"
-An error occurred.
-.El
-.Sh BUGS
-The
-.Fl f
-and
-.Fl e
-options
-do not provide special handling for lines on which the
-first and only character is
-.Dq Li \&. .
-This can cause problems for
-.Xr ed 1 .
-.Pp
-When comparing directories with the
-.Fl b ,
-.Fl w
-or
-.Fl i
-options specified,
-.Nm diff
-first compares the files ala
-.Ar cmp ,
-and then decides to run the
-.Nm diff
-algorithm if they are not equal.
-This may cause a small amount of spurious output if the files
-then turn out to be identical because the only differences are
-insignificant white space or case differences.
-.Sh HISTORY
-A
-.Nm
-command appeared in
-.At v6 .
diff --git a/usr.bin/diff/diff3/diff3.1 b/usr.bin/diff/diff3/diff3.1
deleted file mode 100644
index 09b1d72..0000000
--- a/usr.bin/diff/diff3/diff3.1
+++ /dev/null
@@ -1,172 +0,0 @@
-.\" Copyright (c) 1990, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)diff3.1 8.2 (Berkeley) 4/18/94
-.\"
-.Dd April 18, 1994
-.Dt DIFF3 1
-.Os BSD 4.3R
-.Sh NAME
-.Nm diff3
-.Nd 3-way differential file comparison
-.Sh SYNOPSIS
-.Nm diff3
-.Op Fl exEX3
-.Ar file1 file2 file3
-.Sh DESCRIPTION
-The
-.Nm diff3
-utility compares the contents of three different versions of a file,
-.Ar file1 ,
-.Ar file2
-and
-.Ar file3 ,
-writing the result to the standard output.
-The options describe different methods of merging and
-purging
-the separate versions into a new file.
-.Nm Diff3
-is used by
-.Xr RCS 1
-to merge specific versions or create
-new versions.
-.Pp
-Options are:
-.Bl -tag -width "--E, --X"
-.It Fl e
-Produces output in a form suitable as an input script for the
-.Xr ed 1
-utility. The script may then be used to merge differences common
-between all three files and differences specific to file1 and file3.
-In other words, the
-.Fl e
-option ignores differences specific to file1 and file2, and those
-specific to file2 and file3. It is useful for backing out changes
-specific to file2 only.
-.It Fl x
-Produces an output script suitable for
-.Xr ed 1
-with changes
-specific only to all three versions.
-.It Fl 3
-Produces an output script suitable for
-.Xr ed 1
-with changes
-specific only to file3.
-.It Fl E , X
-Similar to
-.Fl e
-and
-.Fl x ,
-respectively, but treat overlapping changes (i.e., changes that would
-be noted with ==== in the normal listing) differently. The overlapping
-lines from both files will be inserted by the edit script, bracketed
-by "<<<<<<" and ">>>>>>" lines.
-.El
-.Pp
-The
-.Fl E
-option is used by
-.Tn RCS
-.Xr merge 1
-to insure that overlapping changes in the merged files are preserved
-and brought to someone's attention.
-.Pp
-For example, suppose lines 7-8 are changed in both file1 and file2.
-Applying the edit script generated by the command
-.Pp
-.Dl diff3 -E file1 file2 file3
-.Pp
-to file1 results in the file:
-.Pp
-.Bd -literal -offset indent -compact
-lines 1-6
-of file1
-<<<<<<< file1
-lines 7-8
-of file1
-=======
-lines 7-8
-of file3
->>>>>>> file3
-rest of file1
-.Ed
-.Pp
-The default output of
-.Nm diff3
-makes notation of the differences between all files, and those differences
-specific to each pair of files. The
-changes are described by
-the commands necessary for
-.Xr ed 1
-to create the desired target from the different versions.
-See
-.Xr diff 1
-for a description of the commands.
-.Bl -tag -width "====="
-.It Li \&====
-The lines beneath this notation are ranges of lines which are different
-between all files.
-.It \&==== Ns Va n
-The lines beneath this notation are ranges of lines which are exclusively
-different in file
-.Va n .
-.El
-.Sh FILES
-.Bl -tag -width /usr/bin/diff3 -compact
-.It Pa /tmp/d3?????
-temporary files.
-.It Pa /usr/bin/diff3
-the executable.
-.El
-.Sh SEE ALSO
-.Xr diff 1
-.Xr ed 1
-.Xr rcs 1
-.Sh BUGS
-The
-.Fl e
-option
-cannot catch and change
-lines which have
-.Ql \&.
-as the first and only character on the line.
-The resulting script will fail on that line
-as
-.Ql \&.
-is an
-.Xr ed 1
-editing command.
-.Sh HISTORY
-A
-.Nm
-command appeared in
-.At v7 .
diff --git a/usr.bin/grep/egrep/egrep.c b/usr.bin/grep/egrep/egrep.c
deleted file mode 100644
index 885965c..0000000
--- a/usr.bin/grep/egrep/egrep.c
+++ /dev/null
@@ -1,924 +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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)egrep.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- Hybrid Boyer/Moore/Gosper-assisted 'grep/egrep/fgrep' search, with delta0
- table as in original paper (CACM, October, 1977). No delta1 or delta2.
- According to experiment (Horspool, Soft. Prac. Exp., 1982), delta2 is of
- minimal practical value. However, to improve for worst case input,
- integrating the improved Galil strategies (Apostolico/Giancarlo, SIAM. J.
- Comput., Feb. 1986) deserves consideration.
-
- Method: extract longest metacharacter-free string from expression.
- this is done using a side-effect from henry spencer's regcomp().
- use boyer-moore to match such, then pass submatching lines
- to either regexp() or standard 'egrep', depending on certain
- criteria within execstrategy() below. [this tradeoff is due
- to the general slowness of the regexp() nondeterministic
- machine on complex expressions, as well as the startup time
- of standard 'egrep' on short files.] alternatively, one may
- change the vendor-supplied 'egrep' automaton to include
- boyer-moore directly. see accompanying writeup for discussion
- of kanji expression treatment.
-
- late addition: apply trickbag for fast match of simple
- alternations (sublinear, in common low-cardinality cases).
- trap fgrep into this lair.
-
- gnu additions: -f, newline as |, \< and \> [in regexec()], more
- comments. inspire better dfa exec() strategy.
- serious testing and help with special cases.
-
- Algorithm amalgam summary:
-
- dfa e?grep (aho/thompson)
- ndfa regexp() (spencer/aho)
- bmg (boyer/moore/gosper)
- "superimposed" bmg (jaw)
- fgrep (aho/corrasick)
-
- sorry, but the knuth/morris/pratt machine, horspool's
- "frequentist" code, and the rabin/karp matcher, however cute,
- just don't cut it for this production.
-
- James A. Woods Copyright (c) 1986
- NASA Ames Research Center
-*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <regexp.h> /* must be henry spencer's version */
-#include <stdio.h>
-#include <ctype.h>
-#include "pathnames.h"
-
-#define MIN(A, B) ((A) > (B) ? (B) : (A))
-
-#ifdef SLOWSYS
-#define read xread
-#endif
-
-#define BUFSIZE 8192 /* make higher for cray */
-#define PATSIZE 6000
-#define LARGE BUFSIZE + PATSIZE
-
-#define NALT 7 /* tied to scanf() size in alternate() */
-#define NMUSH 6 /* loosely relates to expected alt length */
-
-#define FIRSTFEW 33 /* Always do FIRSTFEW matches with regexec() */
-#define PUNTPERCENT 10 /* After FIRSTFEW, if PUNTPERCENT of the input
- * was processed by regexp(), exec std egrep. */
-#define NL '\n'
-#define EOS '\0'
-#define NONASCII 0200 /* Bit mask for Kanji non-ascii chars */
-#define META "\n^$.[]()?+*|\\" /* egrep meta-characters */
-#define SS2 '\216' /* EUC Katakana (or Chinese2) prefix */
-#define SS3 '\217' /* EUC Kanji2 (or Chinese3) prefix */
-
-extern char *optarg;
-extern int optind;
-char *progname;
-
-int cflag, iflag, eflag, fflag, lflag, nflag; /* SVID flags */
-int sflag, hflag; /* v7, v8, bsd */
-
-int firstflag; /* Stop at first match */
-int grepflag; /* Called as "grep" */
-int fgrepflag; /* Called as "fgrep" */
-int altflag; /* Simple alternation in pattern */
-int boyonly; /* No regexp needed -- all simple */
-int flushflag;
-int grepold, egrepold, fgrepold;
-
-int nalt; /* Number of alternatives */
-int nsuccess; /* 1 for match, 2 for error */
-int altmin; /* Minimum length of all the alternate
- * strings */
-int firstfile; /* argv index of first file argument */
-int patind; /* argv index of pattern */
-long nmatch; /* Number of matches in this file */
-long incount, counted; /* Amount of input consumed */
-long rxcount; /* Bytes of input processed by regexec() */
-int boyfound; /* accumulated partial matches (tripped by
- * FIRSTFEW) */
-int prevmatch; /* next three lines aid fast -n */
-long nline, prevnline;
-char *prevloc;
-
-regexp *rspencer;
-char *pattern;
-char *patboy; /* Pattern for simple Boyer-Moore */
-char *patfile; /* Filename containing pattern(s) */
-
-int delta0[256]; /* Boyer-Moore algorithm core */
-char cmap[256]; /* Usually 0-255, but if -i, maps upper to
- * lower case */
-char str[BUFSIZE + 2];
-int nleftover;
-char linetemp[BUFSIZE];
-char *altpat[NALT]; /* alternation component storage */
-int altlen[NALT];
-short altset[NMUSH + 1][256];
-char preamble[200]; /* match prefix (filename, line no.) */
-
-int fd;
-char *
-strchr(), *strrchr(), *strcpy(), *strncpy(), *strpbrk(), *malloc();
-char *
-grepxlat(), *fold(), *pfile(), *alternate(), *isolate();
-char *gotamatch(), *kanji(), *linesave(), *submatch();
-char **args;
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int c, oflag;
- int errflag = 0;
-
- args = argv;
-
- if ((progname = strrchr(argv[0], '/')) != 0)
- progname++;
- else
- progname = argv[0];
- if (strcmp(progname, "grep") == 0)
- grepflag++;
- else if (strcmp(progname, "fgrep") == 0)
- fgrepflag++;
-
- oflag = 0;
- while ((c = getopt(argc, argv, "bchie:f:lnosvwxy1")) != EOF) {
- switch (c) {
-
- case 'f':
- fflag++;
- patfile = optarg;
- continue;
- case 'b':
- case 'v':
- egrepold++; /* boyer-moore of little help here */
- continue;
- case 'c':
- cflag++;
- continue;
- case 'e':
- eflag++;
- pattern = optarg;
- continue;
- case 'h':
- hflag++;
- continue;
- case 'o':
- oflag++;
- continue;
- case '1': /* Stop at very first match */
- firstflag++; /* spead freaks only */
- continue;
- case 'i':
- iflag++;
- continue;
- case 'l':
- lflag++;
- continue;
- case 'n':
- nflag++;
- continue;
- case 's':
- sflag++;
- continue;
- case 'w':
- case 'y':
- if (!grepflag)
- errflag++;
- grepold++;
- continue;
- case 'x': /* needs more work, like -b above */
- if (!fgrepflag)
- errflag++;
- fgrepold++;
- continue;
- case '?':
- errflag++;
- }
- }
- if (errflag || ((argc <= optind) && !fflag && !eflag)) {
- if (grepflag)
-oops("usage: grep [-bchilnosvwy] [-e] pattern [file ...]");
- else if (fgrepflag)
-oops("usage: fgrep [-bchilnosvx] {-f patfile | [-e] strings} [file ...]");
- else /* encourage SVID options, though we provide
- * others */
-oops("usage: egrep [-bchilnosv] {-f patfile | [-e] pattern} [file ...]");
- }
- if (fflag)
- pattern = pfile(patfile);
- else if (!eflag) {
- patind = optind;
- pattern = argv[optind++];
- }
-
- if (!oflag && (argc - optind) <= 1) /* Filename invisible given < 2 files */
- hflag++;
- if (pattern[0] == EOS)
- kernighan(argv); /* same as it ever was */
- /*
- * 'grep/egrep' merger -- "old" grep is called to handle: tagged
- * exprs \( \), word matches \< and \>, -w and -y options, char
- * classes with '-' at end (egrep bug?), and patterns beginning with
- * an asterisk (don't ask why). otherwise, characters meaningful to
- * 'egrep' but not to 'grep' are escaped; the entire expr is then
- * passed to 'egrep'.
- */
- if (grepflag && !grepold) {
- if (strindex(pattern, "\\(") >= 0 ||
- strindex(pattern, "\\<") >= 0 ||
- strindex(pattern, "\\>") >= 0 ||
- strindex(pattern, "-]") >= 0 ||
- pattern[0] == '*') /* grep bug */
- grepold++;
- else
- pattern = grepxlat(pattern);
- }
- if (grepold || egrepold || fgrepold)
- kernighan(argv);
-
- if (iflag)
- strcpy(pattern, fold(pattern));
- /*
- * If the pattern is a plain string, just run boyer-moore. If it
- * consists of meta-free alternatives, run "superimposed" bmg.
- * Otherwise, find best string, and compile pattern for regexec().
- */
- if (strpbrk(pattern, META) == NULL) { /* do boyer-moore only */
- boyonly++;
- patboy = pattern;
- } else {
- if ((patboy = alternate(pattern)) != NULL)
- boyonly++;
- else {
- if ((patboy = isolate(pattern)) == NULL)
- kernighan(argv); /* expr too involved */
-#ifndef NOKANJI
- for (c = 0; pattern[c] != EOS; c++)
- if (pattern[c] & NONASCII) /* kanji + meta */
- kernighan(argv);
-#endif
- if ((rspencer = regcomp(pattern)) == NULL)
- oops("regcomp failure");
- }
- }
- gosper(patboy); /* "pre-conditioning is wonderful"
- * -- v. strassen */
-
- if ((firstfile = optind) >= argc) {
- /* Grep standard input */
- if (lflag) /* We don't know its name! */
- exit(1);
- egsecute((char *) NULL);
- } else {
- while (optind < argc) {
- egsecute(argv[optind]);
- optind++;
- if (firstflag && (nsuccess == 1))
- break;
- }
- }
- exit((nsuccess == 2) ? 2 : (nsuccess == 0));
-}
-
-char *
-pfile(pfname) /* absorb expression from file */
- char *pfname;
-{
- int fd;
- struct stat patstat;
- static char *pat;
-
- if ((fd = open(pfname, O_RDONLY, 0)) < 0)
- oops("can't read pattern file");
- if (fstat(fd, &patstat) != 0)
- oops("can't stat pattern file");
- if (patstat.st_size > PATSIZE) {
- if (fgrepflag) { /* defer to unix version */
- fgrepold++;
- return "dummy";
- } else
- oops("pattern file too big");
- }
- if ((pat = malloc((unsigned) patstat.st_size + 1)) == NULL)
- oops("out of memory to read pattern file");
- if (patstat.st_size != read(fd, pat, (int)patstat.st_size))
- oops("error reading pattern file");
- (void) close(fd);
-
- pat[patstat.st_size] = EOS;
- if (pat[patstat.st_size - 1] == NL) /* NOP for egrep; helps grep */
- pat[patstat.st_size - 1] = EOS;
-
- if (nlcount(pat, &pat[patstat.st_size]) > NALT) {
- if (fgrepflag)
- fgrepold++; /* "what's it all about, alfie?" */
- else
- egrepold++;
- }
- return (pat);
-}
-
-egsecute(file)
- char *file;
-{
- extern int errno;
-
- if (file == NULL)
- fd = 0;
- else if ((fd = open(file, O_RDONLY, 0)) <= 0) {
- fprintf(stderr,
- "%s: %s: %s\n", progname, file, strerror(errno));
- nsuccess = 2;
- return;
- }
- chimaera(file, patboy);
-
- if (!boyonly && !flushflag && file != NULL)
- flushmatches();
- if (file != NULL)
- close(fd);
-}
-
-chimaera(file, pat) /* "reach out and boyer-moore search someone" */
- char *file, *pat; /* -- soon-to-be-popular bumper sticker */
-{
- register char *k, *strend, *s;
- register int j, count;
- register int *deltazero = delta0;
- int patlen = altmin;
- char *t;
-
- nleftover = boyfound = flushflag = 0;
- nline = 1L;
- prevmatch = 0;
- nmatch = counted = rxcount = 0L;
-
- while ((count = read(fd, str + nleftover, BUFSIZE - nleftover)) > 0) {
-
- counted += count;
- strend = linesave(str, count);
-
- for (k = str + patlen - 1; k < strend;) {
- /*
- * for a large class of patterns, upwards of 80% of
- * match time is spent on the next line. we beat
- * existing microcode (vax 'matchc') this way.
- */
- while ((k += deltazero[*(unsigned char *) k]) < strend);
- if (k < (str + LARGE))
- break;
- k -= LARGE;
-
- if (altflag) {
- /*
- * Parallel Boyer-Moore. Check whether each
- * of the previous <altmin> chars COULD be
- * from one of the alternative strings.
- */
- s = k - 1;
- j = altmin;
- while (altset[--j][(unsigned char)
- cmap[*(unsigned char *) s--]]);
- /*
- * quick test fails. in this life, compare
- * 'em all. but, a "reverse trie" would
- * attenuate worst case (linear w/delta2?).
- */
- if (--j < 0) {
- count = nalt - 1;
- do {
- s = k;
- j = altlen[count];
- t = altpat[count];
-
- while
- (cmap[*(unsigned char *) s--]
- == t[--j]);
- if (j < 0)
- break;
- }
- while (count--);
- }
- } else {
- /* One string -- check it */
- j = patlen - 1;
- s = k - 1;
- while (cmap[*(unsigned char *) s--] == pat[--j]);
- }
- /*
- * delta-less shortcut for literati. short shrift for
- * genetic engineers?
- */
- if (j >= 0) {
- k++; /* no match; restart next char */
- continue;
- }
- k = submatch(file, pat, str, strend, k, count);
- if (k == NULL)
- return;
- }
- if (nflag) {
- if (prevmatch)
- nline = prevnline + nlcount(prevloc, k);
- else
- nline = nline + nlcount(str, k);
- prevmatch = 0;
- }
- strncpy(str, linetemp, nleftover);
- }
- if (cflag) {
- /* Bug from old grep: -c overrides -h. We fix the bug. */
- if (!hflag)
- printf("%s:", file);
- printf("%ld\n", nmatch);
- }
-}
-
-char *
-linesave(str, count) /* accumulate partial line at end of buffer */
- char str[];
- register int count;
-{
- register int j;
-
- count += nleftover;
- if (count != BUFSIZE && fd != 0)
- str[count++] = NL; /* insurance for broken last line */
- str[count] = EOS;
- for (j = count - 1; str[j] != NL && j >= 0;)
- j--;
- /*
- * break up these lines: long line (> BUFSIZE), last line of file, or
- * short return from read(), as from tee(1) input
- */
- if (j < 0 && (count == (BUFSIZE - nleftover))) {
- str[count++] = NL;
- str[count] = EOS;
- linetemp[0] = EOS;
- nleftover = 0;
- return (str + count);
- } else {
- nleftover = count - j - 1;
- strncpy(linetemp, str + j + 1, nleftover);
- return (str + j);
- }
-}
-
-/*
- * Process partial match. First check for mis-aligned Kanji, then match line
- * against full compiled r.e. if statistics do not warrant handing off to
- * standard egrep.
- */
-char *
-submatch(file, pat, str, strend, k, altindex)
- char file[], pat[], str[];
- register char *strend, *k;
- int altindex;
-{
- register char *s;
- char *t, c;
-
- t = k;
- s = ((altflag) ? k - altlen[altindex] + 1 : k - altmin + 1);
-#ifndef NOKANJI
- c = ((altflag) ? altpat[altindex][0] : pat[0]);
- if (c & NONASCII)
- if ((s = kanji(str, s, k)) == NULL)
- return (++k); /* reject false kanji */
-#endif
- do;
- while (*s != NL && --s >= str);
- k = s + 1; /* now at line start */
-
- if (boyonly)
- return (gotamatch(file, k));
-
- incount = counted - (strend - k);
- if (boyfound++ == FIRSTFEW)
- execstrategy(file);
-
- s = t;
- do
- rxcount++;
- while (*s++ != NL);
- *--s = EOS;
- /*
- * "quick henry -- the flit" (after theodor geisel)
- */
- if (regexec(rspencer, ((iflag) ? fold(k) : k)) == 1) {
- *s = NL;
- if (gotamatch(file, k) == NULL)
- return (NULL);
- }
- *s = NL;
- return (s + 1);
-}
-
-#ifndef NOKANJI
-/*
- * EUC code disambiguation -- scan backwards to first 7-bit code, while
- * counting intervening 8-bit codes. If odd, reject unaligned Kanji pattern.
- * SS2/3 checks are for intermixed Japanase Katakana or Kanji2.
- */
-char *
-kanji(str, s, k)
- register char *str, *s, *k;
-{
- register int j = 0;
-
- for (s--; s >= str; s--) {
- if (*s == SS2 || *s == SS3 || (*s & NONASCII) == 0)
- break;
- j++;
- }
-#ifndef CHINESE
- if (*s == SS2)
- j -= 1;
-#endif CHINESE
- return ((j & 01) ? NULL : k);
-}
-#endif
-
-/*
- * Compute "Boyer-Moore" delta table -- put skip distance in delta0[c]
- */
-gosper(pattern)
- char *pattern; /* ... HAKMEM lives ... */
-{
- register int i, j;
- unsigned char c;
-
- /* Make one-string case look like simple alternatives case */
- if (!altflag) {
- nalt = 1;
- altmin = altlen[0] = strlen(pattern);
- altpat[0] = pattern;
- }
- /* For chars that aren't in any string, skip by string length. */
- for (j = 0; j < 256; j++) {
- delta0[j] = altmin;
- cmap[j] = j; /* Sneak in initialization of cmap */
- }
-
- /* For chars in a string, skip distance from char to end of string. */
- /* (If char appears more than once, skip minimum distance.) */
- for (i = 0; i < nalt; i++)
- for (j = 0; j < altlen[i] - 1; j++) {
- c = altpat[i][j];
- delta0[c] = MIN(delta0[c], altlen[i] - j - 1);
- if (iflag && islower((int) c))
- delta0[toupper((int) c)] = delta0[c];
- }
-
- /* For last char of each string, fall out of search loop. */
- for (i = 0; i < nalt; i++) {
- c = altpat[i][altlen[i] - 1];
- delta0[c] = LARGE;
- if (iflag && islower((int) c))
- delta0[toupper((int) c)] = LARGE;
- }
- if (iflag)
- for (j = 'A'; j <= 'Z'; j++)
- cmap[j] = tolower((int) j);
-}
-
-/*
- * Print, count, or stop on full match. Result is either the location for
- * continued search, or NULL to stop.
- */
-char *
-gotamatch(file, s)
- register char *file, *s;
-{
- char *savematch();
- int squirrel = 0; /* nonzero to squirrel away FIRSTFEW matches */
-
- nmatch++;
- nsuccess = 1;
- if (!boyonly && boyfound <= FIRSTFEW && file != NULL)
- squirrel = 1;
-
- if (sflag)
- return (NULL); /* -s usurps all flags (unlike some versions) */
- if (cflag) { /* -c overrides -l, we guess */
- do;
- while (*s++ != NL);
- } else if (lflag) {
- puts(file);
- return (NULL);
- } else {
- if (!hflag)
- if (!squirrel)
- printf("%s:", file);
- else
- (void)sprintf(preamble, "%s:", file);
- if (nflag) {
- if (prevmatch)
- prevnline = prevnline + nlcount(prevloc, s);
- else
- prevnline = nline + nlcount(str, s);
- prevmatch = 1;
-
- if (!squirrel)
- printf("%ld:", prevnline);
- else
- (void)sprintf(preamble + strlen(preamble),
- "%ld:", prevnline);
- }
- if (!squirrel) {
- do
- putchar(*s);
- while (*s++ != NL);
- } else
- s = savematch(s);
-
- if (nflag)
- prevloc = s - 1;
- }
- return ((firstflag && !cflag) ? NULL : s);
-}
-
-char *
-fold(line)
- char *line;
-{
- static char fline[BUFSIZE];
- register char *s, *t = fline;
-
- for (s = line; *s != EOS; s++)
- *t++ = (isupper((int) *s) ? (char) tolower((int) *s) : *s);
- *t = EOS;
- return (fline);
-}
-
-strindex(s, t) /* the easy way, as in K&P, p. 192 */
- char *s, *t;
-{
- int i, n;
-
- n = strlen(t);
- for (i = 0; s[i] != '\0'; i++)
- if (strncmp(s + i, t, n) == 0)
- return (i);
- return (-1);
-}
-
-char *
-grepxlat(pattern) /* grep pattern meta conversion */
- char *pattern;
-{
- register char *p, *s;
- static char newpat[BUFSIZE];
-
- for (s = newpat, p = pattern; *p != EOS;) {
- if (*p == '\\') { /* skip escapes ... */
- *s++ = *p++;
- if (*p)
- *s++ = *p++;
- } else if (*p == '[') { /* ... and char classes */
- while (*p != EOS && *p != ']')
- *s++ = *p++;
- } else if (strchr("+?|()", *p) != NULL) {
- *s++ = '\\'; /* insert protection */
- *s++ = *p++;
- } else
- *s++ = *p++;
- }
- *s = EOS;
- grepflag = ((patind) ? 0 : 1);
- return (newpat);
-}
-
-/*
- * Test for simple alternation. Result is NULL if it's not so simple, or is
- * a pointer to the first string if it is. Warning: sscanf size is a
- * fixpoint, beyond which the speedup linearity starts to break down. In the
- * wake of the elegant aho/corrasick "trie"-based fgrep, generalizing
- * altpat[] to arbitrary size is not useful.
- */
-char *
-alternate(regexpr)
- char *regexpr;
-{
- register int i, j;
- register char *start, *stop;
- unsigned char c;
-
- if (fgrepflag && strchr(regexpr, '|'))
- return (NULL);
-
- /*
- * break pattern up into altpat array; delimit on newline, bar,
- * or EOS. We know we won't overflow, we've already checked the
- * number of patterns we're going to find against NALT.
- * Also, set length of pattern and find minimum pattern length.
- */
- nalt = 0;
- altmin = NMUSH;
- for (start = stop = regexpr;; ++stop)
- if (!*stop || *stop == '|' || *stop == NL) {
- altlen[nalt] = j = stop - start;
- if (j < altmin)
- altmin = j;
- if (!(altpat[nalt] = malloc((u_int)(j + 1))))
- oops("out of memory");
- bcopy(start, altpat[nalt], j);
- altpat[nalt][j] = EOS;
- ++nalt;
- if (!*stop)
- break;
- if (nalt == NALT)
- return(NULL);
- if (*stop == NL)
- *stop = '|';
- start = stop + 1;
- }
- if (!fgrepflag) {
- if (strchr(regexpr, '|') == NULL || regexpr[0] == '|')
- return (NULL);
- if (strpbrk(regexpr, "^$.[]()?+*\\") != NULL
- || strindex(regexpr, "||") >= 0)
- return (NULL);
- }
-
- if (nalt > 1) { /* build superimposed "pre-match" sets per
- * char */
- altflag++;
- for (j = 0; j < nalt; j++)
- for (i = 0; i < altmin; i++) {
- c = altpat[j][altlen[j] - altmin + i];
- altset[i + 1][c] = 1; /* offset for sentinel */
- }
- }
- return (altpat[0]);
-}
-
-/*
- * Grapple with the dfa (std egrep) vs. ndfa (regexp) tradeoff. Criteria to
- * determine whether to use dfa-based egrep: We do FIRSTFEW matches with
- * regexec(). If Boyer-Moore up to now matched more than PUNTPERCENT
- * of the input, the r.e. is likely to be underspecified, so do old *grep,
- * which is faster on complex patterns than regexp(). At FIRSTFEW,
- * dump the saved matches collected by savematch(). They are saved
- * so that a "PUNT" can "rewind" to ignore them. Stdin is problematic,
- * since it's hard to rewind.
- */
-
-execstrategy(file)
- char *file;
-{
- int pctmatch;
-
- pctmatch = (100 * rxcount) / incount;
- if (pctmatch > PUNTPERCENT && file != NULL)
- kernighan(args);
- if (file != NULL)
- flushmatches();
-}
-
-nlcount(bstart, bstop) /* flail interval to totalize newlines. */
- char *bstart, *bstop;
-{
- register char *s = bstart;
- register char *t = bstop;
- register int count = 0;
-
- do { /* loop unroll for older architectures */
- if (*t == NL) /* ... ask ames!jaw for sample code */
- count++;
- } while (t-- > s);
-
- return (count);
-}
-
-char *
-isolate(regexpr) /* isolate longest metacharacter-free string */
- char *regexpr;
-{
- char *dummyexpr;
-
- /*
- * We add (.)* because Henry's regcomp only figures regmust if it
- * sees a leading * pattern. Foo!
- */
- dummyexpr = malloc((unsigned) strlen(regexpr) + 5);
- (void)sprintf(dummyexpr, "(.)*%s", regexpr);
- if ((rspencer = regcomp(dummyexpr)) == NULL)
- kernighan(args);
- return (rspencer->regmust);
-}
-
-char *matches[FIRSTFEW];
-static int mcount = 0;
-
-char *
-savematch(s) /* horde matches during statistics gathering */
- register char *s;
-{
- char *p;
- char *start = s;
- int msize = 0;
- int psize = strlen(preamble);
-
- while (*s++ != NL)
- msize++;
- *--s = EOS;
-
- p = malloc((unsigned) msize + 1 + psize);
- strcpy(p, preamble);
- strcpy(p + psize, start);
- matches[mcount++] = p;
-
- preamble[0] = 0;
- *s = NL;
- return (s);
-}
-
-flushmatches()
-{
- int n;
-
- flushflag = 1;
- for (n = 0; n < mcount; n++)
- printf("%s\n", matches[n]);
- mcount = 0;
-}
-
-oops(message)
- char *message;
-{
- fprintf(stderr, "%s: %s\n", progname, message);
- exit(2);
-}
-
-kernighan(args) /* "let others do the hard part ..." */
- char *args[];
-{
- /*
- * We may have already run grep on some of the files; remove them
- * from the arg list we pass on. Note that we can't delete them
- * totally because the number of file names affects the output
- * (automatic -h).
- */
- /* better would be fork/exec per punted file -- jaw */
-
- while (firstfile && optind > firstfile)
- args[firstfile++] = _PATH_DEVNULL;
- if (patind)
- args[patind] = pattern;
- (void) fflush(stdout);
-
- if (grepflag)
- execvp(_PATH_GREPSTD, args), oops("can't exec old 'grep'");
- else if (fgrepflag)
- execvp(_PATH_FGREPSTD, args), oops("can't exec old 'fgrep'");
- else
- execvp(_PATH_EGREPSTD, args), oops("can't exec old 'egrep'");
-}
diff --git a/usr.bin/grep/egrep/grep.1 b/usr.bin/grep/egrep/grep.1
deleted file mode 100644
index 771cc8c..0000000
--- a/usr.bin/grep/egrep/grep.1
+++ /dev/null
@@ -1,250 +0,0 @@
-.\" Copyright (c) 1980, 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.
-.\"
-.\" @(#)grep.1 8.3 (Berkeley) 4/18/94
-.\"
-.Dd April 18, 1994
-.Dt GREP 1
-.Os
-.Sh NAME
-.Nm grep
-.Nd file pattern searcher
-.Sh SYNOPSIS
-.Nm grep
-.Op Fl bchilnosvw
-.Op Fl e Ar pattern
-.Op Ar
-.Nm egrep
-.Op Fl bchilnosv
-.Op Fl e Ar pattern
-.Op Fl f Ar pattern_file
-.Op Ar
-.Nm fgrep
-.Op Fl bchilnosvx
-.Op Fl e Ar pattern
-.Op Fl f Ar pattern_file
-.Op Ar
-.Sh DESCRIPTION
-The
-.Nm grep
-utilities search the given input files selecting lines
-which match one or more patterns; the type of patterns is controlled
-by the options specified.
-By default, a pattern
-matches an input line if any regular expression (RE) in the
-pattern matches the input line without its trailing <new-line>.
-A null RE matches every line.
-Each input line that matches at
-least one of the patterns is written to the standard output.
-.Pp
-For simple patterns or
-.Xr ex 1
-or
-.Xr ed 1
-style regular expressions, the
-.Nm grep
-utility is used.
-The
-.Nm egrep
-utility
-can handle extended regular expressions and
-embedded <newline>s in patterns.
-The
-.Nm fgrep
-utility is quick but can handle only fixed strings.
-A fixed string
-is a string of characters,
-each character
-is matched only by itself.
-The pattern
-value can consist of multiple lines with
-embedded <newline>s.
-In this case, the <newline>s
-act as alternation characters, allowing any of the
-pattern lines to match a portion of the input.
-.Pp
-The following options are available:
-.Pp
-.Bl -tag -width indent
-.It Fl b
-The block number on the disk in which a matched pattern is located
-is displayed in front of the respective matched line.
-.It Fl c
-Only a count of selected lines is written to standard
-output.
-.It Fl e Ar expression
-Specify a pattern used during the search of the
-input.
-Multiple
-.Fl e
-options can be used to specify
-multiple patterns; an input line is selected if it
-matches any of the specified patterns.
-.It Fl f Ar pattern_file
-The pattern is read from the file named by the
-pathname pattern_file.
-Trailing newlines
-in the pattern_file are ignored.
-.Pf ( Nm Egrep
-and
-.Nm fgrep
-only).
-.It Fl h
-Never print filename headers with output lines.
-.It Fl i
-The case of letters is ignored in making comparisons \- that is, upper and
-lower case are considered identical.
-.It Fl l
-Only the names of files containing selected lines
-are written to standard output.
-Pathnames are
-listed once per file searched.
-If the standard
-input is searched, the pathname
-.Sq Fl
-is written.
-.It Fl n
-Each output line is preceded by its relative line
-number in the file; each file starting at line 1.
-The line number counter is reset for each file processed.
-This option is ignored if
-.Fl c ,
-.Fl l ,
-or
-.Fl s
-is
-specified.
-.It Fl o
-Always print filename headers with output lines.
-.It Fl s
-Silent mode. Nothing is printed (except error messages).
-This is useful for checking the error status.
-.It Fl v
-Selected lines are those
-.Em not
-matching the specified
-patterns.
-.It Fl x
-Only input lines selected against an entire fixed
-string or regular expression are considered to be
-matching lines.
-.Pf ( Nm Fgrep
-only).
-.It Fl w
-The expression is searched for as a word
-(as if surrounded by `\e<' and `\e>', see
-.Xr ex 1 . )
-.Pf ( Nm Grep
-only)
-.Pp
-.El
-If no file arguments are specified, the
-standard input is used.
-.Pp
-The
-.Nm grep
-utility exits with one of the following values:
-.Pp
-.Bl -tag -width flag -compact
-.It Li 0
-One or more lines were selected.
-.It Li 1
-No lines were selected.
-.It Li >1
-An error occurred.
-.El
-.Sh EXTENDED REGULAR EXPRESSIONS
-The following characters are interpreted by
-.Nm egrep :
-.Pp
-.Bl -tag -width flag -compact
-.It Cm \&$
-Align the match from the end of the line.
-.It Cm \&^
-Align the match from the beginning of the line.
-.It Cm \&|
-Add another pattern (see example below).
-.It Cm \&?
-Match 1 or less sequential repetitions of the pattern.
-.It Cm \&+
-Match 1 or more sequential repetitions of the pattern.
-.It Cm \&*
-Match 0 or more sequential repetitions of the pattern.
-.It Cm \&[]
-Match any single character or range of characters
-enclosed in the brackets.
-.It Cm \&\e
-Escape special characters which have meaning to
-.Nm egrep ,
-the set of {$,.,^,[,],|,?,+,*,(,)}.
-.El
-.Sh EXAMPLES
-To find all occurrences of the word patricia in a file:
-.Pp
-.Dl grep patricia myfile
-.Pp
-To find all occurrences of the pattern
-.Ql \&.Pp
-at the beginning of a line:
-.Pp
-.Dl grep '^\e.Pp'
-.Pp
-The apostrophes assure the entire expression is evaluated by
-.Nm grep
-instead of by the
-users shell.
-The carat or hat
-.Ql Li \&^
-means
-.Em from the beginning of a line ,
-and the
-.Ql Li \&\e
-escapes the
-.Ql Li \&.
-which would otherwise match any character.
-.Pp
-A simple example of an extended regular expression:
-.Pp
-.Dl egrep '19|20|25' calendar
-.Pp
-Peruses the file calendar looking for either 19, 20
-or 25.
-.Sh SEE ALSO
-.Xr ed 1 ,
-.Xr ex 1 ,
-.Xr sed 1
-.Sh HISTORY
-The
-.Nm grep
-command appeared in
-.At v6 .
-.Sh BUGS
-Lines are limited to 256 characters; longer lines are truncated.
diff --git a/usr.bin/grep/egrep/pathnames.h b/usr.bin/grep/egrep/pathnames.h
deleted file mode 100644
index a25b3dc..0000000
--- a/usr.bin/grep/egrep/pathnames.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
- */
-
-#include <paths.h>
-
-#define _PATH_EGREPSTD "/usr/libexec/old.egrep"
-#define _PATH_GREPSTD "/usr/libexec/old.bin.grep"
-#define _PATH_FGREPSTD "/usr/libexec/old.fgrep"
diff --git a/usr.bin/ld/Makefile b/usr.bin/ld/Makefile
deleted file mode 100644
index 834a5c9..0000000
--- a/usr.bin/ld/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= ld
-SRCS= ld.c cplus-dem.c
-NOMAN= noman
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/ld/cplus-dem.c b/usr.bin/ld/cplus-dem.c
deleted file mode 100644
index b2e3050..0000000
--- a/usr.bin/ld/cplus-dem.c
+++ /dev/null
@@ -1,970 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)cplus-dem.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/* Demangler for GNU C++
- Copyright (C) 1989 Free Software Foundation, Inc.
- written by James Clark (jjc@jclark.uucp)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* This is for g++ 1.36.1 (November 6 version). It will probably
- require changes for any other version.
-
- Modified for g++ 1.36.2 (November 18 version). */
-
-/* This file exports one function
-
- char *cplus_demangle (const char *name)
-
- If `name' is a mangled function name produced by g++, then
- a pointer to a malloced string giving a C++ representation
- of the name will be returned; otherwise NULL will be returned.
- It is the caller's responsibility to free the string which
- is returned.
-
- For example,
-
- cplus_demangle ("_foo__1Ai")
-
- returns
-
- "A::foo(int)"
-
- This file imports xmalloc and xrealloc, which are like malloc and
- realloc except that they generate a fatal error if there is no
- available memory. */
-
-/* #define nounderscore 1 /* define this is names don't start with _ */
-
-#include <stdio.h>
-#include <ctype.h>
-
-#ifdef USG
-#include <memory.h>
-#include <string.h>
-#else
-#include <strings.h>
-#define memcpy(s1, s2, n) bcopy ((s2), (s1), (n))
-#define memcmp(s1, s2, n) bcmp ((s2), (s1), (n))
-#define strchr index
-#define strrchr rindex
-#endif
-
-#ifdef __STDC__
-extern char *cplus_demangle (const char *type);
-#else
-extern char *cplus_demangle ();
-#endif
-
-#ifdef __STDC__
-extern char *xmalloc (int);
-extern char *xrealloc (char *, int);
-#else
-extern char *xmalloc ();
-extern char *xrealloc ();
-#endif
-
-static char **typevec = 0;
-static int ntypes = 0;
-static int typevec_size = 0;
-
-static struct {
- const char *in;
- const char *out;
-} optable[] = {
- "new", " new",
- "delete", " delete",
- "ne", "!=",
- "eq", "==",
- "ge", ">=",
- "gt", ">",
- "le", "<=",
- "lt", "<",
- "plus", "+",
- "minus", "-",
- "mult", "*",
- "convert", "+", /* unary + */
- "negate", "-", /* unary - */
- "trunc_mod", "%",
- "trunc_div", "/",
- "truth_andif", "&&",
- "truth_orif", "||",
- "truth_not", "!",
- "postincrement", "++",
- "postdecrement", "--",
- "bit_ior", "|",
- "bit_xor", "^",
- "bit_and", "&",
- "bit_not", "~",
- "call", "()",
- "cond", "?:",
- "alshift", "<<",
- "arshift", ">>",
- "component", "->",
- "indirect", "*",
- "method_call", "->()",
- "addr", "&", /* unary & */
- "array", "[]",
- "nop", "", /* for operator= */
-};
-
-/* Beware: these aren't '\0' terminated. */
-
-typedef struct {
- char *b; /* pointer to start of string */
- char *p; /* pointer after last character */
- char *e; /* pointer after end of allocated space */
-} string;
-
-#ifdef __STDC__
-static void string_need (string *s, int n);
-static void string_delete (string *s);
-static void string_init (string *s);
-static void string_clear (string *s);
-static int string_empty (string *s);
-static void string_append (string *p, const char *s);
-static void string_appends (string *p, string *s);
-static void string_appendn (string *p, const char *s, int n);
-static void string_prepend (string *p, const char *s);
-#if 0
-static void string_prepends (string *p, string *s);
-#endif
-static void string_prependn (string *p, const char *s, int n);
-static int get_count (const char **type, int *count);
-static int do_args (const char **type, string *decl);
-static int do_type (const char **type, string *result);
-static int do_arg (const char **type, string *result);
-static int do_args (const char **type, string *decl);
-static void munge_function_name (string *name);
-static void remember_type (const char *type, int len);
-#else
-static void string_need ();
-static void string_delete ();
-static void string_init ();
-static void string_clear ();
-static int string_empty ();
-static void string_append ();
-static void string_appends ();
-static void string_appendn ();
-static void string_prepend ();
-static void string_prepends ();
-static void string_prependn ();
-static int get_count ();
-static int do_args ();
-static int do_type ();
-static int do_arg ();
-static int do_args ();
-static void munge_function_name ();
-static void remember_type ();
-#endif
-
-char *
-cplus_demangle (type)
- const char *type;
-{
- string decl;
- int n;
- int success = 0;
- int constructor = 0;
- int const_flag = 0;
- int i;
- const char *p;
-#ifndef LONGERNAMES
- const char *premangle;
-#endif
-
- if (type == NULL || *type == '\0')
- return NULL;
-#ifndef nounderscore
- if (*type++ != '_')
- return NULL;
-#endif
- p = type;
- while (*p != '\0' && !(*p == '_' && p[1] == '_'))
- p++;
- if (*p == '\0')
- {
- /* destructor */
- if (type[0] == '_' && type[1] == '$' && type[2] == '_')
- {
- int n = (strlen (type) - 3)*2 + 3 + 2 + 1;
- char *tem = (char *) xmalloc (n);
- strcpy (tem, type + 3);
- strcat (tem, "::~");
- strcat (tem, type + 3);
- strcat (tem, "()");
- return tem;
- }
- /* static data member */
- if (*type != '_' && (p = strchr (type, '$')) != NULL)
- {
- int n = strlen (type) + 2;
- char *tem = (char *) xmalloc (n);
- memcpy (tem, type, p - type);
- strcpy (tem + (p - type), "::");
- strcpy (tem + (p - type) + 2, p + 1);
- return tem;
- }
- /* virtual table */
- if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == '$')
- {
- int n = strlen (type + 4) + 14 + 1;
- char *tem = (char *) xmalloc (n);
- strcpy (tem, type + 4);
- strcat (tem, " virtual table");
- return tem;
- }
- return NULL;
- }
-
- string_init (&decl);
-
- if (p == type)
- {
- if (!isdigit (p[2]))
- {
- string_delete (&decl);
- return NULL;
- }
- constructor = 1;
- }
- else
- {
- string_appendn (&decl, type, p - type);
- munge_function_name (&decl);
- }
- p += 2;
-
-#ifndef LONGERNAMES
- premangle = p;
-#endif
- switch (*p)
- {
- case 'C':
- /* a const member function */
- if (!isdigit (p[1]))
- {
- string_delete (&decl);
- return NULL;
- }
- p += 1;
- const_flag = 1;
- /* fall through */
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- n = 0;
- do
- {
- n *= 10;
- n += *p - '0';
- p += 1;
- }
- while (isdigit (*p));
- if (strlen (p) < n)
- {
- string_delete (&decl);
- return NULL;
- }
- if (constructor)
- {
- string_appendn (&decl, p, n);
- string_append (&decl, "::");
- string_appendn (&decl, p, n);
- }
- else
- {
- string_prepend (&decl, "::");
- string_prependn (&decl, p, n);
- }
- p += n;
-#ifndef LONGERNAMES
- remember_type (premangle, p - premangle);
-#endif
- success = do_args (&p, &decl);
- if (const_flag)
- string_append (&decl, " const");
- break;
- case 'F':
- p += 1;
- success = do_args (&p, &decl);
- break;
- }
-
- for (i = 0; i < ntypes; i++)
- if (typevec[i] != NULL)
- free (typevec[i]);
- ntypes = 0;
- if (typevec != NULL)
- {
- free ((char *)typevec);
- typevec = NULL;
- typevec_size = 0;
- }
-
- if (success)
- {
- string_appendn (&decl, "", 1);
- return decl.b;
- }
- else
- {
- string_delete (&decl);
- return NULL;
- }
-}
-
-static int
-get_count (type, count)
- const char **type;
- int *count;
-{
- if (!isdigit (**type))
- return 0;
- *count = **type - '0';
- *type += 1;
- /* see flush_repeats in cplus-method.c */
- if (isdigit (**type))
- {
- const char *p = *type;
- int n = *count;
- do
- {
- n *= 10;
- n += *p - '0';
- p += 1;
- }
- while (isdigit (*p));
- if (*p == '_')
- {
- *type = p + 1;
- *count = n;
- }
- }
- return 1;
-}
-
-/* result will be initialised here; it will be freed on failure */
-
-static int
-do_type (type, result)
- const char **type;
- string *result;
-{
- int n;
- int done;
- int non_empty = 0;
- int success;
- string decl;
- const char *remembered_type;
-
- string_init (&decl);
- string_init (result);
-
- done = 0;
- success = 1;
- while (success && !done)
- {
- int member;
- switch (**type)
- {
- case 'P':
- *type += 1;
- string_prepend (&decl, "*");
- break;
-
- case 'R':
- *type += 1;
- string_prepend (&decl, "&");
- break;
-
- case 'T':
- *type += 1;
- if (!get_count (type, &n) || n >= ntypes)
- success = 0;
- else
- {
- remembered_type = typevec[n];
- type = &remembered_type;
- }
- break;
-
- case 'F':
- *type += 1;
- if (!string_empty (&decl) && decl.b[0] == '*')
- {
- string_prepend (&decl, "(");
- string_append (&decl, ")");
- }
- if (!do_args (type, &decl) || **type != '_')
- success = 0;
- else
- *type += 1;
- break;
-
- case 'M':
- case 'O':
- {
- int constp = 0;
- int volatilep = 0;
-
- member = **type == 'M';
- *type += 1;
- if (!isdigit (**type))
- {
- success = 0;
- break;
- }
- n = 0;
- do
- {
- n *= 10;
- n += **type - '0';
- *type += 1;
- }
- while (isdigit (**type));
- if (strlen (*type) < n)
- {
- success = 0;
- break;
- }
- string_append (&decl, ")");
- string_prepend (&decl, "::");
- string_prependn (&decl, *type, n);
- string_prepend (&decl, "(");
- *type += n;
- if (member)
- {
- if (**type == 'C')
- {
- *type += 1;
- constp = 1;
- }
- if (**type == 'V')
- {
- *type += 1;
- volatilep = 1;
- }
- if (*(*type)++ != 'F')
- {
- success = 0;
- break;
- }
- }
- if ((member && !do_args (type, &decl)) || **type != '_')
- {
- success = 0;
- break;
- }
- *type += 1;
- if (constp)
- {
- if (non_empty)
- string_append (&decl, " ");
- else
- non_empty = 1;
- string_append (&decl, "const");
- }
- if (volatilep)
- {
- if (non_empty)
- string_append (&decl, " ");
- else
- non_empty = 1;
- string_append (&decl, "volatilep");
- }
- break;
- }
-
- case 'C':
- if ((*type)[1] == 'P')
- {
- *type += 1;
- if (!string_empty (&decl))
- string_prepend (&decl, " ");
- string_prepend (&decl, "const");
- break;
- }
-
- /* fall through */
- default:
- done = 1;
- break;
- }
- }
-
- done = 0;
- non_empty = 0;
- while (success && !done)
- {
- switch (**type)
- {
- case 'C':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- else
- non_empty = 1;
- string_append (result, "const");
- break;
- case 'U':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- else
- non_empty = 1;
- string_append (result, "unsigned");
- break;
- case 'V':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- else
- non_empty = 1;
- string_append (result, "volatile");
- break;
- default:
- done = 1;
- break;
- }
- }
-
- if (success)
- switch (**type)
- {
- case '\0':
- case '_':
- break;
- case 'v':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "void");
- break;
- case 'x':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "long long");
- break;
- case 'l':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "long");
- break;
- case 'i':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "int");
- break;
- case 's':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "short");
- break;
- case 'c':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "char");
- break;
- case 'r':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "long double");
- break;
- case 'd':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "double");
- break;
- case 'f':
- *type += 1;
- if (non_empty)
- string_append (result, " ");
- string_append (result, "float");
- break;
- case 'G':
- *type += 1;
- if (!isdigit (**type))
- {
- success = 0;
- break;
- }
- /* fall through */
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- n = 0;
- do
- {
- n *= 10;
- n += **type - '0';
- *type += 1;
- }
- while (isdigit (**type));
- if (strlen (*type) < n)
- {
- success = 0;
- break;
- }
- if (non_empty)
- string_append (result, " ");
- string_appendn (result, *type, n);
- *type += n;
- break;
- default:
- success = 0;
- break;
- }
-
- if (success)
- {
- if (!string_empty (&decl))
- {
- string_append (result, " ");
- string_appends (result, &decl);
- }
- string_delete (&decl);
- return 1;
- }
- else
- {
- string_delete (&decl);
- string_delete (result);
- return 0;
- }
-}
-
-/* `result' will be initialised in do_type; it will be freed on failure */
-
-static int
-do_arg (type, result)
- const char **type;
- string *result;
-{
- const char *start = *type;
-
- if (!do_type (type, result))
- return 0;
- remember_type (start, *type - start);
- return 1;
-}
-
-static void
-remember_type (start, len)
- const char *start;
- int len;
-{
- char *tem;
-
- if (ntypes >= typevec_size)
- {
- if (typevec_size == 0)
- {
- typevec_size = 3;
- typevec = (char **) xmalloc (sizeof (char*)*typevec_size);
- }
- else
- {
- typevec_size *= 2;
- typevec = (char **) xrealloc ((char *)typevec, sizeof (char*)*typevec_size);
- }
- }
- tem = (char *) xmalloc (len + 1);
- memcpy (tem, start, len);
- tem[len] = '\0';
- typevec[ntypes++] = tem;
-}
-
-/* `decl' must be already initialised, usually non-empty;
- it won't be freed on failure */
-
-static int
-do_args (type, decl)
- const char **type;
- string *decl;
-{
- string arg;
- int need_comma = 0;
-
- string_append (decl, "(");
-
- while (**type != '_' && **type != '\0' && **type != 'e' && **type != 'v')
- {
- if (**type == 'N')
- {
- int r;
- int t;
- *type += 1;
- if (!get_count (type, &r) || !get_count (type, &t) || t >= ntypes)
- return 0;
- while (--r >= 0)
- {
- const char *tem = typevec[t];
- if (need_comma)
- string_append (decl, ", ");
- if (!do_arg (&tem, &arg))
- return 0;
- string_appends (decl, &arg);
- string_delete (&arg);
- need_comma = 1;
- }
- }
- else
- {
- if (need_comma)
- string_append (decl, ", ");
- if (!do_arg (type, &arg))
- return 0;
- string_appends (decl, &arg);
- string_delete (&arg);
- need_comma = 1;
- }
- }
-
- if (**type == 'v')
- *type += 1;
- else if (**type == 'e')
- {
- *type += 1;
- if (need_comma)
- string_append (decl, ",");
- string_append (decl, "...");
- }
-
- string_append (decl, ")");
- return 1;
-}
-
-static void
-munge_function_name (name)
- string *name;
-{
- if (!string_empty (name) && name->p - name->b >= 3
- && name->b[0] == 'o' && name->b[1] == 'p' && name->b[2] == '$')
- {
- int i;
- /* see if it's an assignment expression */
- if (name->p - name->b >= 10 /* op$assign_ */
- && memcmp (name->b + 3, "assign_", 7) == 0)
- {
- for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
- {
- int len = name->p - name->b - 10;
- if (strlen (optable[i].in) == len
- && memcmp (optable[i].in, name->b + 10, len) == 0)
- {
- string_clear (name);
- string_append (name, "operator");
- string_append (name, optable[i].out);
- string_append (name, "=");
- return;
- }
- }
- }
- else
- {
- for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
- {
- int len = name->p - name->b - 3;
- if (strlen (optable[i].in) == len
- && memcmp (optable[i].in, name->b + 3, len) == 0)
- {
- string_clear (name);
- string_append (name, "operator");
- string_append (name, optable[i].out);
- return;
- }
- }
- }
- return;
- }
- else if (!string_empty (name) && name->p - name->b >= 5
- && memcmp (name->b, "type$", 5) == 0)
- {
- /* type conversion operator */
- string type;
- const char *tem = name->b + 5;
- if (do_type (&tem, &type))
- {
- string_clear (name);
- string_append (name, "operator ");
- string_appends (name, &type);
- string_delete (&type);
- return;
- }
- }
-}
-
-/* a mini string-handling package */
-
-static void
-string_need (s, n)
- string *s;
- int n;
-{
- if (s->b == NULL)
- {
- if (n < 32)
- n = 32;
- s->p = s->b = (char *) xmalloc (n);
- s->e = s->b + n;
- }
- else if (s->e - s->p < n)
- {
- int tem = s->p - s->b;
- n += tem;
- n *= 2;
- s->b = (char *) xrealloc (s->b, n);
- s->p = s->b + tem;
- s->e = s->b + n;
- }
-}
-
-static void
-string_delete (s)
- string *s;
-{
- if (s->b != NULL)
- {
- free (s->b);
- s->b = s->e = s->p = NULL;
- }
-}
-
-static void
-string_init (s)
- string *s;
-{
- s->b = s->p = s->e = NULL;
-}
-
-static void
-string_clear (s)
- string *s;
-{
- s->p = s->b;
-}
-
-static int
-string_empty (s)
- string *s;
-{
- return s->b == s->p;
-}
-
-static void
-string_append (p, s)
- string *p;
- const char *s;
-{
- int n;
- if (s == NULL || *s == '\0')
- return;
- n = strlen (s);
- string_need (p, n);
- memcpy (p->p, s, n);
- p->p += n;
-}
-
-static void
-string_appends (p, s)
- string *p, *s;
-{
- int n;
- if (s->b == s->p)
- return;
- n = s->p - s->b;
- string_need (p, n);
- memcpy (p->p, s->b, n);
- p->p += n;
-}
-
-static void
-string_appendn (p, s, n)
- string *p;
- const char *s;
- int n;
-{
- if (n == 0)
- return;
- string_need (p, n);
- memcpy (p->p, s, n);
- p->p += n;
-}
-
-static void
-string_prepend (p, s)
- string *p;
- const char *s;
-{
- if (s == NULL || *s == '\0')
- return;
- string_prependn (p, s, strlen (s));
-}
-
-#if 0
-static void
-string_prepends (p, s)
- string *p, *s;
-{
- if (s->b == s->p)
- return;
- string_prependn (p, s->b, s->p - s->b);
-}
-#endif
-
-static void
-string_prependn (p, s, n)
- string *p;
- const char *s;
- int n;
-{
- char *q;
-
- if (n == 0)
- return;
- string_need (p, n);
- for (q = p->p - 1; q >= p->b; q--)
- q[n] = q[0];
- memcpy (p->b, s, n);
- p->p += n;
-}
diff --git a/usr.bin/ld/ld.c b/usr.bin/ld/ld.c
deleted file mode 100644
index f0b35f2..0000000
--- a/usr.bin/ld/ld.c
+++ /dev/null
@@ -1,4718 +0,0 @@
-/*-
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)ld.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/* Linker `ld' for GNU
- Copyright (C) 1988 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by Richard Stallman with some help from Eric Albert.
- Set, indirect, and warning symbol features added by Randy Smith. */
-
-/* Define how to initialize system-dependent header fields. */
-
-#include <ar.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <fcntl.h>
-#include <a.out.h>
-#include <stab.h>
-#include <string.h>
-
-/* symseg.h defines the obsolete GNU debugging format; we should nuke it. */
-#define CORE_ADDR unsigned long /* For symseg.h */
-#include "symseg.h"
-
-#define N_SET_MAGIC(exec, val) ((exec).a_magic = val)
-
-/* If compiled with GNU C, use the built-in alloca */
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#endif
-
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
-/* Macro to control the number of undefined references printed */
-#define MAX_UREFS_PRINTED 10
-
-/* Size of a page; obtained from the operating system. */
-
-int page_size;
-
-/* Name this program was invoked by. */
-
-char *progname;
-
-/* System dependencies */
-
-/* Define this to specify the default executable format. */
-
-#ifndef DEFAULT_MAGIC
-#define DEFAULT_MAGIC ZMAGIC
-#endif
-
-#if defined(hp300) || defined(luna68k)
-#define INITIALIZE_HEADER outheader.a_mid = MID_HP300
-#endif
-
-#ifdef sparc
-#ifndef sun
-#define sun 1
-#endif
-#define INITIALIZE_HEADER \
- (outheader.a_mid = MID_SUN_SPARC, outheader.a_toolversion = 1)
-#endif
-
-/*
- * Ok. Following are the relocation information macros. If your
- * system should not be able to use the default set (below), you must
- * define the following:
-
- * relocation_info: This must be typedef'd (or #define'd) to the type
- * of structure that is stored in the relocation info section of your
- * a.out files. Often this is defined in the a.out.h for your system.
- *
- * RELOC_ADDRESS (rval): Offset into the current section of the
- * <whatever> to be relocated. *Must be an lvalue*.
- *
- * RELOC_EXTERN_P (rval): Is this relocation entry based on an
- * external symbol (1), or was it fully resolved upon entering the
- * loader (0) in which case some combination of the value in memory
- * (if RELOC_MEMORY_ADD_P) and the extra (if RELOC_ADD_EXTRA) contains
- * what the value of the relocation actually was. *Must be an lvalue*.
- *
- * RELOC_TYPE (rval): If this entry was fully resolved upon
- * entering the loader, what type should it be relocated as?
- *
- * RELOC_SYMBOL (rval): If this entry was not fully resolved upon
- * entering the loader, what is the index of it's symbol in the symbol
- * table? *Must be a lvalue*.
- *
- * RELOC_MEMORY_ADD_P (rval): This should return true if the final
- * relocation value output here should be added to memory, or if the
- * section of memory described should simply be set to the relocation
- * value.
- *
- * RELOC_ADD_EXTRA (rval): (Optional) This macro, if defined, gives
- * an extra value to be added to the relocation value based on the
- * individual relocation entry. *Must be an lvalue if defined*.
- *
- * RELOC_PCREL_P (rval): True if the relocation value described is
- * pc relative.
- *
- * RELOC_VALUE_RIGHTSHIFT (rval): Number of bits right to shift the
- * final relocation value before putting it where it belongs.
- *
- * RELOC_TARGET_SIZE (rval): log to the base 2 of the number of
- * bytes of size this relocation entry describes; 1 byte == 0; 2 bytes
- * == 1; 4 bytes == 2, and etc. This is somewhat redundant (we could
- * do everything in terms of the bit operators below), but having this
- * macro could end up producing better code on machines without fancy
- * bit twiddling. Also, it's easier to understand/code big/little
- * endian distinctions with this macro.
- *
- * RELOC_TARGET_BITPOS (rval): The starting bit position within the
- * object described in RELOC_TARGET_SIZE in which the relocation value
- * will go.
- *
- * RELOC_TARGET_BITSIZE (rval): How many bits are to be replaced
- * with the bits of the relocation value. It may be assumed by the
- * code that the relocation value will fit into this many bits. This
- * may be larger than RELOC_TARGET_SIZE if such be useful.
- *
- *
- * Things I haven't implemented
- * ----------------------------
- *
- * Values for RELOC_TARGET_SIZE other than 0, 1, or 2.
- *
- * Pc relative relocation for External references.
- *
- *
- */
-
-/* The following #if has been modifed for cross compilation */
-/* It originally read: #if defined(sun) && defined(sparc) */
-/* Marc Ullman, Stanford University Nov. 1 1989 */
-#if defined(sun) && (TARGET == SUN4)
-/* Sparc (Sun 4) macros */
-#undef relocation_info
-#define relocation_info reloc_info_sparc
-#define RELOC_ADDRESS(r) ((r)->r_address)
-#define RELOC_EXTERN_P(r) ((r)->r_extern)
-#define RELOC_TYPE(r) ((r)->r_index)
-#define RELOC_SYMBOL(r) ((r)->r_index)
-#define RELOC_MEMORY_SUB_P(r) 0
-#define RELOC_MEMORY_ADD_P(r) 0
-#define RELOC_ADD_EXTRA(r) ((r)->r_addend)
-#define RELOC_PCREL_P(r) \
- ((r)->r_type >= RELOC_DISP8 && (r)->r_type <= RELOC_WDISP22)
-#define RELOC_VALUE_RIGHTSHIFT(r) (reloc_target_rightshift[(r)->r_type])
-#define RELOC_TARGET_SIZE(r) (reloc_target_size[(r)->r_type])
-#define RELOC_TARGET_BITPOS(r) 0
-#define RELOC_TARGET_BITSIZE(r) (reloc_target_bitsize[(r)->r_type])
-
-/* Note that these are very dependent on the order of the enums in
- enum reloc_type (in a.out.h); if they change the following must be
- changed */
-/* Also note that the last few may be incorrect; I have no information */
-static int reloc_target_rightshift[] = {
- 0, 0, 0, 0, 0, 0, 2, 2, 10, 0, 0, 0, 0, 0, 0,
-};
-static int reloc_target_size[] = {
- 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-};
-static int reloc_target_bitsize[] = {
- 8, 16, 32, 8, 16, 32, 30, 22, 22, 22, 13, 10, 32, 32, 16,
-};
-
-#define MAX_ALIGNMENT (sizeof (double))
-#endif
-
-/* Default macros */
-#ifndef RELOC_ADDRESS
-#define RELOC_ADDRESS(r) ((r)->r_address)
-#define RELOC_EXTERN_P(r) ((r)->r_extern)
-#define RELOC_TYPE(r) ((r)->r_symbolnum)
-#define RELOC_SYMBOL(r) ((r)->r_symbolnum)
-#define RELOC_MEMORY_SUB_P(r) 0
-#define RELOC_MEMORY_ADD_P(r) 1
-#undef RELOC_ADD_EXTRA
-#define RELOC_PCREL_P(r) ((r)->r_pcrel)
-#define RELOC_VALUE_RIGHTSHIFT(r) 0
-#define RELOC_TARGET_SIZE(r) ((r)->r_length)
-#define RELOC_TARGET_BITPOS(r) 0
-#define RELOC_TARGET_BITSIZE(r) 32
-#endif
-
-#ifndef MAX_ALIGNMENT
-#define MAX_ALIGNMENT (sizeof (int))
-#endif
-
-#ifdef nounderscore
-#define LPREFIX '.'
-#else
-#define LPREFIX 'L'
-#endif
-
-#ifndef TEXT_START
-#define TEXT_START(x) N_TXTADDR(x)
-#endif
-
-/* Special global symbol types understood by GNU LD. */
-
-/* The following type indicates the definition of a symbol as being
- an indirect reference to another symbol. The other symbol
- appears as an undefined reference, immediately following this symbol.
-
- Indirection is asymmetrical. The other symbol's value will be used
- to satisfy requests for the indirect symbol, but not vice versa.
- If the other symbol does not have a definition, libraries will
- be searched to find a definition.
-
- So, for example, the following two lines placed in an assembler
- input file would result in an object file which would direct gnu ld
- to resolve all references to symbol "foo" as references to symbol
- "bar".
-
- .stabs "_foo",11,0,0,0
- .stabs "_bar",1,0,0,0
-
- Note that (11 == (N_INDR | N_EXT)) and (1 == (N_UNDF | N_EXT)). */
-
-#ifndef N_INDR
-#define N_INDR 0xa
-#endif
-
-/* The following symbols refer to set elements. These are expected
- only in input to the loader; they should not appear in loader
- output (unless relocatable output is requested). To be recognized
- by the loader, the input symbols must have their N_EXT bit set.
- All the N_SET[ATDB] symbols with the same name form one set. The
- loader collects all of these elements at load time and outputs a
- vector for each name.
- Space (an array of 32 bit words) is allocated for the set in the
- data section, and the n_value field of each set element value is
- stored into one word of the array.
- The first word of the array is the length of the set (number of
- elements). The last word of the vector is set to zero for possible
- use by incremental loaders. The array is ordered by the linkage
- order; the first symbols which the linker encounters will be first
- in the array.
-
- In C syntax this looks like:
-
- struct set_vector {
- unsigned int length;
- unsigned int vector[length];
- unsigned int always_zero;
- };
-
- Before being placed into the array, each element is relocated
- according to its type. This allows the loader to create an array
- of pointers to objects automatically. N_SETA type symbols will not
- be relocated.
-
- The address of the set is made into an N_SETV symbol
- whose name is the same as the name of the set.
- This symbol acts like a N_DATA global symbol
- in that it can satisfy undefined external references.
-
- For the purposes of determining whether or not to load in a library
- file, set element definitions are not considered "real
- definitions"; they will not cause the loading of a library
- member.
-
- If relocatable output is requested, none of this processing is
- done. The symbols are simply relocated and passed through to the
- output file.
-
- So, for example, the following three lines of assembler code
- (whether in one file or scattered between several different ones)
- will produce a three element vector (total length is five words;
- see above), referenced by the symbol "_xyzzy", which will have the
- addresses of the routines _init1, _init2, and _init3.
-
- *NOTE*: If symbolic addresses are used in the n_value field of the
- defining .stabs, those symbols must be defined in the same file as
- that containing the .stabs.
-
- .stabs "_xyzzy",23,0,0,_init1
- .stabs "_xyzzy",23,0,0,_init2
- .stabs "_xyzzy",23,0,0,_init3
-
- Note that (23 == (N_SETT | N_EXT)). */
-
-#ifndef N_SETA
-#define N_SETA 0x14 /* Absolute set element symbol */
-#endif /* This is input to LD, in a .o file. */
-
-#ifndef N_SETT
-#define N_SETT 0x16 /* Text set element symbol */
-#endif /* This is input to LD, in a .o file. */
-
-#ifndef N_SETD
-#define N_SETD 0x18 /* Data set element symbol */
-#endif /* This is input to LD, in a .o file. */
-
-#ifndef N_SETB
-#define N_SETB 0x1A /* Bss set element symbol */
-#endif /* This is input to LD, in a .o file. */
-
-/* Macros dealing with the set element symbols defined in a.out.h */
-#define SET_ELEMENT_P(x) ((x)>=N_SETA&&(x)<=(N_SETB|N_EXT))
-#define TYPE_OF_SET_ELEMENT(x) ((x)-N_SETA+N_ABS)
-
-#ifndef N_SETV
-#define N_SETV 0x1C /* Pointer to set vector in data area. */
-#endif /* This is output from LD. */
-
-/* If a this type of symbol is encountered, its name is a warning
- message to print each time the symbol referenced by the next symbol
- table entry is referenced.
-
- This feature may be used to allow backwards compatibility with
- certain functions (eg. gets) but to discourage programmers from
- their use.
-
- So if, for example, you wanted to have ld print a warning whenever
- the function "gets" was used in their C program, you would add the
- following to the assembler file in which gets is defined:
-
- .stabs "Obsolete function \"gets\" referenced",30,0,0,0
- .stabs "_gets",1,0,0,0
-
- These .stabs do not necessarily have to be in the same file as the
- gets function, they simply must exist somewhere in the compilation. */
-
-#ifndef N_WARNING
-#define N_WARNING 0x1E /* Warning message to print if symbol
- included */
-#endif /* This is input to ld */
-
-#ifndef __GNU_STAB__
-
-/* Line number for the data section. This is to be used to describe
- the source location of a variable declaration. */
-#ifndef N_DSLINE
-#define N_DSLINE (N_SLINE+N_DATA-N_TEXT)
-#endif
-
-/* Line number for the bss section. This is to be used to describe
- the source location of a variable declaration. */
-#ifndef N_BSLINE
-#define N_BSLINE (N_SLINE+N_BSS-N_TEXT)
-#endif
-
-#endif /* not __GNU_STAB__ */
-
-/* Symbol table */
-
-/* Global symbol data is recorded in these structures,
- one for each global symbol.
- They are found via hashing in 'symtab', which points to a vector of buckets.
- Each bucket is a chain of these structures through the link field. */
-
-typedef
- struct glosym
- {
- /* Pointer to next symbol in this symbol's hash bucket. */
- struct glosym *link;
- /* Name of this symbol. */
- char *name;
- /* Value of this symbol as a global symbol. */
- long value;
- /* Chain of external 'nlist's in files for this symbol, both defs
- and refs. */
- struct nlist *refs;
- /* Any warning message that might be associated with this symbol
- from an N_WARNING symbol encountered. */
- char *warning;
- /* Nonzero means definitions of this symbol as common have been seen,
- and the value here is the largest size specified by any of them. */
- int max_common_size;
- /* For relocatable_output, records the index of this global sym in the
- symbol table to be written, with the first global sym given index 0.*/
- int def_count;
- /* Nonzero means a definition of this global symbol is known to exist.
- Library members should not be loaded on its account. */
- char defined;
- /* Nonzero means a reference to this global symbol has been seen
- in a file that is surely being loaded.
- A value higher than 1 is the n_type code for the symbol's
- definition. */
- char referenced;
- /* A count of the number of undefined references printed for a
- specific symbol. If a symbol is unresolved at the end of
- digest_symbols (and the loading run is supposed to produce
- relocatable output) do_file_warnings keeps track of how many
- unresolved reference error messages have been printed for
- each symbol here. When the number hits MAX_UREFS_PRINTED,
- messages stop. */
- unsigned char undef_refs;
- /* 1 means that this symbol has multiple definitions. 2 means
- that it has multiple definitions, and some of them are set
- elements, one of which has been printed out already. */
- unsigned char multiply_defined;
- /* Nonzero means print a message at all refs or defs of this symbol */
- char trace;
- }
- symbol;
-
-/* Demangler for C++. */
-extern char *cplus_demangle ();
-
-/* Demangler function to use. */
-char *(*demangler)() = NULL;
-
-/* Number of buckets in symbol hash table */
-#define TABSIZE 1009
-
-/* The symbol hash table: a vector of TABSIZE pointers to struct glosym. */
-symbol *symtab[TABSIZE];
-
-/* Number of symbols in symbol hash table. */
-int num_hash_tab_syms = 0;
-
-/* Count the number of nlist entries that are for local symbols.
- This count and the three following counts
- are incremented as as symbols are entered in the symbol table. */
-int local_sym_count;
-
-/* Count number of nlist entries that are for local symbols
- whose names don't start with L. */
-int non_L_local_sym_count;
-
-/* Count the number of nlist entries for debugger info. */
-int debugger_sym_count;
-
-/* Count the number of global symbols referenced and not defined. */
-int undefined_global_sym_count;
-
-/* Count the number of global symbols multiply defined. */
-int multiple_def_count;
-
-/* Count the number of defined global symbols.
- Each symbol is counted only once
- regardless of how many different nlist entries refer to it,
- since the output file will need only one nlist entry for it.
- This count is computed by `digest_symbols';
- it is undefined while symbols are being loaded. */
-int defined_global_sym_count;
-
-/* Count the number of symbols defined through common declarations.
- This count is kept in symdef_library, linear_library, and
- enter_global_ref. It is incremented when the defined flag is set
- in a symbol because of a common definition, and decremented when
- the symbol is defined "for real" (ie. by something besides a common
- definition). */
-int common_defined_global_count;
-
-/* Count the number of set element type symbols and the number of
- separate vectors which these symbols will fit into. See the
- GNU a.out.h for more info.
- This count is computed by 'enter_file_symbols' */
-int set_symbol_count;
-int set_vector_count;
-
-/* Define a linked list of strings which define symbols which should
- be treated as set elements even though they aren't. Any symbol
- with a prefix matching one of these should be treated as a set
- element.
-
- This is to make up for deficiencies in many assemblers which aren't
- willing to pass any stabs through to the loader which they don't
- understand. */
-struct string_list_element {
- char *str;
- struct string_list_element *next;
-};
-
-struct string_list_element *set_element_prefixes;
-
-/* Count the number of definitions done indirectly (ie. done relative
- to the value of some other symbol. */
-int global_indirect_count;
-
-/* Count the number of warning symbols encountered. */
-int warning_count;
-
-/* Total number of symbols to be written in the output file.
- Computed by digest_symbols from the variables above. */
-int nsyms;
-
-
-/* Nonzero means ptr to symbol entry for symbol to use as start addr.
- -e sets this. */
-symbol *entry_symbol;
-
-symbol *edata_symbol; /* the symbol _edata */
-symbol *etext_symbol; /* the symbol _etext */
-symbol *end_symbol; /* the symbol _end */
-
-/* Each input file, and each library member ("subfile") being loaded,
- has a `file_entry' structure for it.
-
- For files specified by command args, these are contained in the vector
- which `file_table' points to.
-
- For library members, they are dynamically allocated,
- and chained through the `chain' field.
- The chain is found in the `subfiles' field of the `file_entry'.
- The `file_entry' objects for the members have `superfile' fields pointing
- to the one for the library. */
-
-struct file_entry {
- /* Name of this file. */
- char *filename;
- /* Name to use for the symbol giving address of text start */
- /* Usually the same as filename, but for a file spec'd with -l
- this is the -l switch itself rather than the filename. */
- char *local_sym_name;
-
- /* Describe the layout of the contents of the file */
-
- /* The file's a.out header. */
- struct exec header;
- /* Offset in file of GDB symbol segment, or 0 if there is none. */
- int symseg_offset;
-
- /* Describe data from the file loaded into core */
-
- /* Symbol table of the file. */
- struct nlist *symbols;
- /* Size in bytes of string table. */
- int string_size;
- /* Pointer to the string table.
- The string table is not kept in core all the time,
- but when it is in core, its address is here. */
- char *strings;
-
- /* Next two used only if `relocatable_output' or if needed for */
- /* output of undefined reference line numbers. */
-
- /* Text reloc info saved by `write_text' for `coptxtrel'. */
- struct relocation_info *textrel;
- /* Data reloc info saved by `write_data' for `copdatrel'. */
- struct relocation_info *datarel;
-
- /* Relation of this file's segments to the output file */
-
- /* Start of this file's text seg in the output file core image. */
- int text_start_address;
- /* Start of this file's data seg in the output file core image. */
- int data_start_address;
- /* Start of this file's bss seg in the output file core image. */
- int bss_start_address;
- /* Offset in bytes in the output file symbol table
- of the first local symbol for this file. Set by `write_file_symbols'. */
- int local_syms_offset;
-
- /* For library members only */
-
- /* For a library, points to chain of entries for the library members. */
- struct file_entry *subfiles;
- /* For a library member, offset of the member within the archive.
- Zero for files that are not library members. */
- int starting_offset;
- /* Size of contents of this file, if library member. */
- int total_size;
- /* For library member, points to the library's own entry. */
- struct file_entry *superfile;
- /* For library member, points to next entry for next member. */
- struct file_entry *chain;
-
- /* 1 if file is a library. */
- char library_flag;
-
- /* 1 if file's header has been read into this structure. */
- char header_read_flag;
-
- /* 1 means search a set of directories for this file. */
- char search_dirs_flag;
-
- /* 1 means this is base file of incremental load.
- Do not load this file's text or data.
- Also default text_start to after this file's bss. */
- char just_syms_flag;
-};
-
-/* Vector of entries for input files specified by arguments.
- These are all the input files except for members of specified libraries. */
-struct file_entry *file_table;
-
-/* Length of that vector. */
-int number_of_files;
-
-/* When loading the text and data, we can avoid doing a close
- and another open between members of the same library.
-
- These two variables remember the file that is currently open.
- Both are zero if no file is open.
-
- See `each_file' and `file_close'. */
-
-struct file_entry *input_file;
-int input_desc;
-
-/* The name of the file to write; "a.out" by default. */
-
-char *output_filename;
-
-/* Descriptor for writing that file with `mywrite'. */
-
-int outdesc;
-
-/* Header for that file (filled in by `write_header'). */
-
-struct exec outheader;
-
-#ifdef COFF_ENCAPSULATE
-struct coffheader coffheader;
-int need_coff_header;
-#endif
-
-/* The following are computed by `digest_symbols'. */
-
-int text_size; /* total size of text of all input files. */
-int data_size; /* total size of data of all input files. */
-int bss_size; /* total size of bss of all input files. */
-int text_reloc_size; /* total size of text relocation of all input files. */
-int data_reloc_size; /* total size of data relocation of all input */
- /* files. */
-
-/* Specifications of start and length of the area reserved at the end
- of the text segment for the set vectors. Computed in 'digest_symbols' */
-int set_sect_start;
-int set_sect_size;
-
-/* Pointer for in core storage for the above vectors, before they are
- written. */
-unsigned long *set_vectors;
-
-/* Amount of cleared space to leave between the text and data segments. */
-
-int text_pad;
-
-/* Amount of bss segment to include as part of the data segment. */
-
-int data_pad;
-
-/* Format of __.SYMDEF:
- First, a longword containing the size of the 'symdef' data that follows.
- Second, zero or more 'symdef' structures.
- Third, a longword containing the length of symbol name strings.
- Fourth, zero or more symbol name strings (each followed by a null). */
-
-struct symdef {
- int symbol_name_string_index;
- int library_member_offset;
-};
-
-/* Record most of the command options. */
-
-/* Address we assume the text section will be loaded at.
- We relocate symbols and text and data for this, but we do not
- write any padding in the output file for it. */
-int text_start;
-
-/* Offset of default entry-pc within the text section. */
-int entry_offset;
-
-/* Address we decide the data section will be loaded at. */
-int data_start;
-
-/* `text-start' address is normally this much plus a page boundary.
- This is not a user option; it is fixed for each system. */
-int text_start_alignment;
-
-/* Nonzero if -T was specified in the command line.
- This prevents text_start from being set later to default values. */
-int T_flag_specified;
-
-/* Nonzero if -Tdata was specified in the command line.
- This prevents data_start from being set later to default values. */
-int Tdata_flag_specified;
-
-/* Size to pad data section up to.
- We simply increase the size of the data section, padding with zeros,
- and reduce the size of the bss section to match. */
-int specified_data_size;
-
-/* Magic number to use for the output file, set by switch. */
-int magic;
-
-/* Nonzero means print names of input files as processed. */
-int trace_files;
-
-/* Which symbols should be stripped (omitted from the output):
- none, all, or debugger symbols. */
-enum { STRIP_NONE, STRIP_ALL, STRIP_DEBUGGER } strip_symbols;
-
-/* Which local symbols should be omitted:
- none, all, or those starting with L.
- This is irrelevant if STRIP_NONE. */
-enum { DISCARD_NONE, DISCARD_ALL, DISCARD_L } discard_locals;
-
-/* Do we want to pad the text to a page boundary? */
-int padtext;
-
-/* 1 => write load map. */
-int write_map;
-
-/* 1 => write relocation into output file so can re-input it later. */
-int relocatable_output;
-
-/* 1 => assign space to common symbols even if `relocatable_output'. */
-int force_common_definition;
-
-/* Standard directories to search for files specified by -l. */
-char *standard_search_dirs[] =
-#ifdef STANDARD_SEARCH_DIRS
- {STANDARD_SEARCH_DIRS};
-#else
-#ifdef NON_NATIVE
- {"/usr/local/lib/gnu"};
-#else
- {"/lib", "/usr/lib", "/usr/local/lib"};
-#endif
-#endif
-
-/* Actual vector of directories to search;
- this contains those specified with -L plus the standard ones. */
-char **search_dirs;
-
-/* Length of the vector `search_dirs'. */
-int n_search_dirs;
-
-/* Non zero means to create the output executable. */
-/* Cleared by nonfatal errors. */
-int make_executable;
-
-/* Force the executable to be output, even if there are non-fatal
- errors */
-int force_executable;
-
-/* Keep a list of any symbols referenced from the command line (so
- that error messages for these guys can be generated). This list is
- zero terminated. */
-struct glosym **cmdline_references;
-int cl_refs_allocated;
-
-void bcopy (), bzero ();
-int malloc (), realloc ();
-#ifndef alloca
-int alloca ();
-#endif
-int free ();
-
-int xmalloc ();
-int xrealloc ();
-void fatal ();
-void fatal_with_file ();
-void perror_name ();
-void perror_file ();
-void error ();
-
-void digest_symbols ();
-void print_symbols ();
-void load_symbols ();
-void decode_command ();
-void list_undefined_symbols ();
-void list_unresolved_references ();
-void write_output ();
-void write_header ();
-void write_text ();
-void read_file_relocation ();
-void write_data ();
-void write_rel ();
-void write_syms ();
-void write_symsegs ();
-void mywrite ();
-void symtab_init ();
-void padfile ();
-char *concat ();
-char *get_file_name ();
-symbol *getsym (), *getsym_soft ();
-
-int
-main (argc, argv)
- char **argv;
- int argc;
-{
-/* Added this to stop ld core-dumping on very large .o files. */
-#ifdef RLIMIT_STACK
- /* Get rid of any avoidable limit on stack size. */
- {
- struct rlimit rlim;
-
- /* Set the stack limit huge so that alloca does not fail. */
- getrlimit (RLIMIT_STACK, &rlim);
- rlim.rlim_cur = rlim.rlim_max;
- setrlimit (RLIMIT_STACK, &rlim);
- }
-#endif /* RLIMIT_STACK */
-
- page_size = getpagesize ();
- progname = argv[0];
-
- /* Clear the cumulative info on the output file. */
-
- text_size = 0;
- data_size = 0;
- bss_size = 0;
- text_reloc_size = 0;
- data_reloc_size = 0;
-
- data_pad = 0;
- text_pad = 0;
-
- /* Initialize the data about options. */
-
- specified_data_size = 0;
- strip_symbols = STRIP_NONE;
- trace_files = 0;
- discard_locals = DISCARD_NONE;
- padtext = 0;
- entry_symbol = 0;
- write_map = 0;
- relocatable_output = 0;
- force_common_definition = 0;
- T_flag_specified = 0;
- Tdata_flag_specified = 0;
- magic = DEFAULT_MAGIC;
- make_executable = 1;
- force_executable = 0;
- set_element_prefixes = 0;
-
- /* Initialize the cumulative counts of symbols. */
-
- local_sym_count = 0;
- non_L_local_sym_count = 0;
- debugger_sym_count = 0;
- undefined_global_sym_count = 0;
- set_symbol_count = 0;
- set_vector_count = 0;
- global_indirect_count = 0;
- warning_count = 0;
- multiple_def_count = 0;
- common_defined_global_count = 0;
-
- /* Keep a list of symbols referenced from the command line */
- cl_refs_allocated = 10;
- cmdline_references
- = (struct glosym **) xmalloc (cl_refs_allocated
- * sizeof(struct glosym *));
- *cmdline_references = 0;
-
- /* Completely decode ARGV. */
-
- decode_command (argc, argv);
-
- /* Create the symbols `etext', `edata' and `end'. */
-
- if (!relocatable_output)
- symtab_init ();
-
- /* Determine whether to count the header as part of
- the text size, and initialize the text size accordingly.
- This depends on the kind of system and on the output format selected. */
-
- N_SET_MAGIC (outheader, magic);
-#ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
-#endif
-
- text_size = sizeof (struct exec);
-#ifdef COFF_ENCAPSULATE
- if (relocatable_output == 0 && file_table[0].just_syms_flag == 0)
- {
- need_coff_header = 1;
- /* set this flag now, since it will change the values of N_TXTOFF, etc */
- N_SET_FLAGS (outheader, N_FLAGS_COFF_ENCAPSULATE);
- text_size += sizeof (struct coffheader);
- }
-#endif
-
- text_size -= N_TXTOFF (outheader);
-
- if (text_size < 0)
- text_size = 0;
- entry_offset = text_size;
-
- if (!T_flag_specified && !relocatable_output)
- text_start = TEXT_START (outheader);
-
- /* The text-start address is normally this far past a page boundary. */
- text_start_alignment = text_start % page_size;
-
- /* Load symbols of all input files.
- Also search all libraries and decide which library members to load. */
-
- load_symbols ();
-
- /* Compute where each file's sections go, and relocate symbols. */
-
- digest_symbols ();
-
- /* Print error messages for any missing symbols, for any warning
- symbols, and possibly multiple definitions */
-
- do_warnings (stderr);
-
- /* Print a map, if requested. */
-
- if (write_map) print_symbols (stdout);
-
- /* Write the output file. */
-
- if (make_executable || force_executable)
- write_output ();
-
- exit (!make_executable);
-}
-
-void decode_option ();
-
-/* Analyze a command line argument.
- Return 0 if the argument is a filename.
- Return 1 if the argument is a option complete in itself.
- Return 2 if the argument is a option which uses an argument.
-
- Thus, the value is the number of consecutive arguments
- that are part of options. */
-
-int
-classify_arg (arg)
- register char *arg;
-{
- if (*arg != '-') return 0;
- switch (arg[1])
- {
- case 'A':
- case 'D':
- case 'e':
- case 'L':
- case 'l':
- case 'o':
- case 'u':
- case 'V':
- case 'y':
- if (arg[2])
- return 1;
- return 2;
-
- case 'B':
- if (! strcmp (&arg[2], "static"))
- return 1;
-
- case 'T':
- if (arg[2] == 0)
- return 2;
- if (! strcmp (&arg[2], "text"))
- return 2;
- if (! strcmp (&arg[2], "data"))
- return 2;
- return 1;
- }
-
- return 1;
-}
-
-/* Process the command arguments,
- setting up file_table with an entry for each input file,
- and setting variables according to the options. */
-
-void
-decode_command (argc, argv)
- char **argv;
- int argc;
-{
- register int i;
- register struct file_entry *p;
- char *cp;
-
- number_of_files = 0;
- output_filename = "a.out";
-
- n_search_dirs = 0;
- search_dirs = (char **) xmalloc (sizeof (char *));
-
- /* First compute number_of_files so we know how long to make file_table. */
- /* Also process most options completely. */
-
- for (i = 1; i < argc; i++)
- {
- register int code = classify_arg (argv[i]);
- if (code)
- {
- if (i + code > argc)
- fatal ("no argument following %s\n", argv[i]);
-
- decode_option (argv[i], argv[i+1]);
-
- if (argv[i][1] == 'l' || argv[i][1] == 'A')
- number_of_files++;
-
- i += code - 1;
- }
- else
- number_of_files++;
- }
-
- if (!number_of_files)
- fatal ("no input files", 0);
-
- p = file_table
- = (struct file_entry *) xmalloc (number_of_files * sizeof (struct file_entry));
- bzero (p, number_of_files * sizeof (struct file_entry));
-
- /* Now scan again and fill in file_table. */
- /* All options except -A and -l are ignored here. */
-
- for (i = 1; i < argc; i++)
- {
- register int code = classify_arg (argv[i]);
-
- if (code)
- {
- char *string;
- if (code == 2)
- string = argv[i+1];
- else
- string = &argv[i][2];
-
- if (argv[i][1] == 'A')
- {
- if (p != file_table)
- fatal ("-A specified before an input file other than the first");
-
- p->filename = string;
- p->local_sym_name = string;
- p->just_syms_flag = 1;
- p++;
- }
- if (argv[i][1] == 'l')
- {
- if (cp = rindex(string, '/'))
- {
- *cp++ = '\0';
- cp = concat (string, "/lib", cp);
- p->filename = concat (cp, ".a", "");
- }
- else
- p->filename = concat ("lib", string, ".a");
-
- p->local_sym_name = concat ("-l", string, "");
- p->search_dirs_flag = 1;
- p++;
- }
- i += code - 1;
- }
- else
- {
- p->filename = argv[i];
- p->local_sym_name = argv[i];
- p++;
- }
- }
-
- /* Now check some option settings for consistency. */
-
-#ifdef NMAGIC
- if ((magic == ZMAGIC || magic == NMAGIC)
-#else
- if ((magic == ZMAGIC)
-#endif
- && (text_start - text_start_alignment) & (page_size - 1))
- fatal ("-T argument not multiple of page size, with sharable output", 0);
-
- /* Append the standard search directories to the user-specified ones. */
- {
- int n = sizeof standard_search_dirs / sizeof standard_search_dirs[0];
- n_search_dirs += n;
- search_dirs
- = (char **) xrealloc (search_dirs, n_search_dirs * sizeof (char *));
- bcopy (standard_search_dirs, &search_dirs[n_search_dirs - n],
- n * sizeof (char *));
- }
-}
-
-
-void
-add_cmdline_ref (sp)
- struct glosym *sp;
-{
- struct glosym **ptr;
-
- for (ptr = cmdline_references;
- ptr < cmdline_references + cl_refs_allocated && *ptr;
- ptr++)
- ;
-
- if (ptr >= cmdline_references + cl_refs_allocated - 1)
- {
- int diff = ptr - cmdline_references;
-
- cl_refs_allocated *= 2;
- cmdline_references = (struct glosym **)
- xrealloc (cmdline_references,
- cl_refs_allocated * sizeof (struct glosym *));
- ptr = cmdline_references + diff;
- }
-
- *ptr++ = sp;
- *ptr = (struct glosym *) 0;
-}
-
-int
-set_element_prefixed_p (name)
- char *name;
-{
- struct string_list_element *p;
- int i;
-
- for (p = set_element_prefixes; p; p = p->next)
- {
- for (i = 0; p->str[i] != '\0' && (p->str[i] == name[i]); i++)
- ;
-
- if (p->str[i] == '\0')
- return 1;
- }
- return 0;
-}
-
-int parse ();
-
-/* Record an option and arrange to act on it later.
- ARG should be the following command argument,
- which may or may not be used by this option.
-
- The `l' and `A' options are ignored here since they actually
- specify input files. */
-
-void
-decode_option (swt, arg)
- register char *swt, *arg;
-{
- /* We get Bstatic from gcc on suns. */
- if (! strcmp (swt + 1, "Bstatic"))
- return;
- if (! strcmp (swt + 1, "Ttext"))
- {
- text_start = parse (arg, "%x", "invalid argument to -Ttext");
- T_flag_specified = 1;
- return;
- }
- if (! strcmp (swt + 1, "Tdata"))
- {
- data_start = parse (arg, "%x", "invalid argument to -Tdata");
- Tdata_flag_specified = 1;
- return;
- }
- if (! strcmp (swt + 1, "noinhibit-exec"))
- {
- force_executable = 1;
- return;
- }
-
- if (swt[2] != 0)
- arg = &swt[2];
-
- switch (swt[1])
- {
- case 'A':
- return;
-
- case 'D':
- specified_data_size = parse (arg, "%x", "invalid argument to -D");
- return;
-
- case 'd':
- force_common_definition = 1;
- return;
-
- case 'e':
- entry_symbol = getsym (arg);
- if (!entry_symbol->defined && !entry_symbol->referenced)
- undefined_global_sym_count++;
- entry_symbol->referenced = 1;
- add_cmdline_ref (entry_symbol);
- return;
-
- case 'l':
- /* If linking with libg++, use the C++ demangler. */
- if (arg != NULL && strcmp (arg, "g++") == 0)
- demangler = cplus_demangle;
- return;
-
- case 'L':
- n_search_dirs++;
- search_dirs
- = (char **) xrealloc (search_dirs, n_search_dirs * sizeof (char *));
- search_dirs[n_search_dirs - 1] = arg;
- return;
-
- case 'M':
- write_map = 1;
- return;
-
- case 'N':
- magic = OMAGIC;
- return;
-
-#ifdef NMAGIC
- case 'n':
- magic = NMAGIC;
- return;
-#endif
-
- case 'o':
- output_filename = arg;
- return;
-
- case 'p':
- padtext = 1;
- return;
-
- case 'r':
- relocatable_output = 1;
- magic = OMAGIC;
- text_start = 0;
- return;
-
- case 'S':
- strip_symbols = STRIP_DEBUGGER;
- return;
-
- case 's':
- strip_symbols = STRIP_ALL;
- return;
-
- case 'T':
- text_start = parse (arg, "%x", "invalid argument to -T");
- T_flag_specified = 1;
- return;
-
- case 't':
- trace_files = 1;
- return;
-
- case 'u':
- {
- register symbol *sp = getsym (arg);
- if (!sp->defined && !sp->referenced)
- undefined_global_sym_count++;
- sp->referenced = 1;
- add_cmdline_ref (sp);
- }
- return;
-
- case 'V':
- {
- struct string_list_element *new
- = (struct string_list_element *)
- xmalloc (sizeof (struct string_list_element));
-
- new->str = arg;
- new->next = set_element_prefixes;
- set_element_prefixes = new;
- return;
- }
-
- case 'X':
- discard_locals = DISCARD_L;
- return;
-
- case 'x':
- discard_locals = DISCARD_ALL;
- return;
-
- case 'y':
- {
- register symbol *sp = getsym (&swt[2]);
- sp->trace = 1;
- }
- return;
-
- case 'z':
- magic = ZMAGIC;
- return;
-
- default:
- fatal ("invalid command option `%s'", swt);
- }
-}
-
-/** Convenient functions for operating on one or all files being */
- /** loaded. */
-void print_file_name ();
-
-/* Call FUNCTION on each input file entry.
- Do not call for entries for libraries;
- instead, call once for each library member that is being loaded.
-
- FUNCTION receives two arguments: the entry, and ARG. */
-
-void
-each_file (function, arg)
- register void (*function)();
- register int arg;
-{
- register int i;
-
- for (i = 0; i < number_of_files; i++)
- {
- register struct file_entry *entry = &file_table[i];
- if (entry->library_flag)
- {
- register struct file_entry *subentry = entry->subfiles;
- for (; subentry; subentry = subentry->chain)
- (*function) (subentry, arg);
- }
- else
- (*function) (entry, arg);
- }
-}
-
-/* Call FUNCTION on each input file entry until it returns a non-zero
- value. Return this value.
- Do not call for entries for libraries;
- instead, call once for each library member that is being loaded.
-
- FUNCTION receives two arguments: the entry, and ARG. It must be a
- function returning unsigned long (though this can probably be fudged). */
-
-unsigned long
-check_each_file (function, arg)
- register unsigned long (*function)();
- register int arg;
-{
- register int i;
- register unsigned long return_val;
-
- for (i = 0; i < number_of_files; i++)
- {
- register struct file_entry *entry = &file_table[i];
- if (entry->library_flag)
- {
- register struct file_entry *subentry = entry->subfiles;
- for (; subentry; subentry = subentry->chain)
- if (return_val = (*function) (subentry, arg))
- return return_val;
- }
- else
- if (return_val = (*function) (entry, arg))
- return return_val;
- }
- return 0;
-}
-
-/* Like `each_file' but ignore files that were just for symbol definitions. */
-
-void
-each_full_file (function, arg)
- register void (*function)();
- register int arg;
-{
- register int i;
-
- for (i = 0; i < number_of_files; i++)
- {
- register struct file_entry *entry = &file_table[i];
- if (entry->just_syms_flag)
- continue;
- if (entry->library_flag)
- {
- register struct file_entry *subentry = entry->subfiles;
- for (; subentry; subentry = subentry->chain)
- (*function) (subentry, arg);
- }
- else
- (*function) (entry, arg);
- }
-}
-
-/* Close the input file that is now open. */
-
-void
-file_close ()
-{
- close (input_desc);
- input_desc = 0;
- input_file = 0;
-}
-
-/* Open the input file specified by 'entry', and return a descriptor.
- The open file is remembered; if the same file is opened twice in a row,
- a new open is not actually done. */
-
-int
-file_open (entry)
- register struct file_entry *entry;
-{
- register int desc;
-
- if (entry->superfile)
- return file_open (entry->superfile);
-
- if (entry == input_file)
- return input_desc;
-
- if (input_file) file_close ();
-
- if (entry->search_dirs_flag)
- {
- int i;
-
- for (i = 0; i < n_search_dirs; i++)
- {
- register char *string
- = concat (search_dirs[i], "/", entry->filename);
- desc = open (string, O_RDONLY, 0);
- if (desc > 0)
- {
- entry->filename = string;
- entry->search_dirs_flag = 0;
- break;
- }
- free (string);
- }
- }
- else
- desc = open (entry->filename, O_RDONLY, 0);
-
- if (desc > 0)
- {
- input_file = entry;
- input_desc = desc;
- return desc;
- }
-
- perror_file (entry);
- /* NOTREACHED */
-}
-
-/* Print the filename of ENTRY on OUTFILE (a stdio stream),
- and then a newline. */
-
-void
-prline_file_name (entry, outfile)
- struct file_entry *entry;
- FILE *outfile;
-{
- print_file_name (entry, outfile);
- fprintf (outfile, "\n");
-}
-
-/* Print the filename of ENTRY on OUTFILE (a stdio stream). */
-
-void
-print_file_name (entry, outfile)
- struct file_entry *entry;
- FILE *outfile;
-{
- if (entry->superfile)
- {
- print_file_name (entry->superfile, outfile);
- fprintf (outfile, "(%s)", entry->filename);
- }
- else
- fprintf (outfile, "%s", entry->filename);
-}
-
-/* Return the filename of entry as a string (malloc'd for the purpose) */
-
-char *
-get_file_name (entry)
- struct file_entry *entry;
-{
- char *result, *supfile;
- if (entry->superfile)
- {
- supfile = get_file_name (entry->superfile);
- result = (char *) xmalloc (strlen (supfile)
- + strlen (entry->filename) + 3);
- sprintf (result, "%s(%s)", supfile, entry->filename);
- free (supfile);
- }
- else
- {
- result = (char *) xmalloc (strlen (entry->filename) + 1);
- strcpy (result, entry->filename);
- }
- return result;
-}
-
-/* Medium-level input routines for rel files. */
-
-/* Read a file's header into the proper place in the file_entry.
- DESC is the descriptor on which the file is open.
- ENTRY is the file's entry. */
-
-void
-read_header (desc, entry)
- int desc;
- register struct file_entry *entry;
-{
- register int len;
- struct exec *loc = (struct exec *) &entry->header;
-
- lseek (desc, entry->starting_offset, 0);
-#ifdef COFF_ENCAPSULATE
- if (entry->just_syms_flag)
- lseek (desc, sizeof(coffheader), 1);
-#endif
- len = read (desc, loc, sizeof (struct exec));
- if (len != sizeof (struct exec))
- fatal_with_file ("failure reading header of ", entry);
- if (N_BADMAG (*loc))
- fatal_with_file ("bad magic number in ", entry);
-
- entry->header_read_flag = 1;
-}
-
-/* Read the symbols of file ENTRY into core.
- Assume it is already open, on descriptor DESC.
- Also read the length of the string table, which follows the symbol table,
- but don't read the contents of the string table. */
-
-void
-read_entry_symbols (desc, entry)
- struct file_entry *entry;
- int desc;
-{
- int str_size;
-
- if (!entry->header_read_flag)
- read_header (desc, entry);
-
- entry->symbols = (struct nlist *) xmalloc (entry->header.a_syms);
-
- lseek (desc, N_SYMOFF (entry->header) + entry->starting_offset, 0);
- if (entry->header.a_syms != read (desc, entry->symbols, entry->header.a_syms))
- fatal_with_file ("premature end of file in symbols of ", entry);
-
- lseek (desc, N_STROFF (entry->header) + entry->starting_offset, 0);
- if (sizeof str_size != read (desc, &str_size, sizeof str_size))
- fatal_with_file ("bad string table size in ", entry);
-
- entry->string_size = str_size;
-}
-
-/* Read the string table of file ENTRY into core.
- Assume it is already open, on descriptor DESC.
- Also record whether a GDB symbol segment follows the string table. */
-
-void
-read_entry_strings (desc, entry)
- struct file_entry *entry;
- int desc;
-{
- int buffer;
-
- if (!entry->header_read_flag)
- read_header (desc, entry);
-
- lseek (desc, N_STROFF (entry->header) + entry->starting_offset, 0);
- if (entry->string_size != read (desc, entry->strings, entry->string_size))
- fatal_with_file ("premature end of file in strings of ", entry);
-
- /* While we are here, see if the file has a symbol segment at the end.
- For a separate file, just try reading some more.
- For a library member, compare current pos against total size. */
- if (entry->superfile)
- {
- if (entry->total_size == N_STROFF (entry->header) + entry->string_size)
- return;
- }
- else
- {
- buffer = read (desc, &buffer, sizeof buffer);
- if (buffer == 0)
- return;
- if (buffer != sizeof buffer)
- fatal_with_file ("premature end of file in GDB symbol segment of ", entry);
- }
- /* Don't try to do anything with symsegs. */
- return;
-#if 0
- /* eliminate warning of `statement not reached'. */
- entry->symseg_offset = N_STROFF (entry->header) + entry->string_size;
-#endif
-}
-
-/* Read in the symbols of all input files. */
-
-void read_file_symbols (), read_entry_symbols (), read_entry_strings ();
-void enter_file_symbols (), enter_global_ref (), search_library ();
-
-void
-load_symbols ()
-{
- register int i;
-
- if (trace_files) fprintf (stderr, "Loading symbols:\n\n");
-
- for (i = 0; i < number_of_files; i++)
- {
- register struct file_entry *entry = &file_table[i];
- read_file_symbols (entry);
- }
-
- if (trace_files) fprintf (stderr, "\n");
-}
-
-/* If ENTRY is a rel file, read its symbol and string sections into core.
- If it is a library, search it and load the appropriate members
- (which means calling this function recursively on those members). */
-
-void
-read_file_symbols (entry)
- register struct file_entry *entry;
-{
- register int desc;
- register int len;
- struct exec hdr;
-
- desc = file_open (entry);
-
-#ifdef COFF_ENCAPSULATE
- if (entry->just_syms_flag)
- lseek (desc, sizeof(coffheader),0);
-#endif
-
- len = read (desc, &hdr, sizeof hdr);
- if (len != sizeof hdr)
- fatal_with_file ("failure reading header of ", entry);
-
- if (!N_BADMAG (hdr))
- {
- read_entry_symbols (desc, entry);
- entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (desc, entry);
- enter_file_symbols (entry);
- entry->strings = 0;
- }
- else
- {
- char armag[SARMAG];
-
- lseek (desc, 0, 0);
- if (SARMAG != read (desc, armag, SARMAG) || strncmp (armag, ARMAG, SARMAG))
- fatal_with_file ("malformed input file (not rel or archive) ", entry);
- entry->library_flag = 1;
- search_library (desc, entry);
- }
-
- file_close ();
-}
-
-/* Enter the external symbol defs and refs of ENTRY in the hash table. */
-
-void
-enter_file_symbols (entry)
- struct file_entry *entry;
-{
- register struct nlist
- *p,
- *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- if (trace_files) prline_file_name (entry, stderr);
-
- for (p = entry->symbols; p < end; p++)
- {
- if (p->n_type == (N_SETV | N_EXT)) continue;
- if (set_element_prefixes
- && set_element_prefixed_p (p->n_un.n_strx + entry->strings))
- p->n_type += (N_SETA - N_ABS);
-
- if (SET_ELEMENT_P (p->n_type))
- {
- set_symbol_count++;
- if (!relocatable_output)
- enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
- }
- else if (p->n_type == N_WARNING)
- {
- char *name = p->n_un.n_strx + entry->strings;
-
- /* Grab the next entry. */
- p++;
- if (p->n_type != (N_UNDF | N_EXT))
- {
- fprintf (stderr, "%s: Warning symbol found in %s without external reference following.\n",
- progname, entry->filename);
- make_executable = 0;
- p--; /* Process normally. */
- }
- else
- {
- symbol *sp;
- char *sname = p->n_un.n_strx + entry->strings;
- /* Deal with the warning symbol. */
- enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
- sp = getsym (sname);
- sp->warning = (char *) xmalloc (strlen(name) + 1);
- strcpy (sp->warning, name);
- warning_count++;
- }
- }
- else if (p->n_type & N_EXT)
- enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
- else if (p->n_un.n_strx && !(p->n_type & (N_STAB | N_EXT)))
- {
- if ((p->n_un.n_strx + entry->strings)[0] != LPREFIX)
- non_L_local_sym_count++;
- local_sym_count++;
- }
- else debugger_sym_count++;
- }
-
- /* Count one for the local symbol that we generate,
- whose name is the file's name (usually) and whose address
- is the start of the file's text. */
-
- local_sym_count++;
- non_L_local_sym_count++;
-}
-
-/* Enter one global symbol in the hash table.
- NLIST_P points to the `struct nlist' read from the file
- that describes the global symbol. NAME is the symbol's name.
- ENTRY is the file entry for the file the symbol comes from.
-
- The `struct nlist' is modified by placing it on a chain of
- all such structs that refer to the same global symbol.
- This chain starts in the `refs' field of the symbol table entry
- and is chained through the `n_name'. */
-
-void
-enter_global_ref (nlist_p, name, entry)
- register struct nlist *nlist_p;
- char *name;
- struct file_entry *entry;
-{
- register symbol *sp = getsym (name);
- register int type = nlist_p->n_type;
- int oldref = sp->referenced;
- int olddef = sp->defined;
- int com = sp->defined && sp->max_common_size;
-
- nlist_p->n_un.n_name = (char *) sp->refs;
- sp->refs = nlist_p;
-
- sp->referenced = 1;
- if (type != (N_UNDF | N_EXT) || nlist_p->n_value)
- {
- if (!sp->defined || sp->defined == (N_UNDF | N_EXT))
- sp->defined = type;
-
- if (oldref && !olddef)
- /* It used to be undefined and we're defining it. */
- undefined_global_sym_count--;
-
- if (!olddef && type == (N_UNDF | N_EXT) && nlist_p->n_value)
- {
- /* First definition and it's common. */
- common_defined_global_count++;
- sp->max_common_size = nlist_p->n_value;
- }
- else if (com && type != (N_UNDF | N_EXT))
- {
- /* It used to be common and we're defining it as
- something else. */
- common_defined_global_count--;
- sp->max_common_size = 0;
- }
- else if (com && type == (N_UNDF | N_EXT)
- && sp->max_common_size < nlist_p->n_value)
- /* It used to be common and this is a new common entry to
- which we need to pay attention. */
- sp->max_common_size = nlist_p->n_value;
-
- /* Are we defining it as a set element? */
- if (SET_ELEMENT_P (type) && (!olddef || com))
- set_vector_count++;
- /* As an indirection? */
- else if (type == (N_INDR | N_EXT))
- {
- /* Indirect symbols value should be modified to point
- a symbol being equivalenced to. */
- nlist_p->n_value
- = (unsigned int) getsym ((nlist_p + 1)->n_un.n_strx
- + entry->strings);
- if ((symbol *) nlist_p->n_value == sp)
- {
- /* Somebody redefined a symbol to be itself. */
- fprintf (stderr, "%s: Symbol %s indirected to itself.\n",
- entry->filename, name);
- /* Rewrite this symbol as being a global text symbol
- with value 0. */
- nlist_p->n_type = sp->defined = N_TEXT | N_EXT;
- nlist_p->n_value = 0;
- /* Don't make the output executable. */
- make_executable = 0;
- }
- else
- global_indirect_count++;
- }
- }
- else
- if (!oldref)
-#ifndef DOLLAR_KLUDGE
- undefined_global_sym_count++;
-#else
- {
- if (entry->superfile && type == (N_UNDF | N_EXT) && name[1] == '$')
- {
- /* This is an (ISI?) $-conditional; skip it */
- sp->referenced = 0;
- if (sp->trace)
- {
- fprintf (stderr, "symbol %s is a $-conditional ignored in ", sp->name);
- print_file_name (entry, stderr);
- fprintf (stderr, "\n");
- }
- return;
- }
- else
- undefined_global_sym_count++;
- }
-#endif
-
- if (sp == end_symbol && entry->just_syms_flag && !T_flag_specified)
- text_start = nlist_p->n_value;
-
- if (sp->trace)
- {
- register char *reftype;
- switch (type & N_TYPE)
- {
- case N_UNDF:
- if (nlist_p->n_value)
- reftype = "defined as common";
- else reftype = "referenced";
- break;
-
- case N_ABS:
- reftype = "defined as absolute";
- break;
-
- case N_TEXT:
- reftype = "defined in text section";
- break;
-
- case N_DATA:
- reftype = "defined in data section";
- break;
-
- case N_BSS:
- reftype = "defined in BSS section";
- break;
-
- case N_SETT:
- reftype = "is a text set element";
- break;
-
- case N_SETD:
- reftype = "is a data set element";
- break;
-
- case N_SETB:
- reftype = "is a BSS set element";
- break;
-
- case N_SETA:
- reftype = "is an absolute set element";
- break;
-
- case N_SETV:
- reftype = "defined in data section as vector";
- break;
-
- case N_INDR:
- reftype = (char *) alloca (23
- + strlen ((nlist_p + 1)->n_un.n_strx
- + entry->strings));
- sprintf (reftype, "defined equivalent to %s",
- (nlist_p + 1)->n_un.n_strx + entry->strings);
- break;
-
-#ifdef sequent
- case N_SHUNDF:
- reftype = "shared undf";
- break;
-
-/* These conflict with cases above.
- case N_SHDATA:
- reftype = "shared data";
- break;
-
- case N_SHBSS:
- reftype = "shared BSS";
- break;
-*/
- default:
- reftype = "I don't know this type";
- break;
-#endif
- }
-
- fprintf (stderr, "symbol %s %s in ", sp->name, reftype);
- print_file_name (entry, stderr);
- fprintf (stderr, "\n");
- }
-}
-
-/* This return 0 if the given file entry's symbol table does *not*
- contain the nlist point entry, and it returns the files entry
- pointer (cast to unsigned long) if it does. */
-
-unsigned long
-contains_symbol (entry, n_ptr)
- struct file_entry *entry;
- register struct nlist *n_ptr;
-{
- if (n_ptr >= entry->symbols &&
- n_ptr < (entry->symbols
- + (entry->header.a_syms / sizeof (struct nlist))))
- return (unsigned long) entry;
- return 0;
-}
-
-
-/* Searching libraries */
-
-struct file_entry *decode_library_subfile ();
-void linear_library (), symdef_library ();
-
-/* Search the library ENTRY, already open on descriptor DESC.
- This means deciding which library members to load,
- making a chain of `struct file_entry' for those members,
- and entering their global symbols in the hash table. */
-
-void
-search_library (desc, entry)
- int desc;
- struct file_entry *entry;
-{
- int member_length;
- register char *name;
- register struct file_entry *subentry;
-
- if (!undefined_global_sym_count) return;
-
- /* Examine its first member, which starts SARMAG bytes in. */
- subentry = decode_library_subfile (desc, entry, SARMAG, &member_length);
- if (!subentry) return;
-
- name = subentry->filename;
- free (subentry);
-
- /* Search via __.SYMDEF if that exists, else linearly. */
-
- if (!strcmp (name, "__.SYMDEF"))
- symdef_library (desc, entry, member_length);
- else
- linear_library (desc, entry);
-}
-
-/* Construct and return a file_entry for a library member.
- The library's file_entry is library_entry, and the library is open on DESC.
- SUBFILE_OFFSET is the byte index in the library of this member's header.
- We store the length of the member into *LENGTH_LOC. */
-
-struct file_entry *
-decode_library_subfile (desc, library_entry, subfile_offset, length_loc)
- int desc;
- struct file_entry *library_entry;
- int subfile_offset;
- int *length_loc;
-{
- int bytes_read;
- register int namelen;
- int member_length;
- register char *name;
- struct ar_hdr hdr1;
- register struct file_entry *subentry;
-
- lseek (desc, subfile_offset, 0);
-
- bytes_read = read (desc, &hdr1, sizeof hdr1);
- if (!bytes_read)
- return 0; /* end of archive */
-
- if (sizeof hdr1 != bytes_read)
- fatal_with_file ("malformed library archive ", library_entry);
-
- if (sscanf (hdr1.ar_size, "%d", &member_length) != 1)
- fatal_with_file ("malformatted header of archive member in ", library_entry);
-
- subentry = (struct file_entry *) xmalloc (sizeof (struct file_entry));
- bzero (subentry, sizeof (struct file_entry));
-
- for (namelen = 0;
- namelen < sizeof hdr1.ar_name
- && hdr1.ar_name[namelen] != 0 && hdr1.ar_name[namelen] != ' '
- && hdr1.ar_name[namelen] != '/';
- namelen++);
-
- name = (char *) xmalloc (namelen+1);
- strncpy (name, hdr1.ar_name, namelen);
- name[namelen] = 0;
-
- subentry->filename = name;
- subentry->local_sym_name = name;
- subentry->symbols = 0;
- subentry->strings = 0;
- subentry->subfiles = 0;
- subentry->starting_offset = subfile_offset + sizeof hdr1;
- subentry->superfile = library_entry;
- subentry->library_flag = 0;
- subentry->header_read_flag = 0;
- subentry->just_syms_flag = 0;
- subentry->chain = 0;
- subentry->total_size = member_length;
-
- (*length_loc) = member_length;
-
- return subentry;
-}
-
-int subfile_wanted_p ();
-
-/* Search a library that has a __.SYMDEF member.
- DESC is a descriptor on which the library is open.
- The file pointer is assumed to point at the __.SYMDEF data.
- ENTRY is the library's file_entry.
- MEMBER_LENGTH is the length of the __.SYMDEF data. */
-
-void
-symdef_library (desc, entry, member_length)
- int desc;
- struct file_entry *entry;
- int member_length;
-{
- int *symdef_data = (int *) xmalloc (member_length);
- register struct symdef *symdef_base;
- char *sym_name_base;
- int number_of_symdefs;
- int length_of_strings;
- int not_finished;
- int bytes_read;
- register int i;
- struct file_entry *prev = 0;
- int prev_offset = 0;
-
- bytes_read = read (desc, symdef_data, member_length);
- if (bytes_read != member_length)
- fatal_with_file ("malformatted __.SYMDEF in ", entry);
-
- number_of_symdefs = *symdef_data / sizeof (struct symdef);
- if (number_of_symdefs < 0 ||
- number_of_symdefs * sizeof (struct symdef) + 2 * sizeof (int) > member_length)
- fatal_with_file ("malformatted __.SYMDEF in ", entry);
-
- symdef_base = (struct symdef *) (symdef_data + 1);
- length_of_strings = *(int *) (symdef_base + number_of_symdefs);
-
- if (length_of_strings < 0
- || number_of_symdefs * sizeof (struct symdef) + length_of_strings
- + 2 * sizeof (int) > member_length)
- fatal_with_file ("malformatted __.SYMDEF in ", entry);
-
- sym_name_base = sizeof (int) + (char *) (symdef_base + number_of_symdefs);
-
- /* Check all the string indexes for validity. */
-
- for (i = 0; i < number_of_symdefs; i++)
- {
- register int index = symdef_base[i].symbol_name_string_index;
- if (index < 0 || index >= length_of_strings
- || (index && *(sym_name_base + index - 1)))
- fatal_with_file ("malformatted __.SYMDEF in ", entry);
- }
-
- /* Search the symdef data for members to load.
- Do this until one whole pass finds nothing to load. */
-
- not_finished = 1;
- while (not_finished)
- {
- not_finished = 0;
-
- /* Scan all the symbols mentioned in the symdef for ones that we need.
- Load the library members that contain such symbols. */
-
- for (i = 0;
- (i < number_of_symdefs
- && (undefined_global_sym_count || common_defined_global_count));
- i++)
- if (symdef_base[i].symbol_name_string_index >= 0)
- {
- register symbol *sp;
-
- sp = getsym_soft (sym_name_base
- + symdef_base[i].symbol_name_string_index);
-
- /* If we find a symbol that appears to be needed, think carefully
- about the archive member that the symbol is in. */
-
- /*
- * Per Mike Karels' recommendation, we no longer load library
- * files if the only reference(s) that would be satisfied are
- * 'common' references. This prevents some problems with name
- * pollution (e.g. a global common 'utime' linked to a function).
- */
- if (sp && sp->referenced && !sp->defined)
- {
- int junk;
- register int j;
- register int offset = symdef_base[i].library_member_offset;
- struct file_entry *subentry;
-
- /* Don't think carefully about any archive member
- more than once in a given pass. */
-
- if (prev_offset == offset)
- continue;
- prev_offset = offset;
-
- /* Read the symbol table of the archive member. */
-
- subentry = decode_library_subfile (desc, entry, offset, &junk);
- if (subentry == 0)
- fatal ("invalid offset for %s in symbol table of %s",
- sym_name_base
- + symdef_base[i].symbol_name_string_index,
- entry->filename);
- read_entry_symbols (desc, subentry);
- subentry->strings = (char *) malloc (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- /* Now scan the symbol table and decide whether to load. */
-
- if (!subfile_wanted_p (subentry))
- {
- free (subentry->symbols);
- free (subentry);
- }
- else
- {
- /* This member is needed; load it.
- Since we are loading something on this pass,
- we must make another pass through the symdef data. */
-
- not_finished = 1;
-
- enter_file_symbols (subentry);
-
- if (prev)
- prev->chain = subentry;
- else entry->subfiles = subentry;
- prev = subentry;
-
- /* Clear out this member's symbols from the symdef data
- so that following passes won't waste time on them. */
-
- for (j = 0; j < number_of_symdefs; j++)
- {
- if (symdef_base[j].library_member_offset == offset)
- symdef_base[j].symbol_name_string_index = -1;
- }
- }
-
- /* We'll read the strings again if we need them again. */
- free (subentry->strings);
- subentry->strings = 0;
- }
- }
- }
-
- free (symdef_data);
-}
-
-/* Search a library that has no __.SYMDEF.
- ENTRY is the library's file_entry.
- DESC is the descriptor it is open on. */
-
-void
-linear_library (desc, entry)
- int desc;
- struct file_entry *entry;
-{
- register struct file_entry *prev = 0;
- register int this_subfile_offset = SARMAG;
-
- while (undefined_global_sym_count || common_defined_global_count)
- {
- int member_length;
- register struct file_entry *subentry;
-
- subentry = decode_library_subfile (desc, entry, this_subfile_offset,
- &member_length);
-
- if (!subentry) return;
-
- read_entry_symbols (desc, subentry);
- subentry->strings = (char *) alloca (subentry->string_size);
- read_entry_strings (desc, subentry);
-
- if (!subfile_wanted_p (subentry))
- {
- free (subentry->symbols);
- free (subentry);
- }
- else
- {
- enter_file_symbols (subentry);
-
- if (prev)
- prev->chain = subentry;
- else entry->subfiles = subentry;
- prev = subentry;
- subentry->strings = 0; /* Since space will dissapear on return */
- }
-
- this_subfile_offset += member_length + sizeof (struct ar_hdr);
- if (this_subfile_offset & 1) this_subfile_offset++;
- }
-}
-
-/* ENTRY is an entry for a library member.
- Its symbols have been read into core, but not entered.
- Return nonzero if we ought to load this member. */
-
-int
-subfile_wanted_p (entry)
- struct file_entry *entry;
-{
- register struct nlist *p;
- register struct nlist *end
- = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-#ifdef DOLLAR_KLUDGE
- register int dollar_cond = 0;
-#endif
-
- for (p = entry->symbols; p < end; p++)
- {
- register int type = p->n_type;
- register char *name = p->n_un.n_strx + entry->strings;
-
- /* If the symbol has an interesting definition, we could
- potentially want it. */
- if (type & N_EXT
- && (type != (N_UNDF | N_EXT) || p->n_value
-
-#ifdef DOLLAR_KLUDGE
- || name[1] == '$'
-#endif
- )
- && !SET_ELEMENT_P (type)
- && !set_element_prefixed_p (name))
- {
- register symbol *sp = getsym_soft (name);
-
-#ifdef DOLLAR_KLUDGE
- if (name[1] == '$')
- {
- sp = getsym_soft (&name[2]);
- dollar_cond = 1;
- if (!sp) continue;
- if (sp->referenced)
- {
- if (write_map)
- {
- print_file_name (entry, stdout);
- fprintf (stdout, " needed due to $-conditional %s\n", name);
- }
- return 1;
- }
- continue;
- }
-#endif
-
- /* If this symbol has not been hashed, we can't be looking for it. */
-
- if (!sp) continue;
-
- /*
- * We don't load a file if it merely satisfies a common reference
- * (see explanation above in symdef_library()).
- */
- if (sp->referenced && !sp->defined)
- {
- /* This is a symbol we are looking for. It is either
- not yet defined or defined as a common. */
-#ifdef DOLLAR_KLUDGE
- if (dollar_cond) continue;
-#endif
- if (type == (N_UNDF | N_EXT))
- {
- /* Symbol being defined as common.
- Remember this, but don't load subfile just for this. */
-
- /* If it didn't used to be common, up the count of
- common symbols. */
- if (!sp->max_common_size)
- common_defined_global_count++;
-
- if (sp->max_common_size < p->n_value)
- sp->max_common_size = p->n_value;
- if (!sp->defined)
- undefined_global_sym_count--;
- sp->defined = 1;
- continue;
- }
-
- if (write_map)
- {
- print_file_name (entry, stdout);
- fprintf (stdout, " needed due to %s\n", sp->name);
- }
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-void consider_file_section_lengths (), relocate_file_addresses ();
-
-/* Having entered all the global symbols and found the sizes of sections
- of all files to be linked, make all appropriate deductions from this data.
-
- We propagate global symbol values from definitions to references.
- We compute the layout of the output file and where each input file's
- contents fit into it. */
-
-void
-digest_symbols ()
-{
- register int i;
- int setv_fill_count;
-
- if (trace_files)
- fprintf (stderr, "Digesting symbol information:\n\n");
-
- /* Compute total size of sections */
-
- each_file (consider_file_section_lengths, 0);
-
- /* If necessary, pad text section to full page in the file.
- Include the padding in the text segment size. */
-
- if (magic == ZMAGIC)
- {
- int text_end = text_size + N_TXTOFF (outheader);
- text_pad = ((text_end + page_size - 1) & (- page_size)) - text_end;
- text_size += text_pad;
- }
- if (padtext)
- {
- int text_end = text_size;
- text_pad = ((text_end + page_size - 1) & (- page_size)) - text_end;
- text_size += text_pad;
- }
-
-#ifdef _N_BASEADDR
- /* SunOS 4.1 N_TXTADDR depends on the value of outheader.a_entry. */
- outheader.a_entry = N_PAGSIZ (outheader);
-#endif
-
- outheader.a_text = text_size;
-#ifdef sequent
- outheader.a_text += N_ADDRADJ (outheader);
-#endif
-
- /* Make the data segment address start in memory on a suitable boundary. */
-
- if (! Tdata_flag_specified)
- data_start = N_DATADDR (outheader) + text_start - TEXT_START (outheader);
-
- /* Set up the set element vector */
-
- if (!relocatable_output)
- {
- /* The set sector size is the number of set elements + a word
- for each symbol for the length word at the beginning of the
- vector, plus a word for each symbol for a zero at the end of
- the vector (for incremental linking). */
- set_sect_size
- = (2 * set_symbol_count + set_vector_count) * sizeof (unsigned long);
- set_sect_start = data_start + data_size;
- data_size += set_sect_size;
- set_vectors = (unsigned long *) xmalloc (set_sect_size);
- setv_fill_count = 0;
- }
-
- /* Compute start addresses of each file's sections and symbols. */
-
- each_full_file (relocate_file_addresses, 0);
-
- /* Now, for each symbol, verify that it is defined globally at most once.
- Put the global value into the symbol entry.
- Common symbols are allocated here, in the BSS section.
- Each defined symbol is given a '->defined' field
- which is the correct N_ code for its definition,
- except in the case of common symbols with -r.
- Then make all the references point at the symbol entry
- instead of being chained together. */
-
- defined_global_sym_count = 0;
-
- for (i = 0; i < TABSIZE; i++)
- {
- register symbol *sp;
- for (sp = symtab[i]; sp; sp = sp->link)
- {
- /* For each symbol */
- register struct nlist *p, *next;
- int defs = 0, com = sp->max_common_size;
- struct nlist *first_definition;
- for (p = sp->refs; p; p = next)
- {
- register int type = p->n_type;
-
- if (SET_ELEMENT_P (type))
- {
- if (relocatable_output)
- fatal ("internal: global ref to set element with -r");
- if (!defs++)
- {
- sp->value = set_sect_start
- + setv_fill_count++ * sizeof (unsigned long);
- sp->defined = N_SETV | N_EXT;
- first_definition = p;
- }
- else if ((sp->defined & ~N_EXT) != N_SETV)
- {
- sp->multiply_defined = 1;
- multiple_def_count++;
- }
- set_vectors[setv_fill_count++] = p->n_value;
- }
- else if ((type & N_EXT) && type != (N_UNDF | N_EXT))
- {
- /* non-common definition */
- if (defs++ && sp->value != p->n_value)
- {
- sp->multiply_defined = 1;
- multiple_def_count++;
- }
- sp->value = p->n_value;
- sp->defined = type;
- first_definition = p;
- }
- next = (struct nlist *) p->n_un.n_name;
- p->n_un.n_name = (char *) sp;
- }
- /* Allocate as common if defined as common and not defined for real */
- if (com && !defs)
- {
- if (!relocatable_output || force_common_definition)
- {
- int align = sizeof (int);
-
- /* Round up to nearest sizeof (int). I don't know
- whether this is necessary or not (given that
- alignment is taken care of later), but it's
- traditional, so I'll leave it in. Note that if
- this size alignment is ever removed, ALIGN above
- will have to be initialized to 1 instead of
- sizeof (int). */
-
- com = (com + sizeof (int) - 1) & (- sizeof (int));
-
- while (!(com & align))
- align <<= 1;
-
- align = align > MAX_ALIGNMENT ? MAX_ALIGNMENT : align;
-
- bss_size = ((((bss_size + data_size + data_start)
- + (align - 1)) & (- align))
- - data_size - data_start);
-
- sp->value = data_start + data_size + bss_size;
- sp->defined = N_BSS | N_EXT;
- bss_size += com;
- if (write_map)
- printf ("Allocating common %s: %x at %x\n",
- sp->name, com, sp->value);
- }
- else
- {
- sp->defined = 0;
- undefined_global_sym_count++;
- }
- }
- /* Set length word at front of vector and zero byte at end.
- Reverse the vector itself to put it in file order. */
- if ((sp->defined & ~N_EXT) == N_SETV)
- {
- unsigned long length_word_index
- = (sp->value - set_sect_start) / sizeof (unsigned long);
- unsigned long i, tmp;
-
- set_vectors[length_word_index]
- = setv_fill_count - 1 - length_word_index;
-
- /* Reverse the vector. */
- for (i = 1;
- i < (setv_fill_count - length_word_index - 1) / 2 + 1;
- i++)
- {
- tmp = set_vectors[length_word_index + i];
- set_vectors[length_word_index + i]
- = set_vectors[setv_fill_count - i];
- set_vectors[setv_fill_count - i] = tmp;
- }
-
- set_vectors[setv_fill_count++] = 0;
- }
- if (sp->defined)
- defined_global_sym_count++;
- }
- }
-
- if (end_symbol) /* These are null if -r. */
- {
- etext_symbol->value = text_size + text_start;
- edata_symbol->value = data_start + data_size;
- end_symbol->value = data_start + data_size + bss_size;
- }
-
- /* Figure the data_pad now, so that it overlaps with the bss addresses. */
-
- if (specified_data_size && specified_data_size > data_size)
- data_pad = specified_data_size - data_size;
-
- if (magic == ZMAGIC)
- data_pad = ((data_pad + data_size + page_size - 1) & (- page_size))
- - data_size;
-
- bss_size -= data_pad;
- if (bss_size < 0) bss_size = 0;
-
- data_size += data_pad;
-}
-
-/* Accumulate the section sizes of input file ENTRY
- into the section sizes of the output file. */
-
-void
-consider_file_section_lengths (entry)
- register struct file_entry *entry;
-{
- if (entry->just_syms_flag)
- return;
-
- entry->text_start_address = text_size;
- /* If there were any vectors, we need to chop them off */
- text_size += entry->header.a_text;
- entry->data_start_address = data_size;
- data_size += entry->header.a_data;
- entry->bss_start_address = bss_size;
- bss_size += entry->header.a_bss;
-
- text_reloc_size += entry->header.a_trsize;
- data_reloc_size += entry->header.a_drsize;
-}
-
-/* Determine where the sections of ENTRY go into the output file,
- whose total section sizes are already known.
- Also relocate the addresses of the file's local and debugger symbols. */
-
-void
-relocate_file_addresses (entry)
- register struct file_entry *entry;
-{
- entry->text_start_address += text_start;
- /* Note that `data_start' and `data_size' have not yet been
- adjusted for `data_pad'. If they had been, we would get the wrong
- results here. */
- entry->data_start_address += data_start;
- entry->bss_start_address += data_start + data_size;
-
- {
- register struct nlist *p;
- register struct nlist *end
- = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- for (p = entry->symbols; p < end; p++)
- {
- /* If this belongs to a section, update it by the section's start address */
- register int type = p->n_type & N_TYPE;
-
- switch (type)
- {
- case N_TEXT:
- case N_SETT:
- p->n_value += entry->text_start_address;
- break;
- case N_DATA:
- case N_SETV:
- case N_SETD:
- /* A symbol whose value is in the data section
- is present in the input file as if the data section
- started at an address equal to the length of the file's text. */
- p->n_value += entry->data_start_address - entry->header.a_text;
- break;
- case N_BSS:
- case N_SETB:
- /* likewise for symbols with value in BSS. */
- p->n_value += entry->bss_start_address
- - entry->header.a_text - entry->header.a_data;
- break;
- }
- }
- }
-}
-
-void describe_file_sections (), list_file_locals ();
-
-/* Print a complete or partial map of the output file. */
-
-void
-print_symbols (outfile)
- FILE *outfile;
-{
- register int i;
-
- fprintf (outfile, "\nFiles:\n\n");
-
- each_file (describe_file_sections, outfile);
-
- fprintf (outfile, "\nGlobal symbols:\n\n");
-
- for (i = 0; i < TABSIZE; i++)
- {
- register symbol *sp;
- for (sp = symtab[i]; sp; sp = sp->link)
- {
- if (sp->defined == 1)
- fprintf (outfile, " %s: common, length 0x%x\n", sp->name, sp->max_common_size);
- if (sp->defined)
- fprintf (outfile, " %s: 0x%x\n", sp->name, sp->value);
- else if (sp->referenced)
- fprintf (outfile, " %s: undefined\n", sp->name);
- }
- }
-
- each_file (list_file_locals, outfile);
-}
-
-void
-describe_file_sections (entry, outfile)
- struct file_entry *entry;
- FILE *outfile;
-{
- fprintf (outfile, " ");
- print_file_name (entry, outfile);
- if (entry->just_syms_flag)
- fprintf (outfile, " symbols only\n", 0);
- else
- fprintf (outfile, " text %x(%x), data %x(%x), bss %x(%x) hex\n",
- entry->text_start_address, entry->header.a_text,
- entry->data_start_address, entry->header.a_data,
- entry->bss_start_address, entry->header.a_bss);
-}
-
-void
-list_file_locals (entry, outfile)
- struct file_entry *entry;
- FILE *outfile;
-{
- register struct nlist
- *p,
- *end = entry->symbols + entry->header.a_syms / sizeof (struct nlist);
-
- entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- fprintf (outfile, "\nLocal symbols of ");
- print_file_name (entry, outfile);
- fprintf (outfile, ":\n\n");
-
- for (p = entry->symbols; p < end; p++)
- /* If this is a definition,
- update it if necessary by this file's start address. */
- if (!(p->n_type & (N_STAB | N_EXT)))
- fprintf (outfile, " %s: 0x%x\n",
- entry->strings + p->n_un.n_strx, p->n_value);
-
- entry->strings = 0; /* All done with them. */
-}
-
-
-/* Static vars for do_warnings and subroutines of it */
-int list_unresolved_refs; /* List unresolved refs */
-int list_warning_symbols; /* List warning syms */
-int list_multiple_defs; /* List multiple definitions */
-
-/*
- * Structure for communication between do_file_warnings and it's
- * helper routines. Will in practice be an array of three of these:
- * 0) Current line, 1) Next line, 2) Source file info.
- */
-struct line_debug_entry
-{
- int line;
- char *filename;
- struct nlist *sym;
-};
-
-void qsort ();
-/*
- * Helper routines for do_file_warnings.
- */
-
-/* Return an integer less than, equal to, or greater than 0 as per the
- relation between the two relocation entries. Used by qsort. */
-
-int
-relocation_entries_relation (rel1, rel2)
- struct relocation_info *rel1, *rel2;
-{
- return RELOC_ADDRESS(rel1) - RELOC_ADDRESS(rel2);
-}
-
-/* Moves to the next debugging symbol in the file. USE_DATA_SYMBOLS
- determines the type of the debugging symbol to look for (DSLINE or
- SLINE). STATE_POINTER keeps track of the old and new locatiosn in
- the file. It assumes that state_pointer[1] is valid; ie
- that it.sym points into some entry in the symbol table. If
- state_pointer[1].sym == 0, this routine should not be called. */
-
-int
-next_debug_entry (use_data_symbols, state_pointer)
- register int use_data_symbols;
- /* Next must be passed by reference! */
- struct line_debug_entry state_pointer[3];
-{
- register struct line_debug_entry
- *current = state_pointer,
- *next = state_pointer + 1,
- /* Used to store source file */
- *source = state_pointer + 2;
- struct file_entry *entry = (struct file_entry *) source->sym;
-
- current->sym = next->sym;
- current->line = next->line;
- current->filename = next->filename;
-
- while (++(next->sym) < (entry->symbols
- + entry->header.a_syms/sizeof (struct nlist)))
- {
- /* n_type is a char, and N_SOL, N_EINCL and N_BINCL are > 0x80, so
- * may look negative...therefore, must mask to low bits
- */
- switch (next->sym->n_type & 0xff)
- {
- case N_SLINE:
- if (use_data_symbols) continue;
- next->line = next->sym->n_desc;
- return 1;
- case N_DSLINE:
- if (!use_data_symbols) continue;
- next->line = next->sym->n_desc;
- return 1;
-#ifdef HAVE_SUN_STABS
- case N_EINCL:
- next->filename = source->filename;
- continue;
-#endif
- case N_SO:
- source->filename = next->sym->n_un.n_strx + entry->strings;
- source->line++;
-#ifdef HAVE_SUN_STABS
- case N_BINCL:
-#endif
- case N_SOL:
- next->filename
- = next->sym->n_un.n_strx + entry->strings;
- default:
- continue;
- }
- }
- next->sym = (struct nlist *) 0;
- return 0;
-}
-
-/* Create a structure to save the state of a scan through the debug
- symbols. USE_DATA_SYMBOLS is set if we should be scanning for
- DSLINE's instead of SLINE's. entry is the file entry which points
- at the symbols to use. */
-
-struct line_debug_entry *
-init_debug_scan (use_data_symbols, entry)
- int use_data_symbols;
- struct file_entry *entry;
-{
- struct line_debug_entry
- *state_pointer
- = (struct line_debug_entry *)
- xmalloc (3 * sizeof (struct line_debug_entry));
- register struct line_debug_entry
- *current = state_pointer,
- *next = state_pointer + 1,
- *source = state_pointer + 2; /* Used to store source file */
-
- struct nlist *tmp;
-
- for (tmp = entry->symbols;
- tmp < (entry->symbols
- + entry->header.a_syms/sizeof (struct nlist));
- tmp++)
- if (tmp->n_type == (int) N_SO)
- break;
-
- if (tmp >= (entry->symbols
- + entry->header.a_syms/sizeof (struct nlist)))
- {
- /* I believe this translates to "We lose" */
- current->filename = next->filename = entry->filename;
- current->line = next->line = -1;
- current->sym = next->sym = (struct nlist *) 0;
- return state_pointer;
- }
-
- next->line = source->line = 0;
- next->filename = source->filename
- = (tmp->n_un.n_strx + entry->strings);
- source->sym = (struct nlist *) entry;
- next->sym = tmp;
-
- next_debug_entry (use_data_symbols, state_pointer); /* To setup next */
-
- if (!next->sym) /* No line numbers for this section; */
- /* setup output results as appropriate */
- {
- if (source->line)
- {
- current->filename = source->filename = entry->filename;
- current->line = -1; /* Don't print lineno */
- }
- else
- {
- current->filename = source->filename;
- current->line = 0;
- }
- return state_pointer;
- }
-
-
- next_debug_entry (use_data_symbols, state_pointer); /* To setup current */
-
- return state_pointer;
-}
-
-/* Takes an ADDRESS (in either text or data space) and a STATE_POINTER
- which describes the current location in the implied scan through
- the debug symbols within the file which ADDRESS is within, and
- returns the source line number which corresponds to ADDRESS. */
-
-int
-address_to_line (address, state_pointer)
- unsigned long address;
- /* Next must be passed by reference! */
- struct line_debug_entry state_pointer[3];
-{
- struct line_debug_entry
- *current = state_pointer,
- *next = state_pointer + 1;
- struct line_debug_entry *tmp_pointer;
-
- int use_data_symbols;
-
- if (next->sym)
- use_data_symbols = (next->sym->n_type & N_TYPE) == N_DATA;
- else
- return current->line;
-
- /* Go back to the beginning if we've already passed it. */
- if (current->sym->n_value > address)
- {
- tmp_pointer = init_debug_scan (use_data_symbols,
- (struct file_entry *)
- ((state_pointer + 2)->sym));
- state_pointer[0] = tmp_pointer[0];
- state_pointer[1] = tmp_pointer[1];
- state_pointer[2] = tmp_pointer[2];
- free (tmp_pointer);
- }
-
- /* If we're still in a bad way, return -1, meaning invalid line. */
- if (current->sym->n_value > address)
- return -1;
-
- while (next->sym
- && next->sym->n_value <= address
- && next_debug_entry (use_data_symbols, state_pointer))
- ;
- return current->line;
-}
-
-
-/* Macros for manipulating bitvectors. */
-#define BIT_SET_P(bv, index) ((bv)[(index) >> 3] & 1 << ((index) & 0x7))
-#define SET_BIT(bv, index) ((bv)[(index) >> 3] |= 1 << ((index) & 0x7))
-
-/* This routine will scan through the relocation data of file ENTRY,
- printing out references to undefined symbols and references to
- symbols defined in files with N_WARNING symbols. If DATA_SEGMENT
- is non-zero, it will scan the data relocation segment (and use
- N_DSLINE symbols to track line number); otherwise it will scan the
- text relocation segment. Warnings will be printed on the output
- stream OUTFILE. Eventually, every nlist symbol mapped through will
- be marked in the NLIST_BITVECTOR, so we don't repeat ourselves when
- we scan the nlists themselves. */
-
-do_relocation_warnings (entry, data_segment, outfile, nlist_bitvector)
- struct file_entry *entry;
- int data_segment;
- FILE *outfile;
- unsigned char *nlist_bitvector;
-{
- struct relocation_info
- *reloc_start = data_segment ? entry->datarel : entry->textrel,
- *reloc;
- int reloc_size
- = ((data_segment ? entry->header.a_drsize : entry->header.a_trsize)
- / sizeof (struct relocation_info));
- int start_of_segment
- = (data_segment ? entry->data_start_address : entry->text_start_address);
- struct nlist *start_of_syms = entry->symbols;
- struct line_debug_entry *state_pointer
- = init_debug_scan (data_segment != 0, entry);
- register struct line_debug_entry
- *current = state_pointer;
- /* Assigned to generally static values; should not be written into. */
- char *errfmt;
- /* Assigned to alloca'd values cand copied into; should be freed
- when done. */
- char *errmsg;
- int invalidate_line_number;
-
- /* We need to sort the relocation info here. Sheesh, so much effort
- for one lousy error optimization. */
-
- qsort (reloc_start, reloc_size, sizeof (struct relocation_info),
- relocation_entries_relation);
-
- for (reloc = reloc_start;
- reloc < (reloc_start + reloc_size);
- reloc++)
- {
- register struct nlist *s;
- register symbol *g;
-
- /* If the relocation isn't resolved through a symbol, continue */
- if (!RELOC_EXTERN_P(reloc))
- continue;
-
- s = &(entry->symbols[RELOC_SYMBOL(reloc)]);
-
- /* Local symbols shouldn't ever be used by relocation info, so
- the next should be safe.
- This is, of course, wrong. References to local BSS symbols can be
- the targets of relocation info, and they can (must) be
- resolved through symbols. However, these must be defined properly,
- (the assembler would have caught it otherwise), so we can
- ignore these cases. */
- if (!(s->n_type & N_EXT))
- continue;
-
- g = (symbol *) s->n_un.n_name;
- errmsg = 0;
-
- if (!g->defined && list_unresolved_refs) /* Reference */
- {
- /* Mark as being noted by relocation warning pass. */
- SET_BIT (nlist_bitvector, s - start_of_syms);
-
- if (g->undef_refs >= MAX_UREFS_PRINTED) /* Listed too many */
- continue;
-
- /* Undefined symbol which we should mention */
-
- if (++(g->undef_refs) == MAX_UREFS_PRINTED)
- {
- errfmt = "More undefined symbol %s refs follow";
- invalidate_line_number = 1;
- }
- else
- {
- errfmt = "Undefined symbol %s referenced from %s segment";
- invalidate_line_number = 0;
- }
- }
- else /* Defined */
- {
- /* Potential symbol warning here */
- if (!g->warning) continue;
-
- /* Mark as being noted by relocation warning pass. */
- SET_BIT (nlist_bitvector, s - start_of_syms);
-
- errfmt = 0;
- errmsg = g->warning;
- invalidate_line_number = 0;
- }
-
-
- /* If errfmt == 0, errmsg has already been defined. */
- if (errfmt != 0)
- {
- char *nm;
-
- if (demangler == NULL || (nm = (*demangler)(g->name)) == NULL)
- nm = g->name;
- errmsg = (char *) xmalloc (strlen (errfmt) + strlen (nm) + 1);
- sprintf (errmsg, errfmt, nm, data_segment ? "data" : "text");
- if (nm != g->name)
- free (nm);
- }
-
- address_to_line (RELOC_ADDRESS (reloc) + start_of_segment,
- state_pointer);
-
- if (current->line >=0)
- fprintf (outfile, "%s:%d: %s\n", current->filename,
- invalidate_line_number ? 0 : current->line, errmsg);
- else
- fprintf (outfile, "%s: %s\n", current->filename, errmsg);
-
- if (errfmt != 0)
- free (errmsg);
- }
-
- free (state_pointer);
-}
-
-/* Print on OUTFILE a list of all warnings generated by references
- and/or definitions in the file ENTRY. List source file and line
- number if possible, just the .o file if not. */
-
-void
-do_file_warnings (entry, outfile)
- struct file_entry *entry;
- FILE *outfile;
-{
- int number_of_syms = entry->header.a_syms / sizeof (struct nlist);
- unsigned char *nlist_bitvector
- = (unsigned char *) alloca ((number_of_syms >> 3) + 1);
- struct line_debug_entry *text_scan, *data_scan;
- int i;
- char *errfmt, *file_name;
- int line_number;
- int dont_allow_symbol_name;
-
- bzero (nlist_bitvector, (number_of_syms >> 3) + 1);
-
- /* Read in the files strings if they aren't available */
- if (!entry->strings)
- {
- int desc;
-
- entry->strings = (char *) alloca (entry->string_size);
- desc = file_open (entry);
- read_entry_strings (desc, entry);
- }
-
- read_file_relocation (entry);
-
- /* Do text warnings based on a scan through the relocation info. */
- do_relocation_warnings (entry, 0, outfile, nlist_bitvector);
-
- /* Do data warnings based on a scan through the relocation info. */
- do_relocation_warnings (entry, 1, outfile, nlist_bitvector);
-
- /* Scan through all of the nlist entries in this file and pick up
- anything that the scan through the relocation stuff didn't. */
-
- text_scan = init_debug_scan (0, entry);
- data_scan = init_debug_scan (1, entry);
-
- for (i = 0; i < number_of_syms; i++)
- {
- struct nlist *s;
- struct glosym *g;
-
- s = entry->symbols + i;
-
- if (!(s->n_type & N_EXT))
- continue;
-
- g = (symbol *) s->n_un.n_name;
- dont_allow_symbol_name = 0;
-
- if (list_multiple_defs && g->multiply_defined)
- {
- errfmt = "Definition of symbol %s (multiply defined)";
- switch (s->n_type)
- {
- case N_TEXT | N_EXT:
- line_number = address_to_line (s->n_value, text_scan);
- file_name = text_scan[0].filename;
- break;
- case N_DATA | N_EXT:
- line_number = address_to_line (s->n_value, data_scan);
- file_name = data_scan[0].filename;
- break;
- case N_SETA | N_EXT:
- case N_SETT | N_EXT:
- case N_SETD | N_EXT:
- case N_SETB | N_EXT:
- if (g->multiply_defined == 2)
- continue;
- errfmt = "First set element definition of symbol %s (multiply defined)";
- break;
- default:
- continue; /* Don't print out multiple defs
- at references. */
- }
- }
- else if (BIT_SET_P (nlist_bitvector, i))
- continue;
- else if (list_unresolved_refs && !g->defined)
- {
- if (g->undef_refs >= MAX_UREFS_PRINTED)
- continue;
-
- if (++(g->undef_refs) == MAX_UREFS_PRINTED)
- errfmt = "More undefined \"%s\" refs follow";
- else
- errfmt = "Undefined symbol \"%s\" referenced";
- line_number = -1;
- }
- else if (g->warning)
- {
- /* There are two cases in which we don't want to
- do this. The first is if this is a definition instead of
- a reference. The second is if it's the reference used by
- the warning stabs itself. */
- if (s->n_type != (N_EXT | N_UNDF)
- || (i && (s-1)->n_type == N_WARNING))
- continue;
-
- errfmt = g->warning;
- line_number = -1;
- dont_allow_symbol_name = 1;
- }
- else
- continue;
-
- if (line_number == -1)
- fprintf (outfile, "%s: ", entry->filename);
- else
- fprintf (outfile, "%s:%d: ", file_name, line_number);
-
- if (dont_allow_symbol_name)
- fprintf (outfile, "%s", errfmt);
- else
- {
- char *nm;
- if (demangler != NULL && (nm = (*demangler)(g->name)) != NULL)
- {
- fprintf (outfile, errfmt, nm);
- free (nm);
- }
- else
- fprintf (outfile, errfmt, g->name);
- }
-
- fputc ('\n', outfile);
- }
- free (text_scan);
- free (data_scan);
- entry->strings = 0; /* Since it will dissapear anyway. */
-}
-
-do_warnings (outfile)
- FILE *outfile;
-{
- list_unresolved_refs = !relocatable_output && undefined_global_sym_count;
- list_warning_symbols = warning_count;
- list_multiple_defs = multiple_def_count != 0;
-
- if (!(list_unresolved_refs ||
- list_warning_symbols ||
- list_multiple_defs ))
- /* No need to run this routine */
- return;
-
- each_file (do_file_warnings, outfile);
-
- if (list_unresolved_refs || list_multiple_defs)
- make_executable = 0;
-}
-
-/* Write the output file */
-
-void
-write_output ()
-{
- struct stat statbuf;
- int filemode;
-
- (void) unlink (output_filename);
- outdesc = open (output_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- if (outdesc < 0) perror_name (output_filename);
-
- if (fstat (outdesc, &statbuf) < 0)
- perror_name (output_filename);
-
- (void) fchflags(outdesc, statbuf.st_flags | UF_NODUMP);
-
- filemode = statbuf.st_mode;
- (void) fchmod (outdesc, filemode & ~0111);
-
- /* Output the a.out header. */
- write_header ();
-
- /* Output the text and data segments, relocating as we go. */
- write_text ();
- write_data ();
-
- /* Output the merged relocation info, if requested with `-r'. */
- if (relocatable_output)
- write_rel ();
-
- /* Output the symbol table (both globals and locals). */
- write_syms ();
-
- /* Copy any GDB symbol segments from input files. */
- write_symsegs ();
-
- if (fchmod (outdesc, filemode | 0111) == -1)
- perror_name (output_filename);
-
- close (outdesc);
-}
-
-void modify_location (), perform_relocation (), copy_text (), copy_data ();
-
-void
-write_header ()
-{
- N_SET_MAGIC (outheader, magic);
- outheader.a_text = text_size;
-#ifdef sequent
- outheader.a_text += N_ADDRADJ (outheader);
- if (entry_symbol == 0)
- entry_symbol = getsym("start");
-#endif
- outheader.a_data = data_size;
- outheader.a_bss = bss_size;
- outheader.a_entry = (entry_symbol ? entry_symbol->value
- : text_start + entry_offset);
-#ifdef COFF_ENCAPSULATE
- if (need_coff_header)
- {
- /* We are encapsulating BSD format within COFF format. */
- struct coffscn *tp, *dp, *bp;
-
- tp = &coffheader.scns[0];
- dp = &coffheader.scns[1];
- bp = &coffheader.scns[2];
-
- strcpy (tp->s_name, ".text");
- tp->s_paddr = text_start;
- tp->s_vaddr = text_start;
- tp->s_size = text_size;
- tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec);
- tp->s_relptr = 0;
- tp->s_lnnoptr = 0;
- tp->s_nreloc = 0;
- tp->s_nlnno = 0;
- tp->s_flags = 0x20;
- strcpy (dp->s_name, ".data");
- dp->s_paddr = data_start;
- dp->s_vaddr = data_start;
- dp->s_size = data_size;
- dp->s_scnptr = tp->s_scnptr + tp->s_size;
- dp->s_relptr = 0;
- dp->s_lnnoptr = 0;
- dp->s_nreloc = 0;
- dp->s_nlnno = 0;
- dp->s_flags = 0x40;
- strcpy (bp->s_name, ".bss");
- bp->s_paddr = dp->s_vaddr + dp->s_size;
- bp->s_vaddr = bp->s_paddr;
- bp->s_size = bss_size;
- bp->s_scnptr = 0;
- bp->s_relptr = 0;
- bp->s_lnnoptr = 0;
- bp->s_nreloc = 0;
- bp->s_nlnno = 0;
- bp->s_flags = 0x80;
-
- coffheader.f_magic = COFF_MAGIC;
- coffheader.f_nscns = 3;
- /* store an unlikely time so programs can
- * tell that there is a bsd header
- */
- coffheader.f_timdat = 1;
- coffheader.f_symptr = 0;
- coffheader.f_nsyms = 0;
- coffheader.f_opthdr = 28;
- coffheader.f_flags = 0x103;
- /* aouthdr */
- coffheader.magic = ZMAGIC;
- coffheader.vstamp = 0;
- coffheader.tsize = tp->s_size;
- coffheader.dsize = dp->s_size;
- coffheader.bsize = bp->s_size;
- coffheader.entry = outheader.a_entry;
- coffheader.text_start = tp->s_vaddr;
- coffheader.data_start = dp->s_vaddr;
- }
-#endif
-
-#ifdef INITIALIZE_HEADER
- INITIALIZE_HEADER;
-#endif
-
- if (strip_symbols == STRIP_ALL)
- nsyms = 0;
- else
- {
- nsyms = (defined_global_sym_count
- + undefined_global_sym_count);
- if (discard_locals == DISCARD_L)
- nsyms += non_L_local_sym_count;
- else if (discard_locals == DISCARD_NONE)
- nsyms += local_sym_count;
- /* One extra for following reference on indirects */
- if (relocatable_output)
- nsyms += set_symbol_count + global_indirect_count;
- }
-
- if (strip_symbols == STRIP_NONE)
- nsyms += debugger_sym_count;
-
- outheader.a_syms = nsyms * sizeof (struct nlist);
-
- if (relocatable_output)
- {
- outheader.a_trsize = text_reloc_size;
- outheader.a_drsize = data_reloc_size;
- }
- else
- {
- outheader.a_trsize = 0;
- outheader.a_drsize = 0;
- }
-
-#ifdef COFF_ENCAPSULATE
- if (need_coff_header)
- mywrite (&coffheader, sizeof coffheader, 1, outdesc);
-#endif
- mywrite (&outheader, sizeof (struct exec), 1, outdesc);
-
- /* Output whatever padding is required in the executable file
- between the header and the start of the text. */
-
-#ifndef COFF_ENCAPSULATE
- padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
-#endif
-}
-
-/* Relocate the text segment of each input file
- and write to the output file. */
-
-void
-write_text ()
-{
- if (trace_files)
- fprintf (stderr, "Copying and relocating text:\n\n");
-
- each_full_file (copy_text, 0);
- file_close ();
-
- if (trace_files)
- fprintf (stderr, "\n");
-
- padfile (text_pad, outdesc);
-}
-
-int
-text_offset (entry)
- struct file_entry *entry;
-{
- return entry->starting_offset + N_TXTOFF (entry->header);
-}
-
-/* Read in all of the relocation information */
-
-void
-read_relocation ()
-{
- each_full_file (read_file_relocation, 0);
-}
-
-/* Read in the relocation sections of ENTRY if necessary */
-
-void
-read_file_relocation (entry)
- struct file_entry *entry;
-{
- register struct relocation_info *reloc;
- int desc;
- int read_return;
-
- desc = -1;
- if (!entry->textrel)
- {
- reloc = (struct relocation_info *) xmalloc (entry->header.a_trsize);
- desc = file_open (entry);
- lseek (desc,
- text_offset (entry) + entry->header.a_text + entry->header.a_data,
- L_SET);
- if (entry->header.a_trsize != (read_return = read (desc, reloc, entry->header.a_trsize)))
- {
- fprintf (stderr, "Return from read: %d\n", read_return);
- fatal_with_file ("premature eof in text relocation of ", entry);
- }
- entry->textrel = reloc;
- }
-
- if (!entry->datarel)
- {
- reloc = (struct relocation_info *) xmalloc (entry->header.a_drsize);
- if (desc == -1) desc = file_open (entry);
- lseek (desc,
- text_offset (entry) + entry->header.a_text
- + entry->header.a_data + entry->header.a_trsize,
- L_SET);
- if (entry->header.a_drsize != read (desc, reloc, entry->header.a_drsize))
- fatal_with_file ("premature eof in data relocation of ", entry);
- entry->datarel = reloc;
- }
-}
-
-/* Read the text segment contents of ENTRY, relocate them,
- and write the result to the output file.
- If `-r', save the text relocation for later reuse. */
-
-void
-copy_text (entry)
- struct file_entry *entry;
-{
- register char *bytes;
- register int desc;
- register struct relocation_info *reloc;
-
- if (trace_files)
- prline_file_name (entry, stderr);
-
- desc = file_open (entry);
-
- /* Allocate space for the file's text section */
-
- bytes = (char *) alloca (entry->header.a_text);
-
- /* Deal with relocation information however is appropriate */
-
- if (entry->textrel) reloc = entry->textrel;
- else if (relocatable_output)
- {
- read_file_relocation (entry);
- reloc = entry->textrel;
- }
- else
- {
- reloc = (struct relocation_info *) alloca (entry->header.a_trsize);
- lseek (desc, text_offset (entry) + entry->header.a_text + entry->header.a_data, 0);
- if (entry->header.a_trsize != read (desc, reloc, entry->header.a_trsize))
- fatal_with_file ("premature eof in text relocation of ", entry);
- }
-
- /* Read the text section into core. */
-
- lseek (desc, text_offset (entry), 0);
- if (entry->header.a_text != read (desc, bytes, entry->header.a_text))
- fatal_with_file ("premature eof in text section of ", entry);
-
-
- /* Relocate the text according to the text relocation. */
-
- perform_relocation (bytes, entry->text_start_address, entry->header.a_text,
- reloc, entry->header.a_trsize, entry);
-
- /* Write the relocated text to the output file. */
-
- mywrite (bytes, 1, entry->header.a_text, outdesc);
-}
-
-/* Relocate the data segment of each input file
- and write to the output file. */
-
-void
-write_data ()
-{
- if (trace_files)
- fprintf (stderr, "Copying and relocating data:\n\n");
-
- each_full_file (copy_data, 0);
- file_close ();
-
- /* Write out the set element vectors. See digest symbols for
- description of length of the set vector section. */
-
- if (set_vector_count)
- mywrite (set_vectors, 2 * set_symbol_count + set_vector_count,
- sizeof (unsigned long), outdesc);
-
- if (trace_files)
- fprintf (stderr, "\n");
-
- padfile (data_pad, outdesc);
-}
-
-/* Read the data segment contents of ENTRY, relocate them,
- and write the result to the output file.
- If `-r', save the data relocation for later reuse.
- See comments in `copy_text'. */
-
-void
-copy_data (entry)
- struct file_entry *entry;
-{
- register struct relocation_info *reloc;
- register char *bytes;
- register int desc;
-
- if (trace_files)
- prline_file_name (entry, stderr);
-
- desc = file_open (entry);
-
- bytes = (char *) alloca (entry->header.a_data);
-
- if (entry->datarel) reloc = entry->datarel;
- else if (relocatable_output) /* Will need this again */
- {
- read_file_relocation (entry);
- reloc = entry->datarel;
- }
- else
- {
- reloc = (struct relocation_info *) alloca (entry->header.a_drsize);
- lseek (desc, text_offset (entry) + entry->header.a_text
- + entry->header.a_data + entry->header.a_trsize,
- 0);
- if (entry->header.a_drsize != read (desc, reloc, entry->header.a_drsize))
- fatal_with_file ("premature eof in data relocation of ", entry);
- }
-
- lseek (desc, text_offset (entry) + entry->header.a_text, 0);
- if (entry->header.a_data != read (desc, bytes, entry->header.a_data))
- fatal_with_file ("premature eof in data section of ", entry);
-
- perform_relocation (bytes, entry->data_start_address - entry->header.a_text,
- entry->header.a_data, reloc, entry->header.a_drsize, entry);
-
- mywrite (bytes, 1, entry->header.a_data, outdesc);
-}
-
-/* Relocate ENTRY's text or data section contents.
- DATA is the address of the contents, in core.
- DATA_SIZE is the length of the contents.
- PC_RELOCATION is the difference between the address of the contents
- in the output file and its address in the input file.
- RELOC_INFO is the address of the relocation info, in core.
- RELOC_SIZE is its length in bytes. */
-/* This version is about to be severly hacked by Randy. Hope it
- works afterwards. */
-void
-perform_relocation (data, pc_relocation, data_size, reloc_info, reloc_size, entry)
- char *data;
- struct relocation_info *reloc_info;
- struct file_entry *entry;
- int pc_relocation;
- int data_size;
- int reloc_size;
-{
- register struct relocation_info *p = reloc_info;
- struct relocation_info *end
- = reloc_info + reloc_size / sizeof (struct relocation_info);
- int text_relocation = entry->text_start_address;
- int data_relocation = entry->data_start_address - entry->header.a_text;
- int bss_relocation
- = entry->bss_start_address - entry->header.a_text - entry->header.a_data;
-
- for (; p < end; p++)
- {
- register int relocation = 0;
- register int addr = RELOC_ADDRESS(p);
- register unsigned int mask = 0;
-
- if (addr >= data_size)
- fatal_with_file ("relocation address out of range in ", entry);
-
- if (RELOC_EXTERN_P(p))
- {
- int symindex = RELOC_SYMBOL (p) * sizeof (struct nlist);
- symbol *sp = ((symbol *)
- (((struct nlist *)
- (((char *)entry->symbols) + symindex))
- ->n_un.n_name));
-
-#ifdef N_INDR
- /* Resolve indirection */
- if ((sp->defined & ~N_EXT) == N_INDR)
- sp = (symbol *) sp->value;
-#endif
-
- if (symindex >= entry->header.a_syms)
- fatal_with_file ("relocation symbolnum out of range in ", entry);
-
- /* If the symbol is undefined, leave it at zero. */
- if (! sp->defined)
- relocation = 0;
- else
- relocation = sp->value;
- }
- else switch (RELOC_TYPE(p))
- {
- case N_TEXT:
- case N_TEXT | N_EXT:
- relocation = text_relocation;
- break;
-
- case N_DATA:
- case N_DATA | N_EXT:
- /* A word that points to beginning of the the data section
- initially contains not 0 but rather the "address" of that section
- in the input file, which is the length of the file's text. */
- relocation = data_relocation;
- break;
-
- case N_BSS:
- case N_BSS | N_EXT:
- /* Similarly, an input word pointing to the beginning of the bss
- initially contains the length of text plus data of the file. */
- relocation = bss_relocation;
- break;
-
- case N_ABS:
- case N_ABS | N_EXT:
- /* Don't know why this code would occur, but apparently it does. */
- break;
-
- default:
- fatal_with_file ("nonexternal relocation code invalid in ", entry);
- }
-
-#ifdef RELOC_ADD_EXTRA
- relocation += RELOC_ADD_EXTRA(p);
- if (relocatable_output)
- {
- /* Non-PC relative relocations which are absolute
- or which have become non-external now have fixed
- relocations. Set the ADD_EXTRA of this relocation
- to be the relocation we have now determined. */
- if (! RELOC_PCREL_P (p))
- {
- if ((int)p->r_type <= RELOC_32
- || RELOC_EXTERN_P (p) == 0)
- RELOC_ADD_EXTRA (p) = relocation;
- }
- /* External PC-relative relocations continue to move around;
- update their relocations by the amount they have moved
- so far. */
- else if (RELOC_EXTERN_P (p))
- RELOC_ADD_EXTRA (p) -= pc_relocation;
- continue;
- }
-#endif
-
- if (RELOC_PCREL_P(p))
- relocation -= pc_relocation;
-
- relocation >>= RELOC_VALUE_RIGHTSHIFT(p);
-
- /* Unshifted mask for relocation */
- mask = 1 << RELOC_TARGET_BITSIZE(p) - 1;
- mask |= mask - 1;
- relocation &= mask;
-
- /* Shift everything up to where it's going to be used */
- relocation <<= RELOC_TARGET_BITPOS(p);
- mask <<= RELOC_TARGET_BITPOS(p);
-
- switch (RELOC_TARGET_SIZE(p))
- {
- case 0:
- if (RELOC_MEMORY_SUB_P(p))
- relocation -= mask & *(char *) (data + addr);
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & *(char *) (data + addr);
- *(char *) (data + addr) &= ~mask;
- *(char *) (data + addr) |= relocation;
- break;
-
- case 1:
-#ifdef tahoe
- if (((int) data + addr & 1) == 0)
- {
-#endif
- if (RELOC_MEMORY_SUB_P(p))
- relocation -= mask & *(short *) (data + addr);
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & *(short *) (data + addr);
- *(short *) (data + addr) &= ~mask;
- *(short *) (data + addr) |= relocation;
-#ifdef tahoe
- }
- /*
- * The CCI Power 6 (aka Tahoe) architecture has byte-aligned
- * instruction operands but requires data accesses to be aligned.
- * Brain-damage...
- */
- else
- {
- unsigned char *da = (unsigned char *) (data + addr);
- unsigned short s = da[0] << 8 | da[1];
-
- if (RELOC_MEMORY_SUB_P(p))
- relocation -= mask & s;
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & s;
- s &= ~mask;
- s |= relocation;
- da[0] = s >> 8;
- da[1] = s;
- }
-#endif
- break;
-
- case 2:
-#ifndef _CROSS_TARGET_ARCH
-#ifdef tahoe
- if (((int) data + addr & 3) == 0)
- {
-#endif
- if (RELOC_MEMORY_SUB_P(p))
- relocation -= mask & *(long *) (data + addr);
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & *(long *) (data + addr);
- *(long *) (data + addr) &= ~mask;
- *(long *) (data + addr) |= relocation;
-#ifdef tahoe
- }
- else
- {
- unsigned char *da = (unsigned char *) (data + addr);
- unsigned long l = da[0] << 24 | da[1] << 16 | da[2] << 8 | da[3];
-
- if (RELOC_MEMORY_SUB_P(p))
- relocation -= mask & l;
- else if (RELOC_MEMORY_ADD_P(p))
- relocation += mask & l;
- l &= ~mask;
- l |= relocation;
- da[0] = l >> 24;
- da[1] = l >> 16;
- da[2] = l >> 8;
- da[3] = l;
- }
-#endif
-#else
- /* Handle long word alignment requirements of SPARC architecture */
- /* WARNING: This fix makes an assumption on byte ordering */
- /* Marc Ullman, Stanford University Nov. 1 1989 */
- if (RELOC_MEMORY_SUB_P(p)) {
- relocation -= mask &
- ((*(unsigned short *) (data + addr) << 16) |
- *(unsigned short *) (data + addr + 2));
- } else if (RELOC_MEMORY_ADD_P(p)) {
- relocation += mask &
- ((*(unsigned short *) (data + addr) << 16) |
- *(unsigned short *) (data + addr + 2));
- }
- *(unsigned short *) (data + addr) &= (~mask >> 16);
- *(unsigned short *) (data + addr + 2) &= (~mask & 0xffff);
- *(unsigned short *) (data + addr) |= (relocation >> 16);
- *(unsigned short *) (data + addr + 2) |= (relocation & 0xffff);
-#endif
- break;
-
- default:
- fatal_with_file ("Unimplemented relocation field length in ", entry);
- }
- }
-}
-
-/* For relocatable_output only: write out the relocation,
- relocating the addresses-to-be-relocated. */
-
-void coptxtrel (), copdatrel ();
-
-void
-write_rel ()
-{
- register int i;
- register int count = 0;
-
- if (trace_files)
- fprintf (stderr, "Writing text relocation:\n\n");
-
- /* Assign each global symbol a sequence number, giving the order
- in which `write_syms' will write it.
- This is so we can store the proper symbolnum fields
- in relocation entries we write. */
-
- for (i = 0; i < TABSIZE; i++)
- {
- symbol *sp;
- for (sp = symtab[i]; sp; sp = sp->link)
- if (sp->referenced || sp->defined)
- {
- sp->def_count = count++;
- /* Leave room for the reference required by N_INDR, if
- necessary. */
- if ((sp->defined & ~N_EXT) == N_INDR)
- count++;
- }
- }
- /* Correct, because if (relocatable_output), we will also be writing
- whatever indirect blocks we have. */
- if (count != defined_global_sym_count
- + undefined_global_sym_count + global_indirect_count)
- fatal ("internal error");
-
- /* Write out the relocations of all files, remembered from copy_text. */
-
- each_full_file (coptxtrel, 0);
-
- if (trace_files)
- fprintf (stderr, "\nWriting data relocation:\n\n");
-
- each_full_file (copdatrel, 0);
-
- if (trace_files)
- fprintf (stderr, "\n");
-}
-
-void
-coptxtrel (entry)
- struct file_entry *entry;
-{
- register struct relocation_info *p, *end;
- register int reloc = entry->text_start_address;
-
- p = entry->textrel;
- end = (struct relocation_info *) (entry->header.a_trsize + (char *) p);
- while (p < end)
- {
- RELOC_ADDRESS(p) += reloc;
- if (RELOC_EXTERN_P(p))
- {
- register int symindex = RELOC_SYMBOL(p) * sizeof (struct nlist);
- symbol *symptr = ((symbol *)
- (((struct nlist *)
- (((char *)entry->symbols) + symindex))
- ->n_un.n_name));
-
- if (symindex >= entry->header.a_syms)
- fatal_with_file ("relocation symbolnum out of range in ", entry);
-
-#ifdef N_INDR
- /* Resolve indirection. */
- if ((symptr->defined & ~N_EXT) == N_INDR)
- symptr = (symbol *) symptr->value;
-#endif
-
- /* If the symbol is now defined, change the external relocation
- to an internal one. */
-
- if (symptr->defined)
- {
- RELOC_EXTERN_P(p) = 0;
- RELOC_SYMBOL(p) = (symptr->defined & N_TYPE);
-#ifdef RELOC_ADD_EXTRA
- /* If we aren't going to be adding in the value in
- memory on the next pass of the loader, then we need
- to add it in from the relocation entry. Otherwise
- the work we did in this pass is lost. */
- if (!RELOC_MEMORY_ADD_P(p))
- RELOC_ADD_EXTRA (p) += symptr->value;
-#endif
- }
- else
- /* Debugger symbols come first, so have to start this
- after them. */
- RELOC_SYMBOL(p) = (symptr->def_count + nsyms
- - defined_global_sym_count
- - undefined_global_sym_count
- - global_indirect_count);
- }
- p++;
- }
- mywrite (entry->textrel, 1, entry->header.a_trsize, outdesc);
-}
-
-void
-copdatrel (entry)
- struct file_entry *entry;
-{
- register struct relocation_info *p, *end;
- /* Relocate the address of the relocation.
- Old address is relative to start of the input file's data section.
- New address is relative to start of the output file's data section. */
- register int reloc = entry->data_start_address - text_size;
-
- p = entry->datarel;
- end = (struct relocation_info *) (entry->header.a_drsize + (char *) p);
- while (p < end)
- {
- RELOC_ADDRESS(p) += reloc;
- if (RELOC_EXTERN_P(p))
- {
- register int symindex = RELOC_SYMBOL(p) * sizeof (struct nlist);
- symbol *symptr = ((symbol *)
- (((struct nlist *)
- (((char *)entry->symbols) + symindex))
- ->n_un.n_name));
- int symtype;
-
- if (symindex >= entry->header.a_syms)
- fatal_with_file ("relocation symbolnum out of range in ", entry);
-
-#ifdef N_INDR
- /* Resolve indirection. */
- if ((symptr->defined & ~N_EXT) == N_INDR)
- symptr = (symbol *) symptr->value;
-#endif
-
- symtype = symptr->defined & N_TYPE;
-
- if (force_common_definition
- || symtype == N_DATA || symtype == N_TEXT || symtype == N_ABS)
- {
- RELOC_EXTERN_P(p) = 0;
- RELOC_SYMBOL(p) = symtype;
- }
- else
- /* Debugger symbols come first, so have to start this
- after them. */
- RELOC_SYMBOL(p)
- = (((symbol *)
- (((struct nlist *)
- (((char *)entry->symbols) + symindex))
- ->n_un.n_name))
- ->def_count
- + nsyms - defined_global_sym_count
- - undefined_global_sym_count
- - global_indirect_count);
- }
- p++;
- }
- mywrite (entry->datarel, 1, entry->header.a_drsize, outdesc);
-}
-
-void write_file_syms ();
-void write_string_table ();
-
-/* Offsets and current lengths of symbol and string tables in output file. */
-
-int symbol_table_offset;
-int symbol_table_len;
-
-/* Address in output file where string table starts. */
-int string_table_offset;
-
-/* Offset within string table
- where the strings in `strtab_vector' should be written. */
-int string_table_len;
-
-/* Total size of string table strings allocated so far,
- including strings in `strtab_vector'. */
-int strtab_size;
-
-/* Vector whose elements are strings to be added to the string table. */
-char **strtab_vector;
-
-/* Vector whose elements are the lengths of those strings. */
-int *strtab_lens;
-
-/* Index in `strtab_vector' at which the next string will be stored. */
-int strtab_index;
-
-/* Add the string NAME to the output file string table.
- Record it in `strtab_vector' to be output later.
- Return the index within the string table that this string will have. */
-
-int
-assign_string_table_index (name)
- char *name;
-{
- register int index = strtab_size;
- register int len = strlen (name) + 1;
-
- strtab_size += len;
- strtab_vector[strtab_index] = name;
- strtab_lens[strtab_index++] = len;
-
- return index;
-}
-
-FILE *outstream = (FILE *) 0;
-
-/* Write the contents of `strtab_vector' into the string table.
- This is done once for each file's local&debugger symbols
- and once for the global symbols. */
-
-void
-write_string_table ()
-{
- register int i;
-
- lseek (outdesc, string_table_offset + string_table_len, 0);
-
- if (!outstream)
- outstream = fdopen (outdesc, "w");
-
- for (i = 0; i < strtab_index; i++)
- {
- fwrite (strtab_vector[i], 1, strtab_lens[i], outstream);
- string_table_len += strtab_lens[i];
- }
-
- fflush (outstream);
-
- /* Report I/O error such as disk full. */
- if (ferror (outstream))
- perror_name (output_filename);
-}
-
-/* Write the symbol table and string table of the output file. */
-
-void
-write_syms ()
-{
- /* Number of symbols written so far. */
- int syms_written = 0;
- register int i;
- register symbol *sp;
-
- /* Buffer big enough for all the global symbols. One
- extra struct for each indirect symbol to hold the extra reference
- following. */
- struct nlist *buf
- = (struct nlist *) alloca ((defined_global_sym_count
- + undefined_global_sym_count
- + global_indirect_count)
- * sizeof (struct nlist));
- /* Pointer for storing into BUF. */
- register struct nlist *bufp = buf;
-
- /* Size of string table includes the bytes that store the size. */
- strtab_size = sizeof strtab_size;
-
- symbol_table_offset = N_SYMOFF (outheader);
- symbol_table_len = 0;
- string_table_offset = N_STROFF (outheader);
- string_table_len = strtab_size;
-
- if (strip_symbols == STRIP_ALL)
- return;
-
- /* Write the local symbols defined by the various files. */
-
- each_file (write_file_syms, &syms_written);
- file_close ();
-
- /* Now write out the global symbols. */
-
- /* Allocate two vectors that record the data to generate the string
- table from the global symbols written so far. This must include
- extra space for the references following indirect outputs. */
-
- strtab_vector = (char **) alloca ((num_hash_tab_syms
- + global_indirect_count) * sizeof (char *));
- strtab_lens = (int *) alloca ((num_hash_tab_syms
- + global_indirect_count) * sizeof (int));
- strtab_index = 0;
-
- /* Scan the symbol hash table, bucket by bucket. */
-
- for (i = 0; i < TABSIZE; i++)
- for (sp = symtab[i]; sp; sp = sp->link)
- {
- struct nlist nl;
-
- nl.n_other = 0;
- nl.n_desc = 0;
-
- /* Compute a `struct nlist' for the symbol. */
-
- if (sp->defined || sp->referenced)
- {
- /* common condition needs to be before undefined condition */
- /* because unallocated commons are set undefined in */
- /* digest_symbols */
- if (sp->defined > 1) /* defined with known type */
- {
- /* If the target of an indirect symbol has been
- defined and we are outputting an executable,
- resolve the indirection; it's no longer needed */
- if (!relocatable_output
- && ((sp->defined & N_TYPE) == N_INDR)
- && (((symbol *) sp->value)->defined > 1))
- {
- symbol *newsp = (symbol *) sp->value;
- nl.n_type = newsp->defined;
- nl.n_value = newsp->value;
- }
- else
- {
- nl.n_type = sp->defined;
- if (sp->defined != (N_INDR | N_EXT))
- nl.n_value = sp->value;
- else
- nl.n_value = 0;
- }
- }
- else if (sp->max_common_size) /* defined as common but not allocated. */
- {
- /* happens only with -r and not -d */
- /* write out a common definition */
- nl.n_type = N_UNDF | N_EXT;
- nl.n_value = sp->max_common_size;
- }
- else if (!sp->defined) /* undefined -- legit only if -r */
- {
- nl.n_type = N_UNDF | N_EXT;
- nl.n_value = 0;
- }
- else
- fatal ("internal error: %s defined in mysterious way", sp->name);
-
- /* Allocate string table space for the symbol name. */
-
- nl.n_un.n_strx = assign_string_table_index (sp->name);
-
- /* Output to the buffer and count it. */
-
- *bufp++ = nl;
- syms_written++;
- if (nl.n_type == (N_INDR | N_EXT))
- {
- struct nlist xtra_ref;
- xtra_ref.n_type = N_EXT | N_UNDF;
- xtra_ref.n_un.n_strx
- = assign_string_table_index (((symbol *) sp->value)->name);
- xtra_ref.n_other = 0;
- xtra_ref.n_desc = 0;
- xtra_ref.n_value = 0;
- *bufp++ = xtra_ref;
- syms_written++;
- }
- }
- }
-
- /* Output the buffer full of `struct nlist's. */
-
- lseek (outdesc, symbol_table_offset + symbol_table_len, 0);
- mywrite (buf, sizeof (struct nlist), bufp - buf, outdesc);
- symbol_table_len += sizeof (struct nlist) * (bufp - buf);
-
- if (syms_written != nsyms)
- fatal ("internal error: wrong number of symbols written into output file", 0);
-
- if (symbol_table_offset + symbol_table_len != string_table_offset)
- fatal ("internal error: inconsistent symbol table length", 0);
-
- /* Now the total string table size is known, so write it.
- We are already positioned at the right place in the file. */
-
- mywrite (&strtab_size, sizeof (int), 1, outdesc); /* we're at right place */
-
- /* Write the strings for the global symbols. */
-
- write_string_table ();
-}
-
-/* Write the local and debugger symbols of file ENTRY.
- Increment *SYMS_WRITTEN_ADDR for each symbol that is written. */
-
-/* Note that we do not combine identical names of local symbols.
- dbx or gdb would be confused if we did that. */
-
-void
-write_file_syms (entry, syms_written_addr)
- struct file_entry *entry;
- int *syms_written_addr;
-{
- register struct nlist *p = entry->symbols;
- register struct nlist *end = p + entry->header.a_syms / sizeof (struct nlist);
-
- /* Buffer to accumulate all the syms before writing them.
- It has one extra slot for the local symbol we generate here. */
- struct nlist *buf
- = (struct nlist *) alloca (entry->header.a_syms + sizeof (struct nlist));
- register struct nlist *bufp = buf;
-
- /* Upper bound on number of syms to be written here. */
- int max_syms = (entry->header.a_syms / sizeof (struct nlist)) + 1;
-
- /* Make tables that record, for each symbol, its name and its name's length.
- The elements are filled in by `assign_string_table_index'. */
-
- strtab_vector = (char **) alloca (max_syms * sizeof (char *));
- strtab_lens = (int *) alloca (max_syms * sizeof (int));
- strtab_index = 0;
-
- /* Generate a local symbol for the start of this file's text. */
-
- if (discard_locals != DISCARD_ALL)
- {
- struct nlist nl;
-
- nl.n_type = N_FN | N_EXT;
- nl.n_un.n_strx = assign_string_table_index (entry->local_sym_name);
- nl.n_value = entry->text_start_address;
- nl.n_desc = 0;
- nl.n_other = 0;
- *bufp++ = nl;
- (*syms_written_addr)++;
- entry->local_syms_offset = *syms_written_addr * sizeof (struct nlist);
- }
-
- /* Read the file's string table. */
-
- entry->strings = (char *) alloca (entry->string_size);
- read_entry_strings (file_open (entry), entry);
-
- for (; p < end; p++)
- {
- register int type = p->n_type;
- register int write = 0;
-
- /* WRITE gets 1 for a non-global symbol that should be written. */
-
-
- if (SET_ELEMENT_P (type)) /* This occurs even if global. These */
- /* types of symbols are never written */
- /* globally, though they are stored */
- /* globally. */
- write = relocatable_output;
- else if (!(type & (N_STAB | N_EXT)))
- /* ordinary local symbol */
- write = ((discard_locals != DISCARD_ALL)
- && !(discard_locals == DISCARD_L &&
- (p->n_un.n_strx + entry->strings)[0] == LPREFIX)
- && type != N_WARNING);
- else if (!(type & N_EXT))
- /* debugger symbol */
- write = (strip_symbols == STRIP_NONE);
-
- if (write)
- {
- /* If this symbol has a name,
- allocate space for it in the output string table. */
-
- if (p->n_un.n_strx)
- p->n_un.n_strx = assign_string_table_index (p->n_un.n_strx
- + entry->strings);
-
- /* Output this symbol to the buffer and count it. */
-
- *bufp++ = *p;
- (*syms_written_addr)++;
- }
- }
-
- /* All the symbols are now in BUF; write them. */
-
- lseek (outdesc, symbol_table_offset + symbol_table_len, 0);
- mywrite (buf, sizeof (struct nlist), bufp - buf, outdesc);
- symbol_table_len += sizeof (struct nlist) * (bufp - buf);
-
- /* Write the string-table data for the symbols just written,
- using the data in vectors `strtab_vector' and `strtab_lens'. */
-
- write_string_table ();
- entry->strings = 0; /* Since it will dissapear anyway. */
-}
-
-/* Copy any GDB symbol segments from the input files to the output file.
- The contents of the symbol segment is copied without change
- except that we store some information into the beginning of it. */
-
-void write_file_symseg ();
-
-void
-write_symsegs ()
-{
- each_file (write_file_symseg, 0);
-}
-
-void
-write_file_symseg (entry)
- struct file_entry *entry;
-{
- char buffer[4096];
- struct symbol_root root;
- int indesc;
- int len;
-
- if (entry->symseg_offset == 0)
- return;
-
- /* This entry has a symbol segment. Read the root of the segment. */
-
- indesc = file_open (entry);
- lseek (indesc, entry->symseg_offset + entry->starting_offset, 0);
- if (sizeof root != read (indesc, &root, sizeof root))
- fatal_with_file ("premature end of file in symbol segment of ", entry);
-
- /* Store some relocation info into the root. */
-
- root.ldsymoff = entry->local_syms_offset;
- root.textrel = entry->text_start_address;
- root.datarel = entry->data_start_address - entry->header.a_text;
- root.bssrel = entry->bss_start_address
- - entry->header.a_text - entry->header.a_data;
- root.databeg = entry->data_start_address - root.datarel;
- root.bssbeg = entry->bss_start_address - root.bssrel;
-
- /* Write the modified root into the output file. */
-
- mywrite (&root, sizeof root, 1, outdesc);
-
- /* Copy the rest of the symbol segment unchanged. */
-
- if (entry->superfile)
- {
- /* Library member: number of bytes to copy is determined
- from the member's total size. */
-
- int total = entry->total_size - entry->symseg_offset - sizeof root;
-
- while (total > 0)
- {
- len = read (indesc, buffer, min (sizeof buffer, total));
-
- if (len != min (sizeof buffer, total))
- fatal_with_file ("premature end of file in symbol segment of ", entry);
- total -= len;
- mywrite (buffer, len, 1, outdesc);
- }
- }
- else
- {
- /* A separate file: copy until end of file. */
-
- while (len = read (indesc, buffer, sizeof buffer))
- {
- mywrite (buffer, len, 1, outdesc);
- if (len < sizeof buffer)
- break;
- }
- }
-
- file_close ();
-}
-
-/* Create the symbol table entries for `etext', `edata' and `end'. */
-
-void
-symtab_init ()
-{
-#ifndef nounderscore
- edata_symbol = getsym ("_edata");
- etext_symbol = getsym ("_etext");
- end_symbol = getsym ("_end");
-#else
- edata_symbol = getsym ("edata");
- etext_symbol = getsym ("etext");
- end_symbol = getsym ("end");
-#endif
-
-#ifdef sun
- {
- symbol *dynamic_symbol = getsym ("__DYNAMIC");
- dynamic_symbol->defined = N_ABS | N_EXT;
- dynamic_symbol->referenced = 1;
- dynamic_symbol->value = 0;
- }
-#endif
-
-#ifdef sequent
- {
- symbol *_387_flt_symbol = getsym ("_387_flt");
- _387_flt_symbol->defined = N_ABS | N_EXT;
- _387_flt_symbol->referenced = 1;
- _387_flt_symbol->value = 0;
- }
-#endif
-
- edata_symbol->defined = N_DATA | N_EXT;
- etext_symbol->defined = N_TEXT | N_EXT;
- end_symbol->defined = N_BSS | N_EXT;
-
- edata_symbol->referenced = 1;
- etext_symbol->referenced = 1;
- end_symbol->referenced = 1;
-}
-
-/* Compute the hash code for symbol name KEY. */
-
-int
-hash_string (key)
- char *key;
-{
- register char *cp;
- register int k;
-
- cp = key;
- k = 0;
- while (*cp)
- k = (((k << 1) + (k >> 14)) ^ (*cp++)) & 0x3fff;
-
- return k;
-}
-
-/* Get the symbol table entry for the global symbol named KEY.
- Create one if there is none. */
-
-symbol *
-getsym (key)
- char *key;
-{
- register int hashval;
- register symbol *bp;
-
- /* Determine the proper bucket. */
-
- hashval = hash_string (key) % TABSIZE;
-
- /* Search the bucket. */
-
- for (bp = symtab[hashval]; bp; bp = bp->link)
- if (! strcmp (key, bp->name))
- return bp;
-
- /* Nothing was found; create a new symbol table entry. */
-
- bp = (symbol *) xmalloc (sizeof (symbol));
- bp->refs = 0;
- bp->name = (char *) xmalloc (strlen (key) + 1);
- strcpy (bp->name, key);
- bp->defined = 0;
- bp->referenced = 0;
- bp->trace = 0;
- bp->value = 0;
- bp->max_common_size = 0;
- bp->warning = 0;
- bp->undef_refs = 0;
- bp->multiply_defined = 0;
-
- /* Add the entry to the bucket. */
-
- bp->link = symtab[hashval];
- symtab[hashval] = bp;
-
- ++num_hash_tab_syms;
-
- return bp;
-}
-
-/* Like `getsym' but return 0 if the symbol is not already known. */
-
-symbol *
-getsym_soft (key)
- char *key;
-{
- register int hashval;
- register symbol *bp;
-
- /* Determine which bucket. */
-
- hashval = hash_string (key) % TABSIZE;
-
- /* Search the bucket. */
-
- for (bp = symtab[hashval]; bp; bp = bp->link)
- if (! strcmp (key, bp->name))
- return bp;
-
- return 0;
-}
-
-/* Report a fatal error.
- STRING is a printf format string and ARG is one arg for it. */
-
-void
-fatal (string, arg)
- char *string, *arg;
-{
- fprintf (stderr, "ld: ");
- fprintf (stderr, string, arg);
- fprintf (stderr, "\n");
- exit (1);
-}
-
-/* Report a fatal error. The error message is STRING
- followed by the filename of ENTRY. */
-
-void
-fatal_with_file (string, entry)
- char *string;
- struct file_entry *entry;
-{
- fprintf (stderr, "ld: ");
- fprintf (stderr, string);
- print_file_name (entry, stderr);
- fprintf (stderr, "\n");
- exit (1);
-}
-
-/* Report a fatal error using the message for the last failed system call,
- followed by the string NAME. */
-
-void
-perror_name (name)
- char *name;
-{
- extern int errno;
- char *s;
-
- if (errno < sys_nerr)
- s = concat ("", sys_errlist[errno], " for %s");
- else
- s = "cannot open %s";
- fatal (s, name);
-}
-
-/* Report a fatal error using the message for the last failed system call,
- followed by the name of file ENTRY. */
-
-void
-perror_file (entry)
- struct file_entry *entry;
-{
- extern int errno;
- char *s;
-
- if (errno < sys_nerr)
- s = concat ("", sys_errlist[errno], " for ");
- else
- s = "cannot open ";
- fatal_with_file (s, entry);
-}
-
-/* Report a nonfatal error.
- STRING is a format for printf, and ARG1 ... ARG3 are args for it. */
-
-void
-error (string, arg1, arg2, arg3)
- char *string, *arg1, *arg2, *arg3;
-{
- fprintf (stderr, "%s: ", progname);
- fprintf (stderr, string, arg1, arg2, arg3);
- fprintf (stderr, "\n");
-}
-
-
-/* Output COUNT*ELTSIZE bytes of data at BUF
- to the descriptor DESC. */
-
-void
-mywrite (buf, count, eltsize, desc)
- char *buf;
- int count;
- int eltsize;
- int desc;
-{
- register int val;
- register int bytes = count * eltsize;
-
- while (bytes > 0)
- {
- val = write (desc, buf, bytes);
- if (val <= 0)
- perror_name (output_filename);
- buf += val;
- bytes -= val;
- }
-}
-
-/* Output PADDING zero-bytes to descriptor OUTDESC.
- PADDING may be negative; in that case, do nothing. */
-
-void
-padfile (padding, outdesc)
- int padding;
- int outdesc;
-{
- register char *buf;
- if (padding <= 0)
- return;
-
- buf = (char *) alloca (padding);
- bzero (buf, padding);
- mywrite (buf, padding, 1, outdesc);
-}
-
-/* Return a newly-allocated string
- whose contents concatenate the strings S1, S2, S3. */
-
-char *
-concat (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- register int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
- register char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
-
- strcpy (result, s1);
- strcpy (result + len1, s2);
- strcpy (result + len1 + len2, s3);
- result[len1 + len2 + len3] = 0;
-
- return result;
-}
-
-/* Parse the string ARG using scanf format FORMAT, and return the result.
- If it does not parse, report fatal error
- generating the error message using format string ERROR and ARG as arg. */
-
-int
-parse (arg, format, error)
- char *arg, *format;
-{
- int x;
- if (1 != sscanf (arg, format, &x))
- fatal (error, arg);
- return x;
-}
-
-/* Like malloc but get fatal error if memory is exhausted. */
-
-int
-xmalloc (size)
- int size;
-{
- register int result = malloc (size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
-}
-
-/* Like realloc but get fatal error if memory is exhausted. */
-
-int
-xrealloc (ptr, size)
- char *ptr;
- int size;
-{
- register int result = realloc (ptr, size);
- if (!result)
- fatal ("virtual memory exhausted", 0);
- return result;
-}
-
-#ifdef USG
-
-void
-bzero (p, n)
- char *p;
-{
- memset (p, 0, n);
-}
-
-void
-bcopy (from, to, n)
- char *from, *to;
-{
- memcpy (to, from, n);
-}
-
-getpagesize ()
-{
- return (4096);
-}
-
-#endif
-
-#if defined(sun) && (TARGET == SUN4)
-
-/* Don't use local pagesize to build for Sparc. */
-
-getpagesize ()
-{
- return (8192);
-}
-#endif
diff --git a/usr.bin/ld/symseg.h b/usr.bin/ld/symseg.h
deleted file mode 100644
index 978d8be..0000000
--- a/usr.bin/ld/symseg.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*-
- *
- * This code is derived from software copyrighted by the Free Software
- * Foundation.
- *
- * @(#)symseg.h 8.1 (Berkeley) 6/6/93
- */
-
-/* GDB symbol table format definitions.
- Copyright (C) 1987, 1988 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Format of GDB symbol table data.
- There is one symbol segment for each source file or
- independant compilation. These segments are simply concatenated
- to form the GDB symbol table. A zero word where the beginning
- of a segment is expected indicates there are no more segments.
-
-Format of a symbol segment:
-
- The symbol segment begins with a word containing 1
- if it is in the format described here. Other formats may
- be designed, with other code numbers.
-
- The segment contains many objects which point at each other.
- The pointers are offsets in bytes from the beginning of the segment.
- Thus, each segment can be loaded into core and its pointers relocated
- to make valid in-core pointers.
-
- All the data objects in the segment can be found indirectly from
- one of them, the root object, of type `struct symbol_root'.
- It appears at the beginning of the segment.
-
- The total size of the segment, in bytes, appears as the `length'
- field of this object. This size includes the size of the
- root object.
-
- All the object data types are defined here to contain pointer types
- appropriate for in-core use on a relocated symbol segment.
- Casts to and from type int are required for working with
- unrelocated symbol segments such as are found in the file.
-
- The ldsymaddr word is filled in by the loader to contain
- the offset (in bytes) within the ld symbol table
- of the first nonglobal symbol from this compilation.
- This makes it possible to match those symbols
- (which contain line number information) reliably with
- the segment they go with.
-
- Core addresses within the program that appear in the symbol segment
- are not relocated by the loader. They are inserted by the assembler
- and apply to addresses as output by the assembler, so GDB must
- relocate them when it loads the symbol segment. It gets the information
- on how to relocate from the textrel, datarel, bssrel, databeg and bssbeg
- words of the root object.
-
- The words textrel, datarel and bssrel
- are filled in by ld with the amounts to relocate within-the-file
- text, data and bss addresses by; databeg and bssbeg can be
- used to tell which kind of relocation an address needs. */
-
-enum language {language_c};
-
-struct symbol_root
-{
- int format; /* Data format version */
- int length; /* # bytes in this symbol segment */
- int ldsymoff; /* Offset in ld symtab of this file's syms */
- int textrel; /* Relocation for text addresses */
- int datarel; /* Relocation for data addresses */
- int bssrel; /* Relocation for bss addresses */
- char *filename; /* Name of main source file compiled */
- char *filedir; /* Name of directory it was reached from */
- struct blockvector *blockvector; /* Vector of all symbol-naming blocks */
- struct typevector *typevector; /* Vector of all data types */
- enum language language; /* Code identifying the language used */
- char *version; /* Version info. Not fully specified */
- char *compilation; /* Compilation info. Not fully specified */
- int databeg; /* Address within the file of data start */
- int bssbeg; /* Address within the file of bss start */
- struct sourcevector *sourcevector; /* Vector of line-number info */
-};
-
-/* All data types of symbols in the compiled program
- are represented by `struct type' objects.
- All of these objects are pointed to by the typevector.
- The type vector may have empty slots that contain zero. */
-
-struct typevector
-{
- int length; /* Number of types described */
- struct type *type[1];
-};
-
-/* Different kinds of data types are distinguished by the `code' field. */
-
-enum type_code
-{
- TYPE_CODE_UNDEF, /* Not used; catches errors */
- TYPE_CODE_PTR, /* Pointer type */
- TYPE_CODE_ARRAY, /* Array type, lower bound zero */
- TYPE_CODE_STRUCT, /* C struct or Pascal record */
- TYPE_CODE_UNION, /* C union or Pascal variant part */
- TYPE_CODE_ENUM, /* Enumeration type */
- TYPE_CODE_FUNC, /* Function type */
- TYPE_CODE_INT, /* Integer type */
- TYPE_CODE_FLT, /* Floating type */
- TYPE_CODE_VOID, /* Void type (values zero length) */
- TYPE_CODE_SET, /* Pascal sets */
- TYPE_CODE_RANGE, /* Range (integers within spec'd bounds) */
- TYPE_CODE_PASCAL_ARRAY, /* Array with explicit type of index */
-};
-
-/* This appears in a type's flags word for an unsigned integer type. */
-#define TYPE_FLAG_UNSIGNED 1
-
-/* Other flag bits are used with GDB. */
-
-struct type
-{
- /* Code for kind of type */
- enum type_code code;
- /* Name of this type, or zero if none.
- This is used for printing only.
- Type names specified as input are defined by symbols. */
- char *name;
- /* Length in bytes of storage for a value of this type */
- int length;
- /* For a pointer type, describes the type of object pointed to.
- For an array type, describes the type of the elements.
- For a function type, describes the type of the value.
- Unused otherwise. */
- struct type *target_type;
- /* Type that is a pointer to this type.
- Zero if no such pointer-to type is known yet.
- The debugger may add the address of such a type
- if it has to construct one later. */
- struct type *pointer_type;
- /* Type that is a function returning this type.
- Zero if no such function type is known here.
- The debugger may add the address of such a type
- if it has to construct one later. */
- struct type *function_type;
- /* Flags about this type. */
- short flags;
- /* Number of fields described for this type */
- short nfields;
- /* For structure and union types, a description of each field.
- For set and pascal array types, there is one "field",
- whose type is the domain type of the set or array.
- For range types, there are two "fields",
- the minimum and maximum values (both inclusive).
- For enum types, each possible value is described by one "field".
- For range types, there are two "fields", that record constant values
- (inclusive) for the minimum and maximum.
-
- Using a pointer to a separate array of fields
- allows all types to have the same size, which is useful
- because we can allocate the space for a type before
- we know what to put in it. */
- struct field
- {
- /* Position of this field, counting in bits from start of
- containing structure. For a function type, this is the
- position in the argument list of this argument.
- For a range bound or enum value, this is the value itself. */
- int bitpos;
- /* Size of this field, in bits, or zero if not packed.
- For an unpacked field, the field's type's length
- says how many bytes the field occupies. */
- int bitsize;
- /* In a struct or enum type, type of this field.
- In a function type, type of this argument.
- In an array type, the domain-type of the array. */
- struct type *type;
- /* Name of field, value or argument.
- Zero for range bounds and array domains. */
- char *name;
- } *fields;
-};
-
-/* All of the name-scope contours of the program
- are represented by `struct block' objects.
- All of these objects are pointed to by the blockvector.
-
- Each block represents one name scope.
- Each lexical context has its own block.
-
- The first two blocks in the blockvector are special.
- The first one contains all the symbols defined in this compilation
- whose scope is the entire program linked together.
- The second one contains all the symbols whose scope is the
- entire compilation excluding other separate compilations.
- In C, these correspond to global symbols and static symbols.
-
- Each block records a range of core addresses for the code that
- is in the scope of the block. The first two special blocks
- give, for the range of code, the entire range of code produced
- by the compilation that the symbol segment belongs to.
-
- The blocks appear in the blockvector
- in order of increasing starting-address,
- and, within that, in order of decreasing ending-address.
-
- This implies that within the body of one function
- the blocks appear in the order of a depth-first tree walk. */
-
-struct blockvector
-{
- /* Number of blocks in the list. */
- int nblocks;
- /* The blocks themselves. */
- struct block *block[1];
-};
-
-struct block
-{
- /* Addresses in the executable code that are in this block.
- Note: in an unrelocated symbol segment in a file,
- these are always zero. They can be filled in from the
- N_LBRAC and N_RBRAC symbols in the loader symbol table. */
- int startaddr, endaddr;
- /* The symbol that names this block,
- if the block is the body of a function;
- otherwise, zero.
- Note: In an unrelocated symbol segment in an object file,
- this field may be zero even when the block has a name.
- That is because the block is output before the name
- (since the name resides in a higher block).
- Since the symbol does point to the block (as its value),
- it is possible to find the block and set its name properly. */
- struct symbol *function;
- /* The `struct block' for the containing block, or 0 if none. */
- /* Note that in an unrelocated symbol segment in an object file
- this pointer may be zero when the correct value should be
- the second special block (for symbols whose scope is one compilation).
- This is because the compiler ouptuts the special blocks at the
- very end, after the other blocks. */
- struct block *superblock;
- /* Number of local symbols. */
- int nsyms;
- /* The symbols. */
- struct symbol *sym[1];
-};
-
-/* Represent one symbol name; a variable, constant, function or typedef. */
-
-/* Different name spaces for symbols. Looking up a symbol specifies
- a namespace and ignores symbol definitions in other name spaces.
-
- VAR_NAMESPACE is the usual namespace.
- In C, this contains variables, function names, typedef names
- and enum type values.
-
- STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
- Thus, if `struct foo' is used in a C program,
- it produces a symbol named `foo' in the STRUCT_NAMESPACE.
-
- LABEL_NAMESPACE may be used for names of labels (for gotos);
- currently it is not used and labels are not recorded at all. */
-
-/* For a non-global symbol allocated statically,
- the correct core address cannot be determined by the compiler.
- The compiler puts an index number into the symbol's value field.
- This index number can be matched with the "desc" field of
- an entry in the loader symbol table. */
-
-enum namespace
-{
- UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE,
-};
-
-/* An address-class says where to find the value of the symbol in core. */
-
-enum address_class
-{
- LOC_UNDEF, /* Not used; catches errors */
- LOC_CONST, /* Value is constant int */
- LOC_STATIC, /* Value is at fixed address */
- LOC_REGISTER, /* Value is in register */
- LOC_ARG, /* Value is at spec'd position in arglist */
- LOC_LOCAL, /* Value is at spec'd pos in stack frame */
- LOC_TYPEDEF, /* Value not used; definition in SYMBOL_TYPE
- Symbols in the namespace STRUCT_NAMESPACE
- all have this class. */
- LOC_LABEL, /* Value is address in the code */
- LOC_BLOCK, /* Value is address of a `struct block'.
- Function names have this class. */
- LOC_EXTERNAL, /* Value is at address not in this compilation.
- This is used for .comm symbols
- and for extern symbols within functions.
- Inside GDB, this is changed to LOC_STATIC once the
- real address is obtained from a loader symbol. */
- LOC_CONST_BYTES /* Value is a constant byte-sequence. */
-};
-
-struct symbol
-{
- /* Symbol name */
- char *name;
- /* Name space code. */
- enum namespace namespace;
- /* Address class */
- enum address_class class;
- /* Data type of value */
- struct type *type;
- /* constant value, or address if static, or register number,
- or offset in arguments, or offset in stack frame. */
- union
- {
- long value;
- struct block *block; /* for LOC_BLOCK */
- char *bytes; /* for LOC_CONST_BYTES */
- }
- value;
-};
-
-/* Source-file information.
- This describes the relation between source files and line numbers
- and addresses in the program text. */
-
-struct sourcevector
-{
- int length; /* Number of source files described */
- struct source *source[1]; /* Descriptions of the files */
-};
-
-/* Line number and address of one line. */
-
-struct line
-{
- int linenum;
- int address;
-};
-
-/* All the information on one source file. */
-
-struct source
-{
- char *name; /* Name of file */
- int nlines; /* Number of lines that follow */
- struct line lines[1]; /* Information on each line */
-};
diff --git a/usr.bin/m4/serv.c b/usr.bin/m4/serv.c
deleted file mode 100644
index 54a2e59..0000000
--- a/usr.bin/m4/serv.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright (c) 1989
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * This code is derived from software contributed to Berkeley by
- * Ozan Yigit.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)serv.c 5.4 (Berkeley) 1/21/94";
-#endif /* not lint */
-
-/*
- * serv.c
- * Facility: m4 macro processor
- * by: oz
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "mdef.h"
-#include "extr.h"
-#include "pathnames.h"
-
-extern ndptr lookup();
-extern ndptr addent();
-
-char *dumpfmt = "`%s'\t`%s'\n"; /* format string for dumpdef */
-
-/*
- * expand - user-defined macro expansion
- *
- */
-expand(argv, argc)
-register char *argv[];
-register int argc;
-{
- register char *t;
- register char *p;
- register int n;
- register int argno;
-
- t = argv[0]; /* defn string as a whole */
- p = t;
- while (*p)
- p++;
- p--; /* last character of defn */
- while (p > t) {
- if (*(p-1) != ARGFLAG)
- putback(*p);
- else {
- switch (*p) {
-
- case '#':
- pbnum(argc-2);
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if ((argno = *p - '0') < argc-1)
- pbstr(argv[argno+1]);
- break;
- case '*':
- for (n = argc - 1; n > 2; n--) {
- pbstr(argv[n]);
- putback(',');
- }
- pbstr(argv[2]);
- break;
- default :
- putback(*p);
- break;
- }
- p--;
- }
- p--;
- }
- if (p == t) /* do last character */
- putback(*p);
-}
-
-/*
- * dodefine - install definition in the table
- *
- */
-dodefine(name, defn)
-register char *name;
-register char *defn;
-{
- register ndptr p;
-
- if (!*name)
- error("m4: null definition.");
- if (strcmp(name, defn) == 0)
- error("m4: recursive definition.");
- if ((p = lookup(name)) == nil)
- p = addent(name);
- else if (p->defn != null)
- free(p->defn);
- if (!*defn)
- p->defn = null;
- else
- p->defn = strdup(defn);
- p->type = MACRTYPE;
-}
-
-/*
- * dodefn - push back a quoted definition of
- * the given name.
- */
-
-dodefn(name)
-char *name;
-{
- register ndptr p;
-
- if ((p = lookup(name)) != nil && p->defn != null) {
- putback(rquote);
- pbstr(p->defn);
- putback(lquote);
- }
-}
-
-/*
- * dopushdef - install a definition in the hash table
- * without removing a previous definition. Since
- * each new entry is entered in *front* of the
- * hash bucket, it hides a previous definition from
- * lookup.
- */
-dopushdef(name, defn)
-register char *name;
-register char *defn;
-{
- register ndptr p;
-
- if (!*name)
- error("m4: null definition");
- if (strcmp(name, defn) == 0)
- error("m4: recursive definition.");
- p = addent(name);
- if (!*defn)
- p->defn = null;
- else
- p->defn = strdup(defn);
- p->type = MACRTYPE;
-}
-
-/*
- * dodumpdef - dump the specified definitions in the hash
- * table to stderr. If nothing is specified, the entire
- * hash table is dumped.
- *
- */
-dodump(argv, argc)
-register char *argv[];
-register int argc;
-{
- register int n;
- ndptr p;
-
- if (argc > 2) {
- for (n = 2; n < argc; n++)
- if ((p = lookup(argv[n])) != nil)
- fprintf(stderr, dumpfmt, p->name,
- p->defn);
- }
- else {
- for (n = 0; n < HASHSIZE; n++)
- for (p = hashtab[n]; p != nil; p = p->nxtptr)
- fprintf(stderr, dumpfmt, p->name,
- p->defn);
- }
-}
-
-/*
- * doifelse - select one of two alternatives - loop.
- *
- */
-doifelse(argv,argc)
-register char *argv[];
-register int argc;
-{
- cycle {
- if (strcmp(argv[2], argv[3]) == 0)
- pbstr(argv[4]);
- else if (argc == 6)
- pbstr(argv[5]);
- else if (argc > 6) {
- argv += 3;
- argc -= 3;
- continue;
- }
- break;
- }
-}
-
-/*
- * doinclude - include a given file.
- *
- */
-doincl(ifile)
-char *ifile;
-{
- if (ilevel+1 == MAXINP)
- error("m4: too many include files.");
- if ((infile[ilevel+1] = fopen(ifile, "r")) != NULL) {
- ilevel++;
- return (1);
- }
- else
- return (0);
-}
-
-#ifdef EXTENDED
-/*
- * dopaste - include a given file without any
- * macro processing.
- */
-dopaste(pfile)
-char *pfile;
-{
- FILE *pf;
- register int c;
-
- if ((pf = fopen(pfile, "r")) != NULL) {
- while((c = getc(pf)) != EOF)
- putc(c, active);
- (void) fclose(pf);
- return(1);
- }
- else
- return(0);
-}
-#endif
-
-/*
- * dochq - change quote characters
- *
- */
-dochq(argv, argc)
-register char *argv[];
-register int argc;
-{
- if (argc > 2) {
- if (*argv[2])
- lquote = *argv[2];
- if (argc > 3) {
- if (*argv[3])
- rquote = *argv[3];
- }
- else
- rquote = lquote;
- }
- else {
- lquote = LQUOTE;
- rquote = RQUOTE;
- }
-}
-
-/*
- * dochc - change comment characters
- *
- */
-dochc(argv, argc)
-register char *argv[];
-register int argc;
-{
- if (argc > 2) {
- if (*argv[2])
- scommt = *argv[2];
- if (argc > 3) {
- if (*argv[3])
- ecommt = *argv[3];
- }
- else
- ecommt = ECOMMT;
- }
- else {
- scommt = SCOMMT;
- ecommt = ECOMMT;
- }
-}
-
-/*
- * dodivert - divert the output to a temporary file
- *
- */
-dodiv(n)
-register int n;
-{
- if (n < 0 || n >= MAXOUT)
- n = 0; /* bitbucket */
- if (outfile[n] == NULL) {
- m4temp[UNIQUE] = n + '0';
- if ((outfile[n] = fopen(m4temp, "w")) == NULL)
- error("m4: cannot divert.");
- }
- oindex = n;
- active = outfile[n];
-}
-
-/*
- * doundivert - undivert a specified output, or all
- * other outputs, in numerical order.
- */
-doundiv(argv, argc)
-register char *argv[];
-register int argc;
-{
- register int ind;
- register int n;
-
- if (argc > 2) {
- for (ind = 2; ind < argc; ind++) {
- n = atoi(argv[ind]);
- if (n > 0 && n < MAXOUT && outfile[n] != NULL)
- getdiv(n);
-
- }
- }
- else
- for (n = 1; n < MAXOUT; n++)
- if (outfile[n] != NULL)
- getdiv(n);
-}
-
-/*
- * dosub - select substring
- *
- */
-dosub (argv, argc)
-register char *argv[];
-register int argc;
-{
- register char *ap, *fc, *k;
- register int nc;
-
- if (argc < 5)
- nc = MAXTOK;
- else
-#ifdef EXPR
- nc = expr(argv[4]);
-#else
- nc = atoi(argv[4]);
-#endif
- ap = argv[2]; /* target string */
-#ifdef EXPR
- fc = ap + expr(argv[3]); /* first char */
-#else
- fc = ap + atoi(argv[3]); /* first char */
-#endif
- if (fc >= ap && fc < ap+strlen(ap))
- for (k = fc+min(nc,strlen(fc))-1; k >= fc; k--)
- putback(*k);
-}
-
-/*
- * map:
- * map every character of s1 that is specified in from
- * into s3 and replace in s. (source s1 remains untouched)
- *
- * This is a standard implementation of map(s,from,to) function of ICON
- * language. Within mapvec, we replace every character of "from" with
- * the corresponding character in "to". If "to" is shorter than "from",
- * than the corresponding entries are null, which means that those
- * characters dissapear altogether. Furthermore, imagine
- * map(dest, "sourcestring", "srtin", "rn..*") type call. In this case,
- * `s' maps to `r', `r' maps to `n' and `n' maps to `*'. Thus, `s'
- * ultimately maps to `*'. In order to achieve this effect in an efficient
- * manner (i.e. without multiple passes over the destination string), we
- * loop over mapvec, starting with the initial source character. if the
- * character value (dch) in this location is different than the source
- * character (sch), sch becomes dch, once again to index into mapvec, until
- * the character value stabilizes (i.e. sch = dch, in other words
- * mapvec[n] == n). Even if the entry in the mapvec is null for an ordinary
- * character, it will stabilize, since mapvec[0] == 0 at all times. At the
- * end, we restore mapvec* back to normal where mapvec[n] == n for
- * 0 <= n <= 127. This strategy, along with the restoration of mapvec, is
- * about 5 times faster than any algorithm that makes multiple passes over
- * destination string.
- *
- */
-
-map(dest,src,from,to)
-register char *dest;
-register char *src;
-register char *from;
-register char *to;
-{
- register char *tmp;
- register char sch, dch;
- static char mapvec[128] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
- 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127
- };
-
- if (*src) {
- tmp = from;
- /*
- * create a mapping between "from" and "to"
- */
- while (*from)
- mapvec[*from++] = (*to) ? *to++ : (char) 0;
-
- while (*src) {
- sch = *src++;
- dch = mapvec[sch];
- while (dch != sch) {
- sch = dch;
- dch = mapvec[sch];
- }
- if (*dest = dch)
- dest++;
- }
- /*
- * restore all the changed characters
- */
- while (*tmp) {
- mapvec[*tmp] = *tmp;
- tmp++;
- }
- }
- *dest = (char) 0;
-}
diff --git a/usr.bin/man/Makefile b/usr.bin/man/Makefile
deleted file mode 100644
index 728d038..0000000
--- a/usr.bin/man/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= man
-SRCS= config.c man.c
-MAN1= man.0
-MAN5= man.conf.0
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/man/config.c b/usr.bin/man/config.c
deleted file mode 100644
index 1d875b5..0000000
--- a/usr.bin/man/config.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)config.c 8.7 (Berkeley) 1/3/94";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/queue.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "pathnames.h"
-
-struct _head head;
-
-/*
- * config --
- *
- * Read the configuration file and build a doubly linked
- * list that looks like:
- *
- * tag1 <-> record <-> record <-> record
- * |
- * tag2 <-> record <-> record <-> record
- */
-void
-config(fname)
- char *fname;
-{
- TAG *tp;
- ENTRY *ep;
- FILE *cfp;
- size_t len;
- int lcnt;
- char *p, *t;
-
- if (fname == NULL)
- fname = _PATH_MANCONF;
- if ((cfp = fopen(fname, "r")) == NULL)
- err(1, "%s", fname);
- TAILQ_INIT(&head);
- for (lcnt = 1; (p = fgetln(cfp, &len)) != NULL; ++lcnt) {
- if (len == 1) /* Skip empty lines. */
- continue;
- if (p[len - 1] != '\n') { /* Skip corrupted lines. */
- warnx("%s: line %d corrupted", fname, lcnt);
- continue;
- }
- p[len - 1] = '\0'; /* Terminate the line. */
-
- /* Skip leading space. */
- for (; *p != '\0' && isspace(*p); ++p);
- /* Skip empty/comment lines. */
- if (*p == '\0' || *p == '#')
- continue;
- /* Find first token. */
- for (t = p; *t && !isspace(*t); ++t);
- if (*t == '\0') /* Need more than one token.*/
- continue;
- *t = '\0';
-
- for (tp = head.tqh_first; /* Find any matching tag. */
- tp != NULL && strcmp(p, tp->s); tp = tp->q.tqe_next);
-
- if (tp == NULL) /* Create a new tag. */
- tp = addlist(p);
-
- /*
- * Attach new records. The keyword _build takes the rest of
- * the line as a single entity, everything else is white
- * space separated. The reason we're not just using strtok(3)
- * for all of the parsing is so we don't get caught if a line
- * has only a single token on it.
- */
- if (!strcmp(p, "_build")) {
- while (*++t && isspace(*t));
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(t)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_TAIL(&tp->list, ep, q);
- } else for (++t; (p = strtok(t, " \t\n")) != NULL; t = NULL) {
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(p)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_TAIL(&tp->list, ep, q);
- }
- }
-}
-
-/*
- * addlist --
- * Add a tag to the list.
- */
-TAG *
-addlist(name)
- char *name;
-{
- TAG *tp;
-
- if ((tp = calloc(1, sizeof(TAG))) == NULL ||
- (tp->s = strdup(name)) == NULL)
- err(1, NULL);
- TAILQ_INIT(&tp->list);
- TAILQ_INSERT_TAIL(&head, tp, q);
- return (tp);
-}
-
-/*
- * getlist --
- * Return the linked list of entries for a tag if it exists.
- */
-TAG *
-getlist(name)
- char *name;
-{
- TAG *tp;
-
- for (tp = head.tqh_first; tp != NULL; tp = tp->q.tqe_next)
- if (!strcmp(name, tp->s))
- return (tp);
- return (NULL);
-}
-
-void
-debug(l)
- char *l;
-{
- TAG *tp;
- ENTRY *ep;
-
- (void)printf("%s ===============\n", l);
- for (tp = head.tqh_first; tp != NULL; tp = tp->q.tqe_next) {
- printf("%s\n", tp->s);
- for (ep = tp->list.tqh_first; ep != NULL; ep = ep->q.tqe_next)
- printf("\t%s\n", ep->s);
- }
-}
diff --git a/usr.bin/man/config.h b/usr.bin/man/config.h
deleted file mode 100644
index 52ea969..0000000
--- a/usr.bin/man/config.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)config.h 8.4 (Berkeley) 12/18/93
- */
-
-typedef struct _tag {
- TAILQ_ENTRY(_tag) q; /* Queue of tags. */
-
- TAILQ_HEAD(tqh, _entry) list; /* Queue of entries. */
- char *s; /* Associated string. */
- size_t len; /* Length of 's'. */
-} TAG;
-typedef struct _entry {
- TAILQ_ENTRY(_entry) q; /* Queue of entries. */
-
- char *s; /* Associated string. */
- size_t len; /* Length of 's'. */
-} ENTRY;
-
-TAILQ_HEAD(_head, _tag);
-extern struct _head head;
-
-TAG *addlist __P((char *));
-void config __P((char *));
-void debug __P((char *));
-TAG *getlist __P((char *));
diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1
deleted file mode 100644
index 081e204..0000000
--- a/usr.bin/man/man.1
+++ /dev/null
@@ -1,188 +0,0 @@
-.\" Copyright (c) 1989, 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.
-.\"
-.\" @(#)man.1 8.2 (Berkeley) 1/2/94
-.\"
-.Dd January 2, 1994
-.Dt MAN 1
-.Os BSD 4
-.Sh NAME
-.Nm man
-.Nd display the on-line manual pages
-.Sh SYNOPSIS
-.Nm man
-.Op Fl achw
-.Op Fl C Ar file
-.Op Fl M Ar path
-.Op Fl m Ar path
-.Op Ar section
-.Ar name Ar ...
-.Sh DESCRIPTION
-The
-.Nm man
-utility
-displays the
-.Bx
-manual pages entitled
-.Ar name .
-.Pp
-The options are as follows:
-.Bl -tag -width indent
-.It Fl a
-Display all of the manual pages for a specified
-.Ar section
-and
-.Ar name
-combination.
-(Normally, only the first manual page found is displayed.)
-.It Fl C
-Use the specified
-.Ar file
-instead of the default configuration file.
-This permits users to configure their own manual environment.
-See
-.Xr man.conf 5
-for a description of the contents of this file.
-.It Fl c
-Copy the manual page to the standard output instead of using
-.Xr more 1
-to paginate it.
-This is done by default if the standard output is not a terminal device.
-.It Fl h
-Display only the
-.Dq Tn SYNOPSIS
-lines of the requested manual pages.
-.It Fl M
-Override the list of standard directories which
-.Nm man
-searches for manual pages.
-The supplied
-.Ar path
-must be a colon (``:'') separated list of directories.
-This search path may also be set using the environment variable
-.Ev MANPATH .
-The subdirectories to be searched, and their search order,
-is specified by the ``_subdir'' line in the
-.Nm man
-configuration file.
-.It Fl m
-Augment the list of standard directories which
-.Nm man
-searches for manual pages.
-The supplied
-.Ar path
-must be a colon (``:'') separated list of directories.
-These directories will be searched before the standard directories or
-the directories specified using the
-.Fl M
-option or the
-.Ev MANPATH
-environment variable.
-The subdirectories to be searched, and their search order,
-is specified by the ``_subdir'' line in the
-.Nm man
-configuration file.
-.It Fl w
-List the pathnames of the manual pages which
-.Nm man
-would display for the specified
-.Ar section
-and
-.Ar name
-combination.
-.El
-.Pp
-The optional
-.Ar section
-argument restricts the directories that
-.Nm man
-will search.
-The
-.Nm man
-configuration file (see
-.Xr man.conf 5 )
-specifies the possible
-.Ar section
-values that are currently available.
-If only a single argument is specified or if the first argument is
-not a valid section,
-.Nm man
-assumes that the argument is the name of a manual page to be displayed.
-.Sh ENVIRONMENT
-.Bl -tag -width MANPATHX
-.It Ev MACHINE
-As some manual pages are intended only for specific architectures,
-.Nm man
-searches any subdirectories,
-with the same name as the current architecture,
-in every directory which it searches.
-Machine specific areas are checked before general areas.
-The current machine type may be overridden by setting the environment
-variable
-.Ev MACHINE
-to the name of a specific architecture.
-.It Ev MANPATH
-The standard search path used by
-.Nm man
-may be overridden by specifying a path in the
-.Ev MANPATH
-environment
-variable.
-The format of the path is a colon (``:'') separated list of directories.
-The subdirectories to be searched as well as their search order
-is specified by the ``_subdir'' line in the
-.Nm man
-configuration file.
-.It Ev PAGER
-Any value of the environment variable
-.Ev PAGER
-will be used instead of the standard pagination program,
-.Xr more 1 .
-.El
-.Sh FILES
-.Bl -tag -width /etc/man.conf -compact
-.It Pa /etc/man.conf
-default man configuration file.
-.El
-.Sh SEE ALSO
-.Xr apropos 1 ,
-.Xr whatis 1 ,
-.Xr whereis 1 ,
-.Xr man.conf 5
-.Sh BUGS
-The on-line manual pages are, by necessity, forgiving toward stupid
-display devices, causing a few manual pages to not as nicely formatted
-as their typeset counterparts.
-.Sh HISTORY
-A
-.Nm
-command appeared in
-.At v6 .
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c
deleted file mode 100644
index a320e31..0000000
--- a/usr.bin/man/man.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * Copyright (c) 1987, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1987, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)man.c 8.16 (Berkeley) 4/16/94";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/queue.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <glob.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "config.h"
-#include "pathnames.h"
-
-int f_all, f_where;
-
-static void build_page __P((char *, char **));
-static void cat __P((char *));
-static char *check_pager __P((char *));
-static int cleanup __P((void));
-static void how __P((char *));
-static void jump __P((char **, char *, char *));
-static int manual __P((char *, TAG *, glob_t *));
-static void onsig __P((int));
-static void usage __P((void));
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- extern char *optarg;
- extern int optind;
- TAG *defp, *defnewp, *section, *sectnewp, *subp;
- ENTRY *e_defp, *e_sectp, *e_subp, *ep;
- glob_t pg;
- size_t len;
- int ch, f_cat, f_how, found;
- char **ap, *cmd, *machine, *p, *p_add, *p_path, *pager, *slashp;
- char *conffile, buf[MAXPATHLEN * 2];
-
- f_cat = f_how = 0;
- conffile = p_add = p_path = NULL;
- while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:w")) != EOF)
- switch (ch) {
- case 'a':
- f_all = 1;
- break;
- case 'C':
- conffile = optarg;
- break;
- case 'c':
- case '-': /* Deprecated. */
- f_cat = 1;
- break;
- case 'h':
- f_how = 1;
- break;
- case 'm':
- p_add = optarg;
- break;
- case 'M':
- case 'P': /* Backward compatibility. */
- p_path = optarg;
- break;
- /*
- * The -f and -k options are backward compatible,
- * undocumented ways of calling whatis(1) and apropos(1).
- */
- case 'f':
- jump(argv, "-f", "whatis");
- /* NOTREACHED */
- case 'k':
- jump(argv, "-k", "apropos");
- /* NOTREACHED */
- case 'w':
- f_all = f_where = 1;
- break;
- case '?':
- default:
- usage();
- }
- argc -= optind;
- argv += optind;
-
- if (!*argv)
- usage();
-
- if (!f_cat && !f_how && !f_where)
- if (!isatty(1))
- f_cat = 1;
- else if ((pager = getenv("PAGER")) != NULL)
- pager = check_pager(pager);
- else
- pager = _PATH_PAGER;
-
- /* Read the configuration file. */
- config(conffile);
-
- /* Get the machine type. */
- if ((machine = getenv("MACHINE")) == NULL)
- machine = MACHINE;
-
- /* If there's no _default list, create an empty one. */
- if ((defp = getlist("_default")) == NULL)
- defp = addlist("_default");
-
- /*
- * 1: If the user specified a MANPATH variable, or set the -M
- * option, we replace the _default list with the user's list,
- * appending the entries in the _subdir list and the machine.
- */
- if (p_path == NULL)
- p_path = getenv("MANPATH");
- if (p_path != NULL) {
- while ((e_defp = defp->list.tqh_first) != NULL) {
- free(e_defp->s);
- TAILQ_REMOVE(&defp->list, e_defp, q);
- }
- for (p = strtok(p_path, ":");
- p != NULL; p = strtok(NULL, ":")) {
- slashp = p[strlen(p) - 1] == '/' ? "" : "/";
- e_subp = (subp = getlist("_subdir")) == NULL ?
- NULL : subp->list.tqh_first;
- for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
- (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
- p, slashp, e_subp->s, machine);
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(buf)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_TAIL(&defp->list, ep, q);
- }
- }
- }
-
- /*
- * 2: If the user did not specify MANPATH, -M or a section, rewrite
- * the _default list to include the _subdir list and the machine.
- */
- if (argv[1] == NULL)
- section = NULL;
- else if ((section = getlist(*argv)) != NULL)
- ++argv;
- if (p_path == NULL && section == NULL) {
- defnewp = addlist("_default_new");
- e_defp =
- defp->list.tqh_first == NULL ? NULL : defp->list.tqh_first;
- for (; e_defp != NULL; e_defp = e_defp->q.tqe_next) {
- slashp =
- e_defp->s[strlen(e_defp->s) - 1] == '/' ? "" : "/";
- e_subp = (subp = getlist("_subdir")) == NULL ?
- NULL : subp->list.tqh_first;
- for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
- (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
- e_defp->s, slashp, e_subp->s, machine);
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(buf)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_TAIL(&defnewp->list, ep, q);
- }
- }
- defp = getlist("_default");
- while ((e_defp = defp->list.tqh_first) != NULL) {
- free(e_defp->s);
- TAILQ_REMOVE(&defp->list, e_defp, q);
- }
- free(defp->s);
- TAILQ_REMOVE(&head, defp, q);
- defnewp = getlist("_default_new");
- free(defnewp->s);
- defnewp->s = "_default";
- defp = defnewp;
- }
-
- /*
- * 3: If the user set the -m option, insert the user's list before
- * whatever list we have, again appending the _subdir list and
- * the machine.
- */
- if (p_add != NULL)
- for (p = strtok(p_add, ":"); p != NULL; p = strtok(NULL, ":")) {
- slashp = p[strlen(p) - 1] == '/' ? "" : "/";
- e_subp = (subp = getlist("_subdir")) == NULL ?
- NULL : subp->list.tqh_first;
- for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
- (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
- p, slashp, e_subp->s, machine);
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(buf)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_HEAD(&defp->list, ep, q);
- }
- }
-
- /*
- * 4: If none of MANPATH, -M, or -m were specified, and a section was,
- * rewrite the section's paths (if they have a trailing slash) to
- * append the _subdir list and the machine. This then becomes the
- * _default list.
- */
- if (p_path == NULL && p_add == NULL && section != NULL) {
- sectnewp = addlist("_section_new");
- for (e_sectp = section->list.tqh_first;
- e_sectp != NULL; e_sectp = e_sectp->q.tqe_next) {
- if (e_sectp->s[strlen(e_sectp->s) - 1] != '/') {
- (void)snprintf(buf, sizeof(buf),
- "%s{/%s,}", e_sectp->s, machine);
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(buf)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_TAIL(&sectnewp->list, ep, q);
- continue;
- }
- e_subp = (subp = getlist("_subdir")) == NULL ?
- NULL : subp->list.tqh_first;
- for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
- (void)snprintf(buf, sizeof(buf), "%s%s{/%s,}",
- e_sectp->s, e_subp->s, machine);
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(buf)) == NULL)
- err(1, NULL);
- TAILQ_INSERT_TAIL(&sectnewp->list, ep, q);
- }
- }
- sectnewp->s = section->s;
- defp = sectnewp;
- TAILQ_REMOVE(&head, section, q);
- }
-
- /*
- * 5: Search for the files. Set up an interrupt handler, so the
- * temporary files go away.
- */
- (void)signal(SIGINT, onsig);
- (void)signal(SIGHUP, onsig);
-
- memset(&pg, 0, sizeof(pg));
- for (found = 0; *argv; ++argv)
- if (manual(*argv, defp, &pg))
- found = 1;
-
- /* 6: If nothing found, we're done. */
- if (!found) {
- (void)cleanup();
- exit (1);
- }
-
- /* 7: If it's simple, display it fast. */
- if (f_cat) {
- for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
- if (**ap == '\0')
- continue;
- cat(*ap);
- }
- exit (cleanup());
- }
- if (f_how) {
- for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
- if (**ap == '\0')
- continue;
- how(*ap);
- }
- exit(cleanup());
- }
- if (f_where) {
- for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
- if (**ap == '\0')
- continue;
- (void)printf("%s\n", *ap);
- }
- exit(cleanup());
- }
-
- /*
- * 8: We display things in a single command; build a list of things
- * to display.
- */
- for (ap = pg.gl_pathv, len = strlen(pager) + 1; *ap != NULL; ++ap) {
- if (**ap == '\0')
- continue;
- len += strlen(*ap) + 1;
- }
- if ((cmd = malloc(len)) == NULL) {
- warn(NULL);
- (void)cleanup();
- exit(1);
- }
- p = cmd;
- len = strlen(pager);
- memmove(p, pager, len);
- p += len;
- *p++ = ' ';
- for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
- if (**ap == '\0')
- continue;
- len = strlen(*ap);
- memmove(p, *ap, len);
- p += len;
- *p++ = ' ';
- }
- *p = '\0';
-
- /* Use system(3) in case someone's pager is "pager arg1 arg2". */
- (void)system(cmd);
-
- exit(cleanup());
-}
-
-/*
- * manual --
- * Search the manuals for the pages.
- */
-static int
-manual(page, tag, pg)
- char *page;
- TAG *tag;
- glob_t *pg;
-{
- ENTRY *ep, *e_sufp, *e_tag;
- TAG *missp, *sufp;
- int anyfound, cnt, found;
- char *p, buf[128];
-
- anyfound = 0;
- buf[0] = '*';
-
- /* For each element in the list... */
- e_tag = tag == NULL ? NULL : tag->list.tqh_first;
- for (; e_tag != NULL; e_tag = e_tag->q.tqe_next) {
- (void)snprintf(buf, sizeof(buf), "%s/%s.*", e_tag->s, page);
- if (glob(buf,
- GLOB_APPEND | GLOB_BRACE | GLOB_NOSORT | GLOB_QUOTE,
- NULL, pg)) {
- warn("globbing");
- (void)cleanup();
- exit(1);
- }
- if (pg->gl_matchc == 0)
- continue;
-
- /* Find out if it's really a man page. */
- for (cnt = pg->gl_pathc - pg->gl_matchc;
- cnt < pg->gl_pathc; ++cnt) {
-
- /*
- * Try the _suffix key words first.
- *
- * XXX
- * Older versions of man.conf didn't have the suffix
- * key words, it was assumed that everything was a .0.
- * We just test for .0 first, it's fast and probably
- * going to hit.
- */
- (void)snprintf(buf, sizeof(buf), "*/%s.0", page);
- if (!fnmatch(buf, pg->gl_pathv[cnt], 0))
- goto next;
-
- e_sufp = (sufp = getlist("_suffix")) == NULL ?
- NULL : sufp->list.tqh_first;
- for (found = 0;
- e_sufp != NULL; e_sufp = e_sufp->q.tqe_next) {
- (void)snprintf(buf,
- sizeof(buf), "*/%s%s", page, e_sufp->s);
- if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
- found = 1;
- break;
- }
- }
- if (found)
- goto next;
-
- /* Try the _build key words next. */
- e_sufp = (sufp = getlist("_build")) == NULL ?
- NULL : sufp->list.tqh_first;
- for (found = 0;
- e_sufp != NULL; e_sufp = e_sufp->q.tqe_next) {
- for (p = e_sufp->s;
- *p != '\0' && !isspace(*p); ++p);
- if (*p == '\0')
- continue;
- *p = '\0';
- (void)snprintf(buf,
- sizeof(buf), "*/%s%s", page, e_sufp->s);
- if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
- if (!f_where)
- build_page(p + 1,
- &pg->gl_pathv[cnt]);
- *p = ' ';
- found = 1;
- break;
- }
- *p = ' ';
- }
- if (found) {
-next: anyfound = 1;
- if (!f_all) {
- /* Delete any other matches. */
- while (++cnt< pg->gl_pathc)
- pg->gl_pathv[cnt] = "";
- break;
- }
- continue;
- }
-
- /* It's not a man page, forget about it. */
- pg->gl_pathv[cnt] = "";
- }
-
- if (anyfound && !f_all)
- break;
- }
-
- /* If not found, enter onto the missing list. */
- if (!anyfound) {
- if ((missp = getlist("_missing")) == NULL)
- missp = addlist("_missing");
- if ((ep = malloc(sizeof(ENTRY))) == NULL ||
- (ep->s = strdup(page)) == NULL) {
- warn(NULL);
- (void)cleanup();
- exit(1);
- }
- TAILQ_INSERT_TAIL(&missp->list, ep, q);
- }
- return (anyfound);
-}
-
-/*
- * build_page --
- * Build a man page for display.
- */
-static void
-build_page(fmt, pathp)
- char *fmt, **pathp;
-{
- static int warned;
- ENTRY *ep;
- TAG *intmpp;
- int fd;
- char buf[MAXPATHLEN], cmd[MAXPATHLEN], tpath[sizeof(_PATH_TMP)];
-
- /* Let the user know this may take awhile. */
- if (!warned) {
- warned = 1;
- warnx("Formatting manual page...");
- }
-
- /* Add a remove-when-done list. */
- if ((intmpp = getlist("_intmp")) == NULL)
- intmpp = addlist("_intmp");
-
- /* Move to the printf(3) format string. */
- for (; *fmt && isspace(*fmt); ++fmt);
-
- /*
- * Get a temporary file and build a version of the file
- * to display. Replace the old file name with the new one.
- */
- (void)strcpy(tpath, _PATH_TMP);
- if ((fd = mkstemp(tpath)) == -1) {
- warn("%s", tpath);
- (void)cleanup();
- exit(1);
- }
- (void)snprintf(buf, sizeof(buf), "%s > %s", fmt, tpath);
- (void)snprintf(cmd, sizeof(cmd), buf, *pathp);
- (void)system(cmd);
- (void)close(fd);
- if ((*pathp = strdup(tpath)) == NULL) {
- warn(NULL);
- (void)cleanup();
- exit(1);
- }
-
- /* Link the built file into the remove-when-done list. */
- if ((ep = malloc(sizeof(ENTRY))) == NULL) {
- warn(NULL);
- (void)cleanup();
- exit(1);
- }
- ep->s = *pathp;
- TAILQ_INSERT_TAIL(&intmpp->list, ep, q);
-}
-
-/*
- * how --
- * display how information
- */
-static void
-how(fname)
- char *fname;
-{
- FILE *fp;
-
- int lcnt, print;
- char *p, buf[256];
-
- if (!(fp = fopen(fname, "r"))) {
- warn("%s", fname);
- (void)cleanup();
- exit (1);
- }
-#define S1 "SYNOPSIS"
-#define S2 "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS"
-#define D1 "DESCRIPTION"
-#define D2 "D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN"
- for (lcnt = print = 0; fgets(buf, sizeof(buf), fp);) {
- if (!strncmp(buf, S1, sizeof(S1) - 1) ||
- !strncmp(buf, S2, sizeof(S2) - 1)) {
- print = 1;
- continue;
- } else if (!strncmp(buf, D1, sizeof(D1) - 1) ||
- !strncmp(buf, D2, sizeof(D2) - 1))
- return;
- if (!print)
- continue;
- if (*buf == '\n')
- ++lcnt;
- else {
- for(; lcnt; --lcnt)
- (void)putchar('\n');
- for (p = buf; isspace(*p); ++p);
- (void)fputs(p, stdout);
- }
- }
- (void)fclose(fp);
-}
-
-/*
- * cat --
- * cat out the file
- */
-static void
-cat(fname)
- char *fname;
-{
- int fd, n;
- char buf[2048];
-
- if ((fd = open(fname, O_RDONLY, 0)) < 0) {
- warn("%s", fname);
- (void)cleanup();
- exit(1);
- }
- while ((n = read(fd, buf, sizeof(buf))) > 0)
- if (write(STDOUT_FILENO, buf, n) != n) {
- warn("write");
- (void)cleanup();
- exit (1);
- }
- if (n == -1) {
- warn("read");
- (void)cleanup();
- exit(1);
- }
- (void)close(fd);
-}
-
-/*
- * check_pager --
- * check the user supplied page information
- */
-static char *
-check_pager(name)
- char *name;
-{
- char *p, *save;
-
- /*
- * if the user uses "more", we make it "more -s"; watch out for
- * PAGER = "mypager /usr/ucb/more"
- */
- for (p = name; *p && !isspace(*p); ++p);
- for (; p > name && *p != '/'; --p);
- if (p != name)
- ++p;
-
- /* make sure it's "more", not "morex" */
- if (!strncmp(p, "more", 4) && (!p[4] || isspace(p[4]))){
- save = name;
- /* allocate space to add the "-s" */
- if (!(name =
- malloc((u_int)(strlen(save) + sizeof("-s") + 1))))
- err(1, NULL);
- (void)sprintf(name, "%s %s", save, "-s");
- }
- return(name);
-}
-
-/*
- * jump --
- * strip out flag argument and jump
- */
-static void
-jump(argv, flag, name)
- char **argv, *flag, *name;
-{
- char **arg;
-
- argv[0] = name;
- for (arg = argv + 1; *arg; ++arg)
- if (!strcmp(*arg, flag))
- break;
- for (; *arg; ++arg)
- arg[0] = arg[1];
- execvp(name, argv);
- (void)fprintf(stderr, "%s: Command not found.\n", name);
- exit(1);
-}
-
-/*
- * onsig --
- * If signaled, delete the temporary files.
- */
-static void
-onsig(signo)
- int signo;
-{
- (void)cleanup();
-
- (void)signal(signo, SIG_DFL);
- (void)kill(getpid(), signo);
-
- /* NOTREACHED */
- exit (1);
-}
-
-/*
- * cleanup --
- * Clean up temporary files, show any error messages.
- */
-static int
-cleanup()
-{
- TAG *intmpp, *missp;
- ENTRY *ep;
- int rval;
-
- rval = 0;
- ep = (missp = getlist("_missing")) == NULL ?
- NULL : missp->list.tqh_first;
- if (ep != NULL)
- for (; ep != NULL; ep = ep->q.tqe_next) {
- warnx("no entry for %s in the manual.", ep->s);
- rval = 1;
- }
-
- ep = (intmpp = getlist("_intmp")) == NULL ?
- NULL : intmpp->list.tqh_first;
- for (; ep != NULL; ep = ep->q.tqe_next)
- (void)unlink(ep->s);
- return (rval);
-}
-
-/*
- * usage --
- * print usage message and die
- */
-static void
-usage()
-{
- (void)fprintf(stderr,
- "usage: man [-achw] [-C file] [-M path] [-m path] [section] title ...\n");
- exit(1);
-}
diff --git a/usr.bin/man/man.conf b/usr.bin/man/man.conf
deleted file mode 100644
index 9faad52..0000000
--- a/usr.bin/man/man.conf
+++ /dev/null
@@ -1,46 +0,0 @@
-# Sheer, raging paranoia...
-_version BSD.2
-
-# The whatis/apropos database.
-_whatdb /usr/share/man/whatis.db
-
-# Subdirectories for paths ending in '/', IN SEARCH ORDER.
-_subdir cat{1,8,6,2,3,4,5,7,3f}
-
-# Files typed by suffix and their commands.
-# Note the order, .Z must come after .[1-9].Z, or it will match first.
-_suffix .0
-_build .[1-9] /usr/bin/nroff -man %s
-_build .[1-9].Z /usr/bin/zcat %s | /usr/bin/nroff -man
-_build .Z /usr/bin/zcat %s
-_build .0.Z /usr/bin/zcat %s
-_build .gz /usr/contrib/bin/gunzip %s
-_build .z /usr/contrib/bin/gunzip %s
-_build .nr /usr/bin/nroff -man %s
-
-# Sections and their directories.
-# All paths ending in '/' are the equivalent of entries specifying that
-# directory with all of the subdirectories listed for the keyword _subdir.
-
-# default
-_default /usr/{share,X11,contrib,local}/{man,man/old}/
-
-# Other sections that represent complete man subdirectories.
-X11 /usr/X11R4/man/
-X11R4 /usr/X11R4/man/
-contrib /usr/contrib/man/
-local /usr/local/man/
-new /usr/contrib/man/
-old /usr/share/man/old/
-
-# Specific section/directory combinations.
-1 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat1
-2 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat2
-3 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat3
-3F /usr/share/man/cat3f
-3f /usr/share/man/cat3f
-4 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat4
-5 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat5
-6 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat6
-7 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat7
-8 /usr/{share,X11R4,contrib,local}/{man/,man/old/}cat8
diff --git a/usr.bin/man/man.conf.5 b/usr.bin/man/man.conf.5
deleted file mode 100644
index 353a302..0000000
--- a/usr.bin/man/man.conf.5
+++ /dev/null
@@ -1,195 +0,0 @@
-.\" Copyright (c) 1989, 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.
-.\"
-.\" @(#)man.conf.5 8.5 (Berkeley) 1/2/94
-.\"
-.Dd January 2, 1994
-.Dt MAN.CONF 5
-.Os
-.Sh NAME
-.Nm man.conf
-.Nd configuration file for
-.Xr man 1
-.Sh DESCRIPTION
-The
-.Xr man 1 ,
-.Xr apropos 1 ,
-and
-.Xr whatis 1
-commands
-search for manual pages or their database files as specified by the
-.Nm man.conf
-file.
-Manual pages are normally expected to be preformatted (see
-.Xr nroff 1 )
-and named with a trailing ``.0''.
-.Pp
-The
-.Nm man.conf
-file contains two types of lines.
-.Pp
-The first type of line is a ``section'' line, which contains a
-section name followed by one or more directory paths.
-The directory paths may contain the normal shell globbing characters,
-including curly braces (``{}''); to escape a shell globbing character,
-precede it with a backslash (``\e'').
-Lines in this format specify that manual pages for the section
-may be found in the following directories.
-.Pp
-Directories named with a trailing slash character (``/'') are expected
-to contain subdirectories of manual pages, (see the keyword ``_subdir''
-below) instead of manual pages.
-These subdirectories are searched instead of the directory.
-.Pp
-Before searching any directory for a manual page, the
-.Xr man 1
-command always searches the subdirectory with the same name
-as the current machine type, if it exists.
-No specification of these subdirectories is necessary in the
-.Nm man.conf
-file.
-.Pp
-Section names are unrestricted except for the reserved words specified
-below; in general, you should avoid anything with a leading underscore
-(``_'') to avoid future incompatibilities.
-.Pp
-The section named ``_default'' is the list of directories that will
-be searched if no section is specified by the user.
-.Pp
-The second type of line is preceded with a ``keyword''.
-The possible keywords and their meanings are as follows:
-.Pp
-.Bl -tag -width "_version"
-.It _build
-Man file names, regardless of their format, are expected to end in
-a ``.*'' pattern, i.e. a ``.'' followed by some suffix.
-The first field of a _build line lists a suffix which indicates
-files which need to be reformated or manipulated in some way before
-being displayed to the user.
-The suffix may contain the normal shell globbing characters (NOT
-including curly braces (``{}'')).
-The rest of the line must be a shell command line, the standard
-output of which is the manual page in a format which may be directly
-displayed to the user.
-Any occurrences of the string ``%s'' in the shell command line will
-be replaced by the name of the file which is being reformatted.
-.It _subdir
-The list (in search order) of subdirectories which will be searched in
-any directory named with a trailing slash (``/'') character.
-This list is also used when a path is specified to the
-.Xr man 1
-utility by the user, using the
-.Ev MANPATH
-environment variable or the
-.Fl M
-and
-.Fl m
-options.
-.It _suffix
-Man file names, regardless of their format are expected to end in
-a ``.*'' pattern, i.e. a ``.'' followed by some suffix.
-Each field of a _suffix line is a suffix which indicates
-files which do not need to be reformatted or manipulated
-in any way, but which may be directly displayed to the user.
-Each suffix may contain the normal shell globbing characters (NOT
-including curly braces (``{}'')).
-.It _version
-The version of the configuration file.
-.It _whatdb
-The full pathname (not just a directory path) for a database to be used
-by the
-.Xr apropos 1
-and
-.Xr whatis 1
-commands.
-.El
-.Pp
-Multiple specifications for all types of lines are cumulative and the
-entries are used in the order listed in the file; multiple entries may
-be listed per line, as well.
-.Pp
-Empty lines or lines whose first non-whitespace character is a hash
-mark (``#'') are ignored.
-.Sh EXAMPLES
-Given the following
-.Nm man.conf
-file:
-.Bd -literal -offset indent
-_version BSD.2
-_subdir cat[123]
-_suffix .0
-_build .[1-9] nroff -man %s
-_build .tbl tbl %s | nroff -man
-_default /usr/share/man/
-sect3 /usr/share/man/{old/,}cat3
-.Ed
-.Pp
-By default, the command
-.Dq Li man mktemp
-will search for
-``mktemp.<any_digit>'' and ``mktemp.tbl''
-in the directories
-.Dq Pa /usr/share/man/cat1 ,
-.Dq Pa /usr/share/man/cat2 ,
-and
-.Dq Pa /usr/share/man/cat3 .
-If on a machine of type ``vax'', the subdirectory ``vax'' in each
-directory would be searched as well, before the directory was
-searched.
-.Pp
-If ``mktemp.tbl'' was found first, the command
-.Dq Li tbl <manual page> | nroff -man
-would be run to build a man page for display to the user.
-.Pp
-The command
-.Dq Li man sect3 mktemp
-would search the directories
-.Dq Pa /usr/share/man/old/cat3
-and
-.Dq Pa /usr/share/man/cat3 ,
-in that order, for
-the mktemp manual page.
-If a subdirectory with the same name as the current machine type
-existed in any of them, it would be searched as well, before each
-of them were searched.
-.Sh FILES
-.Bl -tag -width /etc/man.conf -compact
-.It Pa /etc/man.conf
-Standard manual directory search path.
-.El
-.Sh SEE ALSO
-.Xr apropos 1 ,
-.Xr machine 1 ,
-.Xr man 1 ,
-.Xr whatis 1 ,
-.Xr whereis 1 ,
-.Xr fnmatch 3 ,
-.Xr glob 3
diff --git a/usr.bin/man/pathnames.h b/usr.bin/man/pathnames.h
deleted file mode 100644
index 17284fe..0000000
--- a/usr.bin/man/pathnames.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)pathnames.h 8.3 (Berkeley) 1/2/94
- */
-
-#define _PATH_MANCONF "/etc/man.conf"
-#define _PATH_PAGER "/usr/bin/more -s"
-#define _PATH_TMP "/tmp/man.XXXXXX"
-#define _PATH_WHATIS "whatis.db"
diff --git a/usr.bin/mklocale/Japanese b/usr.bin/mklocale/Japanese
deleted file mode 100644
index 55eb155..0000000
--- a/usr.bin/mklocale/Japanese
+++ /dev/null
@@ -1,158 +0,0 @@
-# @(#)Japanese 8.1 (Berkeley) 6/6/93
-
-/*
- * Japanese LOCALE_CTYPE definitions using EUC of JIS character sets
- */
-
-ENCODING "EUC"
-
-/* JIS JIS JIS */
-/* X201 X208 X201 */
-/* 00-7f 84-fe */
-
-VARIABLE 1 0x0000 2 0x8080 2 0x0080 3 0x8000 0x8080
-
-/*
- * Code Set 1
- */
-ALPHA 'A' - 'Z' 'a' - 'z'
-CONTROL 0x00 - 0x1f 0x7f
-DIGIT '0' - '9'
-GRAPH 0x21 - 0x7e
-LOWER 'a' - 'z'
-PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e
-SPACE 0x09 - 0x0d 0x20
-UPPER 'A' - 'Z'
-XDIGIT 'a' - 'f' 'A' - 'F'
-BLANK ' ' '\t'
-PRINT 0x20 - 0x7e
-
-MAPLOWER < 'A' - 'Z' : 'a' >
-MAPLOWER < 'a' - 'z' : 'a' >
-MAPUPPER < 'A' - 'Z' : 'A' >
-MAPUPPER < 'a' - 'z' : 'A' >
-TODIGIT < '0' - '9' : 0 >
-TODIGIT < 'A' - 'F' : 10 >
-TODIGIT < 'a' - 'f' : 10 >
-
-/*
- * Code Set 2
- */
-
-SPACE 0xa1a1
-PHONOGRAM 0xa1bc
-SPECIAL 0xa1a2 - 0xa1fe
-PUNCT 0xa1a2 - 0xa1f8 /* A few too many in here... */
-
-SPECIAL 0xa2a1 - 0xa2ae 0xa2ba - 0xa2c1 0xa2ca - 0xa2d0 0xa2dc - 0xa2ea
-SPECIAL 0xa2f2 - 0xa2f9 0xa2fe
-
-DIGIT 0xa3b0 - 0xa3b9
-UPPER 0xa3c1 - 0xa3da /* Romaji */
-LOWER 0xa3e1 - 0xa3fa /* Romaji */
-MAPLOWER < 0xa3c1 - 0xa3da : 0xa3e1 > /* English */
-MAPLOWER < 0xa3e1 - 0xa3fa : 0xa3e1 > /* English */
-MAPUPPER < 0xa3c1 - 0xa3da : 0xa3c1 >
-MAPUPPER < 0xa3e1 - 0xa3fa : 0xa3c1 >
-
-XDIGIT 0xa3c1 - 0xa3c6 0xa3e1 - 0xa3e6
-
-TODIGIT < 0xa3b0 - 0xa3b9 : 0 >
-TODIGIT < 0xa3c1 - 0xa3c6 : 10 >
-TODIGIT < 0xa3e1 - 0xa3e6 : 10 >
-
-PHONOGRAM 0xa4a1 - 0xa4f3
-PHONOGRAM 0xa5a1 - 0xa5f6
-
-UPPER 0xa6a1 - 0xa6b8 /* Greek */
-LOWER 0xa6c1 - 0xa6d8 /* Greek */
-MAPLOWER < 0xa6a1 - 0xa6b8 : 0xa6c1 >
-MAPLOWER < 0xa6c1 - 0xa6d8 : 0xa6c1 >
-MAPUPPER < 0xa6a1 - 0xa6b8 : 0xa6a1 >
-MAPUPPER < 0xa6c1 - 0xa6d8 : 0xa6a1 >
-
-UPPER 0xa7a1 - 0xa7c1 /* Cyrillic */
-LOWER 0xa7d1 - 0xa7f1 /* Cyrillic */
-MAPLOWER < 0xa7a1 - 0xa7c1 : 0xa7d1 >
-MAPLOWER < 0xa7d1 - 0xa7f1 : 0xa7d1 >
-MAPUPPER < 0xa7a1 - 0xa7c1 : 0xa7a1 >
-MAPUPPER < 0xa7d1 - 0xa7f1 : 0xa7a1 >
-
-SPECIAL 0xa8a1 - 0xa8c0
-
-IDEOGRAM 0xb0a1 - 0xb0fe
-IDEOGRAM 0xb1a1 - 0xb1fe
-IDEOGRAM 0xb2a1 - 0xb2fe
-IDEOGRAM 0xb3a1 - 0xb3fe
-IDEOGRAM 0xb4a1 - 0xb4fe
-IDEOGRAM 0xb5a1 - 0xb5fe
-IDEOGRAM 0xb6a1 - 0xb6fe
-IDEOGRAM 0xb7a1 - 0xb7fe
-IDEOGRAM 0xb8a1 - 0xb8fe
-IDEOGRAM 0xb9a1 - 0xb9fe
-IDEOGRAM 0xbaa1 - 0xbafe
-IDEOGRAM 0xbba1 - 0xbbfe
-IDEOGRAM 0xbca1 - 0xbcfe
-IDEOGRAM 0xbda1 - 0xbdfe
-IDEOGRAM 0xbea1 - 0xbefe
-IDEOGRAM 0xbfa1 - 0xbffe
-IDEOGRAM 0xc0a1 - 0xc0fe
-IDEOGRAM 0xc1a1 - 0xc1fe
-IDEOGRAM 0xc2a1 - 0xc2fe
-IDEOGRAM 0xc3a1 - 0xc3fe
-IDEOGRAM 0xc4a1 - 0xc4fe
-IDEOGRAM 0xc5a1 - 0xc5fe
-IDEOGRAM 0xc6a1 - 0xc6fe
-IDEOGRAM 0xc7a1 - 0xc7fe
-IDEOGRAM 0xc8a1 - 0xc8fe
-IDEOGRAM 0xc9a1 - 0xc9fe
-IDEOGRAM 0xcaa1 - 0xcafe
-IDEOGRAM 0xcba1 - 0xcbfe
-IDEOGRAM 0xcca1 - 0xccfe
-IDEOGRAM 0xcda1 - 0xcdfe
-IDEOGRAM 0xcea1 - 0xcefe
-IDEOGRAM 0xcfa1 - 0xcfd3
-IDEOGRAM 0xd0a1 - 0xd0fe
-IDEOGRAM 0xd1a1 - 0xd1fe
-IDEOGRAM 0xd2a1 - 0xd2fe
-IDEOGRAM 0xd3a1 - 0xd3fe
-IDEOGRAM 0xd4a1 - 0xd4fe
-IDEOGRAM 0xd5a1 - 0xd5fe
-IDEOGRAM 0xd6a1 - 0xd6fe
-IDEOGRAM 0xd7a1 - 0xd7fe
-IDEOGRAM 0xd8a1 - 0xd8fe
-IDEOGRAM 0xd9a1 - 0xd9fe
-IDEOGRAM 0xdaa1 - 0xdafe
-IDEOGRAM 0xdba1 - 0xdbfe
-IDEOGRAM 0xdca1 - 0xdcfe
-IDEOGRAM 0xdda1 - 0xddfe
-IDEOGRAM 0xdea1 - 0xdefe
-IDEOGRAM 0xdfa1 - 0xdffe
-IDEOGRAM 0xe0a1 - 0xe0fe
-IDEOGRAM 0xe1a1 - 0xe1fe
-IDEOGRAM 0xe2a1 - 0xe2fe
-IDEOGRAM 0xe3a1 - 0xe3fe
-IDEOGRAM 0xe4a1 - 0xe4fe
-IDEOGRAM 0xe5a1 - 0xe5fe
-IDEOGRAM 0xe6a1 - 0xe6fe
-IDEOGRAM 0xe7a1 - 0xe7fe
-IDEOGRAM 0xe8a1 - 0xe8fe
-IDEOGRAM 0xe9a1 - 0xe9fe
-IDEOGRAM 0xeaa1 - 0xeafe
-IDEOGRAM 0xeba1 - 0xebfe
-IDEOGRAM 0xeca1 - 0xecfe
-IDEOGRAM 0xeda1 - 0xedfe
-IDEOGRAM 0xeea1 - 0xeefe
-IDEOGRAM 0xefa1 - 0xeffe
-IDEOGRAM 0xf0a1 - 0xf0fe
-IDEOGRAM 0xf1a1 - 0xf1fe
-IDEOGRAM 0xf2a1 - 0xf2fe
-IDEOGRAM 0xf3a1 - 0xf3fe
-IDEOGRAM 0xf4a1 - 0xf4a4
-
-/*
- * This is for Code Set 3, half-width kana
- */
-SPECIAL 0xa1 - 0xdf
-PHONOGRAM 0xa1 - 0xdf
-CONTROL 0x84 - 0x97 0x9b - 0x9f 0xe0 - 0xfe
diff --git a/usr.bin/passwd/kpasswd_proto.h b/usr.bin/passwd/kpasswd_proto.h
deleted file mode 100644
index 465d4c7..0000000
--- a/usr.bin/passwd/kpasswd_proto.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)kpasswd_proto.h 8.1 (Berkeley) 6/6/93
- */
-
-/*
- * kpasswd_proto
- *
- * definitions for the kpasswd "protocol"
- * (We hope this to be temporary until a real admin protocol is worked out.)
- */
-
-struct kpasswd_data {
- des_cblock random_key;
- char secure_msg[_PASSWORD_LEN];
-};
-
-struct update_data {
- char pw[_PASSWORD_LEN];
- char secure_msg[_PASSWORD_LEN];
-};
-#define SERVICE "kpasswd"
-#define SECURE_STRING \
- "Kerberos password update program -- 12/9/88 UC Berkeley"
diff --git a/usr.bin/passwd/krb_passwd.c b/usr.bin/passwd/krb_passwd.c
deleted file mode 100644
index d4a0f15..0000000
--- a/usr.bin/passwd/krb_passwd.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)krb_passwd.c 8.3 (Berkeley) 4/2/94";
-#endif /* not lint */
-
-#ifdef KERBEROS
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <netinet/in.h>
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-
-#include <err.h>
-#include <errno.h>
-#include <netdb.h>
-#include <pwd.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "kpasswd_proto.h"
-
-#include "extern.h"
-
-#define PROTO "tcp"
-
-static void send_update __P((int, char *, char *));
-static void recv_ack __P((int));
-static void cleanup __P((void));
-static void finish __P((void));
-
-static struct timeval timeout = { CLIENT_KRB_TIMEOUT, 0 };
-static struct kpasswd_data proto_data;
-static des_cblock okey;
-static Key_schedule osched;
-static KTEXT_ST ticket;
-static Key_schedule random_schedule;
-static long authopts;
-static char realm[REALM_SZ], krbhst[MAX_HSTNM];
-static int sock;
-
-int
-krb_passwd()
-{
- struct servent *se;
- struct hostent *host;
- struct sockaddr_in sin;
- CREDENTIALS cred;
- fd_set readfds;
- int rval;
- char pass[_PASSWORD_LEN], password[_PASSWORD_LEN];
- static void finish();
-
- static struct rlimit rl = { 0, 0 };
-
- (void)signal(SIGHUP, SIG_IGN);
- (void)signal(SIGINT, SIG_IGN);
- (void)signal(SIGTSTP, SIG_IGN);
-
- if (setrlimit(RLIMIT_CORE, &rl) < 0) {
- warn("setrlimit");
- return (1);
- }
-
- if ((se = getservbyname(SERVICE, PROTO)) == NULL) {
- warnx("couldn't find entry for service %s/%s",
- SERVICE, PROTO);
- return (1);
- }
-
- if ((rval = krb_get_lrealm(realm,1)) != KSUCCESS) {
- warnx("couldn't get local Kerberos realm: %s",
- krb_err_txt[rval]);
- return (1);
- }
-
- if ((rval = krb_get_krbhst(krbhst, realm, 1)) != KSUCCESS) {
- warnx("couldn't get Kerberos host: %s",
- krb_err_txt[rval]);
- return (1);
- }
-
- if ((host = gethostbyname(krbhst)) == NULL) {
- warnx("couldn't get host entry for krb host %s",
- krbhst);
- return (1);
- }
-
- sin.sin_family = host->h_addrtype;
- memmove((char *) &sin.sin_addr, host->h_addr, host->h_length);
- sin.sin_port = se->s_port;
-
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- warn("socket");
- return (1);
- }
-
- if (connect(sock, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
- warn("connect");
- (void)close(sock);
- return (1);
- }
-
- rval = krb_sendauth(
- authopts, /* NOT mutual */
- sock,
- &ticket, /* (filled in) */
- SERVICE,
- krbhst, /* instance (krbhst) */
- realm, /* dest realm */
- (u_long) getpid(), /* checksum */
- NULL, /* msg data */
- NULL, /* credentials */
- NULL, /* schedule */
- NULL, /* local addr */
- NULL, /* foreign addr */
- "KPWDV0.1"
- );
-
- if (rval != KSUCCESS) {
- warnx("Kerberos sendauth error: %s", krb_err_txt[rval]);
- return (1);
- }
-
- krb_get_cred("krbtgt", realm, realm, &cred);
-
- (void)printf("Changing Kerberos password for %s.%s@%s.\n",
- cred.pname, cred.pinst, realm);
-
- if (des_read_pw_string(pass,
- sizeof(pass)-1, "Old Kerberos password:", 0)) {
- warnx("error reading old Kerberos password");
- return (1);
- }
-
- (void)des_string_to_key(pass, okey);
- (void)des_key_sched(okey, osched);
- (void)des_set_key(okey, osched);
-
- /* wait on the verification string */
-
- FD_ZERO(&readfds);
- FD_SET(sock, &readfds);
-
- rval =
- select(sock + 1, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout);
-
- if ((rval < 1) || !FD_ISSET(sock, &readfds)) {
- if(rval == 0) {
- warnx("timed out (aborted)");
- cleanup();
- return (1);
- }
- warnx("select failed (aborted)");
- cleanup();
- return (1);
- }
-
- /* read verification string */
-
- if (des_read(sock, &proto_data, sizeof(proto_data)) !=
- sizeof(proto_data)) {
- warnx("couldn't read verification string (aborted)");
- cleanup();
- return (1);
- }
-
- (void)signal(SIGHUP, finish);
- (void)signal(SIGINT, finish);
-
- if (strcmp(SECURE_STRING, proto_data.secure_msg) != 0) {
- cleanup();
- /* don't complain loud if user just hit return */
- if (pass == NULL || (!*pass))
- return (0);
- (void)fprintf(stderr, "Sorry\n");
- return (1);
- }
-
- (void)des_key_sched(proto_data.random_key, random_schedule);
- (void)des_set_key(proto_data.random_key, random_schedule);
- (void)memset(pass, 0, sizeof(pass));
-
- if (des_read_pw_string(pass,
- sizeof(pass)-1, "New Kerberos password:", 0)) {
- warnx("error reading new Kerberos password (aborted)");
- cleanup();
- return (1);
- }
-
- if (des_read_pw_string(password,
- sizeof(password)-1, "Retype new Kerberos password:", 0)) {
- warnx("error reading new Kerberos password (aborted)");
- cleanup();
- return (1);
- }
-
- if (strcmp(password, pass) != 0) {
- warnx("password mismatch (aborted)");
- cleanup();
- return (1);
- }
-
- if (strlen(pass) == 0)
- (void)printf("using NULL password\n");
-
- send_update(sock, password, SECURE_STRING);
-
- /* wait for ACK */
-
- FD_ZERO(&readfds);
- FD_SET(sock, &readfds);
-
- rval =
- select(sock + 1, &readfds, (fd_set *) 0, (fd_set *) 0, &timeout);
- if ((rval < 1) || !FD_ISSET(sock, &readfds)) {
- if(rval == 0) {
- warnx("timed out reading ACK (aborted)");
- cleanup();
- exit(1);
- }
- warnx("select failed (aborted)");
- cleanup();
- exit(1);
- }
- recv_ack(sock);
- cleanup();
- return (0);
-}
-
-static void
-send_update(dest, pwd, str)
- int dest;
- char *pwd, *str;
-{
- static struct update_data ud;
-
- (void)strncpy(ud.secure_msg, str, _PASSWORD_LEN);
- (void)strncpy(ud.pw, pwd, sizeof(ud.pw));
- if (des_write(dest, &ud, sizeof(ud)) != sizeof(ud)) {
- warnx("couldn't write pw update (abort)");
- memset((char *)&ud, 0, sizeof(ud));
- cleanup();
- exit(1);
- }
-}
-
-static void
-recv_ack(remote)
- int remote;
-{
- int cc;
- char buf[BUFSIZ];
-
- cc = des_read(remote, buf, sizeof(buf));
- if (cc <= 0) {
- warnx("error reading acknowledgement (aborted)");
- cleanup();
- exit(1);
- }
- (void)printf("%s", buf);
-}
-
-static void
-cleanup()
-{
-
- (void)memset((char *)&proto_data, 0, sizeof(proto_data));
- (void)memset((char *)okey, 0, sizeof(okey));
- (void)memset((char *)osched, 0, sizeof(osched));
- (void)memset((char *)random_schedule, 0, sizeof(random_schedule));
-}
-
-static void
-finish()
-{
-
- (void)close(sock);
- exit(1);
-}
-
-#endif /* KERBEROS */
diff --git a/usr.bin/patch/EXTERN.h b/usr.bin/patch/EXTERN.h
deleted file mode 100644
index 0271074..0000000
--- a/usr.bin/patch/EXTERN.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $Header: EXTERN.h,v 2.0 86/09/17 15:35:37 lwall Exp $
- *
- * $Log: EXTERN.h,v $
- * Revision 2.0 86/09/17 15:35:37 lwall
- * Baseline for netwide release.
- *
- */
-
-#undef EXT
-#define EXT extern
-
-#undef INIT
-#define INIT(x)
-
-#undef DOINIT
diff --git a/usr.bin/patch/INTERN.h b/usr.bin/patch/INTERN.h
deleted file mode 100644
index 8bf16f5..0000000
--- a/usr.bin/patch/INTERN.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $Header: INTERN.h,v 2.0 86/09/17 15:35:58 lwall Exp $
- *
- * $Log: INTERN.h,v $
- * Revision 2.0 86/09/17 15:35:58 lwall
- * Baseline for netwide release.
- *
- */
-
-#undef EXT
-#define EXT
-
-#undef INIT
-#define INIT(x) = x
-
-#define DOINIT
diff --git a/usr.bin/patch/config.h b/usr.bin/patch/config.h
deleted file mode 100644
index 9318fe7..0000000
--- a/usr.bin/patch/config.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#define Reg1 register /**/
-#define Reg2 register /**/
-#define Reg3 register /**/
-#define Reg4 register /**/
-#define Reg5 register /**/
-#define Reg6 register /**/
-#define Reg7 register /**/
-#define Reg8 register /**/
-#define Reg9 register /**/
-#define Reg10 register /**/
-#define Reg11 /**/
-#define Reg12 /**/
-#define Reg13 /**/
-#define Reg14 /**/
-#define Reg15 /**/
-#define Reg16 /**/
diff --git a/usr.bin/patch/patchlevel.h b/usr.bin/patch/patchlevel.h
deleted file mode 100644
index 618bca4..0000000
--- a/usr.bin/patch/patchlevel.h
+++ /dev/null
@@ -1 +0,0 @@
-#define PATCHLEVEL 9
diff --git a/usr.bin/patch/version.c b/usr.bin/patch/version.c
deleted file mode 100644
index 17dfb81..0000000
--- a/usr.bin/patch/version.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $Header: version.c,v 2.0 86/09/17 15:40:11 lwall Exp $
- *
- * $Log: version.c,v $
- * Revision 2.0 86/09/17 15:40:11 lwall
- * Baseline for netwide release.
- *
- */
-
-#include "EXTERN.h"
-#include "common.h"
-#include "util.h"
-#include "INTERN.h"
-#include "patchlevel.h"
-#include "version.h"
-
-/* Print out the version number and die. */
-
-void
-version()
-{
- extern char rcsid[];
-
-#ifdef lint
- rcsid[0] = rcsid[0];
-#else
- fatal3("%s\nPatch level: %d\n", rcsid, PATCHLEVEL);
-#endif
-}
diff --git a/usr.bin/patch/version.h b/usr.bin/patch/version.h
deleted file mode 100644
index 08fe68d..0000000
--- a/usr.bin/patch/version.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $Header: version.h,v 2.0 86/09/17 15:40:14 lwall Exp $
- *
- * $Log: version.h,v $
- * Revision 2.0 86/09/17 15:40:14 lwall
- * Baseline for netwide release.
- *
- */
-
-void version();
diff --git a/usr.bin/ranlib/ranlib.5.5 b/usr.bin/ranlib/ranlib.5.5
deleted file mode 100644
index e953c51..0000000
--- a/usr.bin/ranlib/ranlib.5.5
+++ /dev/null
@@ -1,70 +0,0 @@
-.\" Copyright (c) 1990, 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.
-.\"
-.\" @(#)ranlib.5.5 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt RANLIB 5
-.Os
-.Sh NAME
-.Nm ranlib
-.Nd archive (library) table-of-contents format
-.Sh SYNOPSIS
-.Fd #include <ranlib.h>
-.Sh DESCRIPTION
-The archive table-of-contents command
-.Nm ranlib
-creates a table of contents for archives, containing object files, to
-be used by the link-editor
-.Xr ld 1 .
-It operates on archives created with the utility
-.Xr ar 1 .
-.Pp
-The
-.Nm Ranlib
-function
-prepends a new file to the archive which has three separate parts.
-The first part is a standard archive header, which has a special name
-field, "__.SYMDEF".
-.Pp
-The second part is a ``long'' followed by a list of ranlib structures.
-The long is the size, in bytes, of the list of ranlib structures.
-Each of the ranlib structures consists of a zero based offset into the
-next section (a string table of symbols) and an offset from the beginning
-of the archive to the start of the archive file which defines the symbol.
-The actual number of ranlib structures is this number divided by the size
-of an individual ranlib structure.
-.Pp
-The third part is a ``long'' followed by a string table.
-The long is the size, in bytes of the string table.
-.Sh SEE ALSO
-.Xr ar 1 ,
-.Xr ranlib 1
diff --git a/usr.bin/rlogin/des_rw.c b/usr.bin/rlogin/des_rw.c
deleted file mode 100644
index dbe47f0..0000000
--- a/usr.bin/rlogin/des_rw.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)des_rw.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#ifdef CRYPT
-#ifdef KERBEROS
-#include <sys/param.h>
-
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-static unsigned char des_inbuf[10240], storage[10240], *store_ptr;
-static bit_64 *key;
-static u_char *key_schedule;
-
-/* XXX these should be in a kerberos include file */
-int krb_net_read __P((int, char *, int));
-#ifdef notdef
-/* XXX too hard to make this work */
-int des_pcbc_encrypt __P((des_cblock *, des_cblock *, long,
- des_key_schedule, des_cblock *, int));
-#endif
-
-/*
- * NB: These routines will not function properly if NBIO
- * is set
- */
-
-/*
- * des_set_key
- *
- * Set des encryption/decryption key for use by the des_read and
- * des_write routines
- *
- * The inkey parameter is actually the DES initial vector,
- * and the insched is the DES Key unwrapped for faster decryption
- */
-
-void
-des_set_key(inkey, insched)
- bit_64 *inkey;
- u_char *insched;
-{
- key = inkey;
- key_schedule = insched;
-}
-
-void
-des_clear_key()
-{
- bzero((char *) key, sizeof(C_Block));
- bzero((char *) key_schedule, sizeof(Key_schedule));
-}
-
-
-int
-des_read(fd, buf, len)
- int fd;
- register char *buf;
- int len;
-{
- int nreturned = 0;
- long net_len, rd_len;
- int nstored = 0;
-
- if (nstored >= len) {
- (void) bcopy(store_ptr, buf, len);
- store_ptr += len;
- nstored -= len;
- return(len);
- } else if (nstored) {
- (void) bcopy(store_ptr, buf, nstored);
- nreturned += nstored;
- buf += nstored;
- len -= nstored;
- nstored = 0;
- }
-
- if (krb_net_read(fd, (char *)&net_len, sizeof(net_len)) !=
- sizeof(net_len)) {
- /* XXX can't read enough, pipe
- must have closed */
- return(0);
- }
- net_len = ntohl(net_len);
- if (net_len <= 0 || net_len > sizeof(des_inbuf)) {
- /* preposterous length; assume out-of-sync; only
- recourse is to close connection, so return 0 */
- return(0);
- }
- /* the writer tells us how much real data we are getting, but
- we need to read the pad bytes (8-byte boundary) */
- rd_len = roundup(net_len, 8);
- if (krb_net_read(fd, (char *)des_inbuf, rd_len) != rd_len) {
- /* pipe must have closed, return 0 */
- return(0);
- }
- (void) des_pcbc_encrypt(des_inbuf, /* inbuf */
- storage, /* outbuf */
- net_len, /* length */
- key_schedule, /* DES key */
- key, /* IV */
- DECRYPT); /* direction */
-
- if(net_len < 8)
- store_ptr = storage + 8 - net_len;
- else
- store_ptr = storage;
-
- nstored = net_len;
- if (nstored > len) {
- (void) bcopy(store_ptr, buf, len);
- nreturned += len;
- store_ptr += len;
- nstored -= len;
- } else {
- (void) bcopy(store_ptr, buf, nstored);
- nreturned += nstored;
- nstored = 0;
- }
-
- return(nreturned);
-}
-
-static unsigned char des_outbuf[10240]; /* > longest write */
-
-int
-des_write(fd, buf, len)
- int fd;
- char *buf;
- int len;
-{
- static int seeded = 0;
- static char garbage_buf[8];
- long net_len, garbage;
-
- if(len < 8) {
- if(!seeded) {
- seeded = 1;
- srandom((int) time((long *)0));
- }
- garbage = random();
- /* insert random garbage */
- (void) bcopy(&garbage, garbage_buf, MIN(sizeof(long),8));
- /* this "right-justifies" the data in the buffer */
- (void) bcopy(buf, garbage_buf + 8 - len, len);
- }
- /* pcbc_encrypt outputs in 8-byte (64 bit) increments */
-
- (void) des_pcbc_encrypt((len < 8) ? garbage_buf : buf,
- des_outbuf,
- (len < 8) ? 8 : len,
- key_schedule, /* DES key */
- key, /* IV */
- ENCRYPT);
-
- /* tell the other end the real amount, but send an 8-byte padded
- packet */
- net_len = htonl(len);
- (void) write(fd, &net_len, sizeof(net_len));
- (void) write(fd, des_outbuf, roundup(len,8));
- return(len);
-}
-#endif /* KERBEROS */
-#endif /* CRYPT */
diff --git a/usr.bin/sccs/Makefile b/usr.bin/sccs/Makefile
deleted file mode 100644
index 0ee9d1b..0000000
--- a/usr.bin/sccs/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= sccs
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/sccs/PSD.doc/Makefile b/usr.bin/sccs/PSD.doc/Makefile
deleted file mode 100644
index 4d2ba7f..0000000
--- a/usr.bin/sccs/PSD.doc/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/8/93
-
-DIR= psd/14.sccs
-SRCS= sccs.me
-MACROS= -me
-
-paper.ps: ${SRCS}
- ${ROFF} ${SRCS} > ${.TARGET}
-
-.include <bsd.doc.mk>
diff --git a/usr.bin/sccs/PSD.doc/sccs.me b/usr.bin/sccs/PSD.doc/sccs.me
deleted file mode 100644
index ab598c2..0000000
--- a/usr.bin/sccs/PSD.doc/sccs.me
+++ /dev/null
@@ -1,1608 +0,0 @@
-.\" Copyright (c) 1986, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. 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.
-.\"
-.\" @(#)sccs.me 8.1 (Berkeley) 6/8/93
-.\"
-.eh '\fRPSD:14-%\fP''\fRAn Introduction to the Source Code Control System\fP'
-.oh '\fRAn Introduction to the Source Code Control System\fP''\fRPSD:14-%\fP'
-.ds S \s-1SCCS\s0
-.ds I \s-1SID\s0
-.nr bi 8n
-.ev 1 \" only for keeps
-.ss 16
-.ev
-.\".he '\*S Introduction''%'
-.+c
-.(l C
-.sz 14
-.b
-An Introduction to the
-Source Code Control System
-.sz
-.r
-.sp
-Eric Allman
-.i "Project Ingres"
-.i "University of California at Berkeley"
-.)l
-.sp 3
-.pp
-.(f
-This is version 1.21 of this document.
-It was last modified on 12/5/80.
-.)f
-This document gives a quick introduction
-to using the Source Code Control System
-(\*S).
-The presentation is geared to programmers
-who are more concerned with
-what
-to do to get a task done
-rather than how it works;
-for this reason some of the examples
-are not well explained.
-For details of what the magic options do,
-see the section on
-.q "Further Information" .
-.(l F
-This is a working document.
-Please send any comments or suggestions
-to eric@Berkeley.Edu.
-.)l
-.sh 1 "Introduction"
-.pp
-\*S is a source management system.
-Such a system maintains a record of versions of a system;
-a record is kept with each set of changes
-of what the changes are,
-why they were made,
-and who made them and when.
-Old versions can be recovered,
-and different versions can be maintained simultaneously.
-In projects with more than one person,
-\*S will insure that two people are not
-editing the same file at the same time.
-.pp
-All versions of your program,
-plus the log and other information,
-is kept in a file called the
-.q "s-file" .
-There are three major operations
-that can be performed on the s-file:
-.np
-Get a file for compilation (not for editing).
-This operation retrieves a version of the file
-from the s-file.
-By default, the latest version is retrieved.
-This file is intended for compilation, printing, or whatever;
-it is specifically NOT intended to be edited
-or changed in any way;
-any changes made to a file retrieved
-in this way will probably be lost.
-.np
-Get a file for editing.
-This operation also retrieves a version of the file
-from the s-file,
-but this file is intended to be edited and then
-incorporated back into the s-file.
-Only one person may be editing a file at one time.
-.np
-Merge a file back into the s-file.
-This is the companion operation to (2).
-A new version number is assigned,
-and comments are saved explaining why this change was made.
-.sh 1 "Learning the Lingo"
-.pp
-There are a number of terms that are worth learning
-before we go any farther.
-.sh 2 "S-file"
-.pp
-The s-file
-is a single file that holds all the different versions
-of your file.
-The s-file is stored in
-differential format;
-.i i.e. ,
-only the differences between versions are stored,
-rather than the entire text of the new version.
-This saves disk space
-and allows selective changes to be removed later.
-Also included in the s-file
-is some header information for each version,
-including the comments given by the person who
-created the version explaining why the changes were made.
-.sh 2 "Deltas"
-.pp
-Each set of changes to the s-file
-(which is approximately [but not exactly!] equivalent
-to a version of the file)
-is called a
-.i delta .
-Although technically a delta only includes the
-.i changes
-made,
-in practice
-it is usual for
-each delta to be made with respect to
-all the deltas that have occurred before\**.
-.(f
-\**This matches normal usage, where the previous changes are not saved
-at all,
-so all changes are automatically based on all other changes
-that have happened through history.
-.)f
-However,
-it is possible to get a version of the file
-that has selected deltas removed out of the middle
-of the list of changes \*-
-equivalent to removing your changes later.
-.sh 2 "\*I's (or, version numbers)"
-.pp
-A \*I
-(\*S Id)
-is a number that represents a delta.
-This is normally a two-part number
-consisting of a
-.q release
-number and a
-.q level
-number.
-Normally the release number stays the same,
-however,
-it is possible to move into a new release
-if some major change is being made.
-.pp
-Since all past deltas are normally applied,
-the \*I of the final delta applied
-can be used to represent a version number of the file
-as a whole.
-.sh 2 "Id keywords"
-.pp
-When you get a version of a file
-with intent to compile and install it
-(\c
-.i i.e. ,
-something other than edit it),
-some special keywords are expanded inline
-by \*S.
-These
-.i "Id Keywords"
-can be used to include the current version number
-or other information into the file.
-All id keywords are of the form
-.b % \c
-.i x \c
-.b % ,
-where
-.i x
-is an upper case letter.
-For example,
-.b %\&I\&%
-is the \*I of the latest delta applied,
-.b %\&W\&%
-includes the module name,
-\*I,
-and a mark that makes it findable by a program,
-and
-.b %\&G\&%
-is the date of the latest delta applied.
-There are many others,
-most of which are of dubious usefulness.
-.pp
-When you get a file for editing,
-the id keywords are not expanded;
-this is so that after you put them back in to the s-file,
-they will be expanded automatically on each new version.
-But notice: if you were to get them
-expanded accidently,
-then your file would appear to be the same version
-forever more,
-which would of course defeat the purpose.
-Also,
-if you should install a version of the program
-without expanding the id keywords,
-it will be impossible to tell what version it is
-(since all it will have is
-.q %\&W\&%
-or whatever).
-.sh 1 "Creating \*S Files"
-.pp
-To put source files
-into
-\*S
-format, run the following shell script from csh:
-.(b
-mkdir SCCS save
-foreach i (*.[ch])
- sccs admin \-i$i $i
- mv $i save/$i
-end
-.)b
-This will put the named files
-into s-files
-in the subdirectory
-.q SCCS
-The files will be removed from the current directory
-and hidden away in the directory
-.q save ,
-so the next thing you will probably want to do
-is to get all the files
-(described below).
-When you are convinced that
-\*S has correctly created the s-files,
-you should remove the directory
-.q save .
-.pp
-If you want to have id keywords in the files,
-it is best to put them in before you create the s-files.
-If you do not,
-.i admin
-will print
-.q "No Id Keywords (cm7)" ,
-which is a warning message only.
-.sh 1 "Getting Files for Compilation"
-.pp
-To get a copy of the latest version
-of a file,
-run
-.(b
-sccs get prog.c
-.)b
-\*S will respond:
-.(b
-1.1
-87 lines
-.)b
-meaning that version 1.1 was retrieved\**
-.(f
-\**Actually,
-the \*I of the final delta applied was 1.1.
-.)f
-and that it has 87 lines.
-The file
-.i prog.c
-will be created
-in the current directory.
-The file will be read-only
-to remind you that you are not
-supposed to change it.
-.pp
-This copy of the file
-should not be changed,
-since \*S is unable
-to merge the changes
-back into the s-file.
-If you do make changes,
-they will be lost the next time
-someone does a
-.i get .
-.sh 1 "Changing Files (or, Creating Deltas)"
-.sh 2 "Getting a copy to edit"
-.pp
-To edit a source file,
-you must first get it,
-requesting permission to edit it\**:
-.(f
-\**The
-.q "edit"
-command is equivalent to using the \-e
-flag to
-.i "get" ,
-as:
-.(l
-sccs get \-e prog.c
-.)l
-Keep this in mind when reading other documentation.
-.)f
-.(b
-sccs edit prog.c
-.)b
-The response will be the same as with
-.i get
-except that it will also say:
-.(b
-New delta 1.2
-.)b
-You then edit it,
-using a standard text editor:
-.(b
-vi prog.c
-.)b
-.sh 2 "Merging the changes back into the s-file"
-.pp
-When the desired changes are made,
-you can put your changes into the
-\*S
-file using the
-.i delta
-command:
-.(b
-sccs delta prog.c
-.)b
-.pp
-Delta will prompt you for
-.q "comments?"
-before it merges the changes in.
-At this prompt you should type a one-line description
-of what the changes mean
-(more lines can be entered by ending each line
-except the last with a backslash\**).
-.(f
-\**Yes, this is a stupid default.
-.)f
-.i Delta
-will then type:
-.(b
-1.2
-5 inserted
-3 deleted
-84 unchanged
-.)b
-saying that delta 1.2 was created,
-and it inserted five lines,
-removed three lines,
-and left 84 lines unchanged\**.
-.(f
-\**Changes to a line are counted as a line deleted
-and a line inserted.
-.)f
-The
-.i prog.c
-file will be removed;
-it can be retrieved
-using
-.i get .
-.sh 2 "When to make deltas"
-.pp
-It is probably unwise to make a delta
-before every recompilation or test;
-otherwise,
-you tend to get a lot of deltas with comments like
-.q "fixed compilation problem in previous delta"
-or
-.q "fixed botch in 1.3" .
-However,
-it is very important to delta everything
-before installing a module for general use.
-A good technique is to edit the files you need,
-make all necessary changes and tests,
-compiling and editing as often as necessary
-without making deltas.
-When you are satisfied that you have a working version,
-delta everything being edited,
-re-get them,
-and recompile everything.
-.sh 2 "What's going on: the info command"
-.pp
-To find out what files where being edited,
-you can use:
-.(b
-sccs info
-.)b
-to print out all the files being edited
-and other information such as the name of the user
-who did the edit.
-Also,
-the command:
-.(b
-sccs check
-.)b
-is nearly equivalent to the
-.i info
-command,
-except that it is silent if nothing is being edited,
-and returns non-zero exit status if anything is being edited;
-it can be used in an
-.q install
-entry in a makefile
-to abort the install
-if anything has not been properly deltaed.
-.pp
-If you know that everything being edited should be deltaed,
-you can use:
-.(b
-sccs delta \`sccs tell\`
-.)b
-The
-.i tell
-command is similar to
-.i info
-except that only the names of files being edited
-are output,
-one per line.
-.pp
-All of these commands take a
-.b \-b
-flag
-to ignore
-.q branches
-(alternate versions, described later)
-and the
-.b \-u
-flag to only give files being edited by you.
-The
-.b \-u
-flag takes an optional
-.i user
-argument,
-giving only files being edited by that user.
-For example,
-.(b
-sccs info \-ujohn
-.)b
-gives a listing of files being edited by john.
-.sh 2 "ID keywords"
-.pp
-Id keywords can be inserted into your file
-that will be expanded automatically by
-.i get .
-For example,
-a line such as:
-.(b
-static char SccsId[] = "%\&W\&%\et%\&G\&%";
-.)b
-will be replaced with something like:
-.(b
-static char SccsId[] = "@\&(#)prog.c 1.2 08/29/80";
-.)b
-This tells you
-the name and version
-of the source file
-and the time the delta was created.
-The string
-.q "@\&(#)"
-is a special string
-which signals the beginning
-of an
-\*S
-Id keyword.
-.sh 3 "The what command"
-.pp
-To find out what version of a program
-is being run,
-use:
-.(b
-sccs what prog.c /usr/bin/prog
-.)b
-which will print all strings
-it finds that
-begin with
-.q "@\&(#)" .
-This works on all types of files,
-including binaries and libraries.
-For example, the above command will output something like:
-.(b
-prog.c:
- prog.c 1.2 08/29/80
-/usr/bin/prog:
- prog.c 1.1 02/05/79
-.)b
-From this I can see
-that the source that I have in prog.c
-will not compile into the same version
-as the binary in /usr/bin/prog.
-.sh 3 "Where to put id keywords"
-.pp
-ID keywords can be inserted anywhere,
-including in comments,
-but
-Id Keywords that are compiled into the object module
-are especially useful,
-since it lets you find out what version of
-the object is being run,
-as well as the source.
-However,
-there is a cost:
-data space is used up to store
-the keywords,
-and on small address space machines
-this may be prohibitive.
-.pp
-When you put id keywords into header files,
-it is important that you assign them to different variables.
-For example, you might use:
-.(b
-static char AccessSid[] = "%\&W\&% %\&G\&%";
-.)b
-in the file
-.i access.h
-and:
-.(b
-static char OpsysSid[] = "%\&W\&% %\&G\&%";
-.)b
-in the file
-.i opsys.h .
-Otherwise,
-you will get compilation errors because
-.q SccsId
-is redefined.
-The problem with this is that if the header file
-is included by many modules that are loaded together,
-the version number of that header file is included
-in the object module many times;
-you may find it more to your taste
-to put id keywords in header files
-in comments.
-.sh 2 "Keeping \*I's consistent across files"
-.pp
-With some care,
-it is possible to keep the \*I's consistent
-in multi-file systems.
-The trick here is to always
-.i edit
-all files
-at once.
-The changes can then be made
-to whatever files are necessary
-and then all files
-(even those not changed)
-are redeltaed.
-This can be done fairly easily
-by just specifying the name of the directory
-that the \*S files are in:
-.(b
-sccs edit SCCS
-.)b
-which will
-.i edit
-all files in that directory.
-To make the delta, use:
-.(b
-sccs delta SCCS
-.)b
-You will be prompted for comments only once.
-.sh 2 "Creating new releases"
-.pp
-When you want to create a new release
-of a program,
-you can specify the release number you want to create
-on the
-.i edit
-command.
-For example:
-.(b
-sccs edit \-r2 prog.c
-.)b
-will cause the next delta to be in release two
-(that is,
-it will be numbered 2.1).
-Future deltas will automatically be in release two.
-To change the release number
-of an entire system,
-use:
-.(b
-sccs edit \-r2 SCCS
-.)b
-.sh 1 "Restoring Old Versions"
-.sh 2 "Reverting to old versions"
-.pp
-Suppose that after delta 1.2
-was stable
-you made and released a delta 1.3.
-But this introduced a bug,
-so you made a delta 1.4 to correct it.
-But 1.4 was still buggy,
-and you decided you wanted to go back
-to the old version.
-You could
-revert to delta 1.2
-by choosing the \*I in a get:
-.(b
-sccs get \-r1.2 prog.c
-.)b
-This will produce a version of
-.i prog.c
-that is delta 1.2
-that can be reinstalled so that work can proceed.
-.pp
-In some cases you don't know
-what the \*I of the delta you want is.
-However,
-you can revert to the version of the program
-that was running as of a certain date
-by using the
-.b \-c
-(cutoff) flag.
-For example,
-.(b
-sccs get \-c800722120000 prog.c
-.)b
-will retrieve whatever version was current
-as of July 22, 1980
-at 12:00 noon.
-Trailing components can be stripped off
-(defaulting to their highest legal value),
-and punctuation can be inserted in the obvious
-places;
-for example,
-the above line could be equivalently stated:
-.(b
-sccs get \-c"80/07/22 12:00:00" prog.c
-.)b
-.sh 2 "Selectively deleting old deltas"
-.pp
-Suppose that you later decided
-that you liked the changes in delta 1.4,
-but that delta 1.3 should be removed.
-You could do this by
-.i excluding
-delta 1.3:
-.(b
-sccs edit \-x1.3 prog.c
-.)b
-When delta 1.5 is made,
-it will include the changes made
-in delta 1.4,
-but will exclude the changes made
-in delta 1.3.
-You can exclude a range of deltas
-using a dash.
-For example,
-if you want to get rid of 1.3 and 1.4
-you can use:
-.(b
-sccs edit \-x1.3\-1.4 prog.c
-.)b
-which will exclude all deltas from 1.3 to 1.4.
-Alternatively,
-.(b
-sccs edit \-x1.3\-1 prog.c
-.)b
-will exclude a range of deltas
-from 1.3 to the current highest delta in release 1.
-.pp
-In certain cases when using
-.b \-x
-(or
-.b \-i ;
-see below)
-there will be conflicts
-between versions;
-for example, it may be necessary
-to both include and delete
-a particular line.
-If this happens,
-\*S always prints out a message
-telling the range of lines effected;
-these lines should then be examined very carefully
-to see if the version \*S got
-is ok.
-.pp
-Since each delta
-(in the sense of
-.q "a set of changes" )
-can be excluded at will,
-that this makes it most useful
-to put each semantically distinct change
-into its own delta.
-.sh 1 "Auditing Changes"
-.sh 2 "The prt command"
-.pp
-When you created a delta,
-you presumably gave a reason for the delta
-to the
-.q "comments?"
-prompt.
-To print out these comments later,
-use:
-.(b
-sccs prt prog.c
-.)b
-This will produce
-a report
-for each delta
-of the \*I,
-time and date of creation,
-user who created the delta,
-number of lines inserted, deleted, and unchanged,
-and the comments associated with the delta.
-For example, the output of the above command might be:
-.(b
-D 1.2 80/08/29 12:35:31 bill 2 1 00005/00003/00084
-removed "-q" option
-.sp \n(psu
-D 1.1 79/02/05 00:19:31 eric 1 0 00087/00000/00000
-date and time created 80/06/10 00:19:31 by eric
-.)b
-.sh 2 "Finding why lines were inserted"
-.pp
-To find out
-why you inserted lines,
-you can get a copy of the file
-with each line
-preceded by the \*I that created it:
-.(b
-sccs get \-m prog.c
-.)b
-You can then find out
-what this delta did
-by printing the comments using
-.i prt .
-.pp
-To find out what lines are associated with a particular delta
-(\c
-.i e.g. ,
-1.3),
-use:
-.(b
-sccs get \-m \-p prog.c \(bv grep \'^1.3\'
-.)b
-The
-.b \-p
-flag causes \*S to output the generated source
-to the standard output rather than to a file.
-.sh 2 "Finding what changes you have made"
-.pp
-When you are editing a file,
-you can find out what changes you have made using:
-.(b
-sccs diffs prog.c
-.)b
-Most of the ``diff'' flags can be used.
-To pass the
-.b \-c
-flag,
-use
-.b \-C .
-.pp
-To compare two versions that are in deltas,
-use:
-.(b
-sccs sccsdiff -r1.3 -r1.6 prog.c
-.)b
-to see the differences between delta 1.3 and delta 1.6.
-.sh 1 "Shorthand Notations"
-.pp
-There are several sequences of commands that get
-executed frequently.
-.i Sccs
-tries to make it easy to do these.
-.sh 2 "Delget"
-.pp
-A frequent requirement is to make a delta of some file
-and then get that file.
-This can be done by using:
-.(b
-sccs delget prog.c
-.)b
-which is entirely equivalent to using:
-.(b
-sccs delta prog.c
-sccs get prog.c
-.)b
-The
-.q deledit
-command is equivalent to
-.q delget
-except that the
-.q edit
-command is used
-instead of the
-.q get
-command.
-.sh 2 "Fix"
-.pp
-Frequently, there are small bugs
-in deltas,
-e.g., compilation errors,
-for which there is no reason to maintain an audit trail.
-To
-.i replace
-a delta, use:
-.(b
-sccs fix \-r1.4 prog.c
-.)b
-This will get a copy of delta 1.4 of prog.c for you to edit
-and then delete delta 1.4 from the \*S file.
-When you do a delta of prog.c,
-it will be delta 1.4 again.
-The \-r flag must be specified,
-and the delta that is specified must be a leaf delta,
-i.e., no other deltas may have been made subsequent
-to the creation of that delta.
-.sh 2 "Unedit"
-.pp
-If you found you edited a file
-that you did not want to edit,
-you can back out by using:
-.(b
-sccs unedit prog.c
-.)b
-.sh 2 "The \-d flag"
-.pp
-If you are working on a project
-where the \*S code is in a directory somewhere,
-you may be able to simplify things
-by using a shell alias.
-For example,
-the alias:
-.(b
-alias syssccs sccs \-d/usr/src
-.)b
-will allow you to issue commands such as:
-.(b
-syssccs edit cmd/who.c
-.)b
-which will look for the file
-.q "/usr/src/cmd/SCCS/who.c" .
-The file
-.q who.c
-will always be created in your current directory
-regardless of the value of the \-d flag.
-.sh 1 "Using \*S on a Project"
-.pp
-Working on a project with several people
-has its own set of special problems.
-The main problem occurs when two people
-modify a file at the same time.
-\*S prevents this by locking an s-file
-while it is being edited.
-.pp
-As a result,
-files should not be reserved for editing
-unless they are actually being edited at the time,
-since this will prevent other people on the project
-from making necessary changes.
-For example,
-a good scenario for working might be:
-.(b
-sccs edit a.c g.c t.c
-vi a.c g.c t.c
-# do testing of the (experimental) version
-sccs delget a.c g.c t.c
-sccs info
-# should respond "Nothing being edited"
-make install
-.)b
-.pp
-As a general rule,
-all source files should be deltaed
-before installing the program for general use.
-This will insure that it is possible
-to restore any version in use at any time.
-.sh 1 "Saving Yourself"
-.sh 2 "Recovering a munged edit file"
-.pp
-Sometimes you may find
-that you have destroyed or trashed
-a file that you were trying to edit\**.
-.(f
-\**Or given up and decided to start over.
-.)f
-Unfortunately,
-you can't just remove it
-and re-\c
-.i edit
-it;
-\*S keeps track
-of the fact
-that someone is trying to edit it,
-so it won't let you do it again.
-Neither can you just get it using
-.i get ,
-since that would expand the Id keywords.
-Instead,
-you can say:
-.(b
-sccs get \-k prog.c
-.)b
-This will not expand the Id keywords,
-so it is safe to do a delta
-with it.
-.pp
-Alternately,
-you can
-.i unedit
-and
-.i edit
-the file.
-.sh 2 "Restoring the s-file"
-.pp
-In particularly bad circumstances,
-the \*S file itself
-may get munged.
-The most common way this happens
-is that it gets edited.
-Since \*S keeps a checksum,
-you will get errors every time you read the file.
-To fix this checksum, use:
-.(b
-sccs admin \-z prog.c
-.)b
-.sh 1 "Using the Admin Command"
-.pp
-There are a number of parameters that can be set
-using the
-.i admin
-command.
-The most interesting of these are flags.
-Flags can be added by using the
-.b \-f
-flag.
-For example:
-.(b
-sccs admin \-fd1 prog.c
-.)b
-sets the
-.q d
-flag to the value
-.q 1 .
-This flag can be deleted by using:
-.(b
-sccs admin \-dd prog.c
-.)b
-The most useful flags are:
-.nr ii 7n
-.ip "b"
-Allow branches to be made using the
-\-b
-flag to
-.i edit .
-.ip "d\fISID\fP"
-Default \*I to be used on a
-.i get
-or
-.i edit .
-If this is just a release number
-it constrains the
-version
-to a particular release only.
-.ip "i"
-Give a fatal error
-if there are no Id Keywords in a file.
-This is useful to guarantee that a version of the
-file does not get merged into the s-file
-that has the Id Keywords inserted as constants
-instead of internal forms.
-.ip "y"
-The
-.q type
-of the module.
-Actually,
-the value of this flag is unused by \*S
-except that it replaces the
-.b %\&Y\&%
-keyword.
-.pp
-The
-.b \-t\fIfile\fR
-flag can be used
-to store descriptive text
-from
-.i file .
-This descriptive text might be the documentation
-or a design and implementation document.
-Using the
-.b \-t
-flag insures that if the \*S file is sent,
-the documentation will be sent also.
-If
-.i file
-is omitted,
-the descriptive text is deleted.
-To see the descriptive text,
-use
-.q "prt \-t" .
-.pp
-The
-.i admin
-command can be used safely
-any number of times on files.
-A file need not be gotten
-for
-.i admin
-to work.
-.sh 1 "Maintaining Different Versions (Branches)"
-.pp
-Sometimes it is convenient
-to maintain an experimental version of a program
-for an extended period
-while normal maintenance continues
-on the version in production.
-This can be done using a
-.q branch.
-Normally deltas continue in a straight line,
-each depending on the delta before.
-Creating a branch
-.q "forks off"
-a version of the program.
-.pp
-The ability to create branches
-must be enabled in advance using:
-.(b
-sccs admin \-fb prog.c
-.)b
-The
-.b \-fb
-flag can be specified when the
-\*S file is first created.
-.sh 2 "Creating a branch"
-.pp
-To create a branch, use:
-.(b
-sccs edit \-b prog.c
-.)b
-This will create a branch
-with (for example) \*I 1.5.1.1.
-The deltas for this version
-will be numbered
-1.5.1.\c
-.i n .
-.sh 2 "Getting from a branch"
-.pp
-Deltas in a branch are normally not included
-when you do a get.
-To get these versions,
-you will have to say:
-.(b
-sccs get \-r1.5.1 prog.c
-.)b
-.sh 2 "Merging a branch back into the main trunk"
-.pp
-At some point you will have finished the experiment,
-and if it was successful
-you will want to incorporate it into the release version.
-But in the meantime
-someone may have created a delta 1.6
-that you don't want to lose.
-The commands:
-.(b
-sccs edit \-i1.5.1.1\-1.5.1 prog.c
-sccs delta prog.c
-.)b
-will merge all of your changes
-into the release system.
-If some of the changes conflict,
-get will print an error;
-the generated result
-should be carefully examined
-before the delta is made.
-.sh 2 "A more detailed example"
-.pp
-The following technique might be used
-to maintain a different version of a program.
-First,
-create a directory to contain the new version:
-.(b
-mkdir ../newxyz
-cd ../newxyz
-.)b
-Edit a copy of the program
-on a branch:
-.(b
-sccs \-d../xyz edit prog.c
-.)b
-When using the old version,
-be sure to use the
-.b \-b
-flag to info, check, tell, and clean
-to avoid confusion.
-For example, use:
-.(b
-sccs info \-b
-.)b
-when in the directory
-.q xyz .
-.pp
-If you want to save a copy of the program
-(still on the branch)
-back in the s-file,
-you can use:
-.(b
-sccs -d../xyz deledit prog.c
-.)b
-which will do a delta on the branch
-and reedit it for you.
-.pp
-When the experiment is complete, merge it back into the s-file
-using delta:
-.(b
-sccs -d../xyz delta prog.c
-.)b
-At this point you must decide whether this version
-should be merged back into the trunk
-(\c
-.i i.e.
-the default version),
-which may have undergone changes.
-If so, it can be merged using the
-.b \-i
-flag to
-.i edit
-as described above.
-.sh 2 "A warning"
-.pp
-Branches should be kept to a minimum.
-After the first branch from the trunk,
-\*I's are assigned rather haphazardly,
-and the structure gets complex fast.
-.sh 1 "Using \*S with Make"
-.pp
-\*S and make can be made to work together
-with a little care.
-A few sample makefiles
-for common applications are shown.
-.pp
-There are a few basic entries that every makefile
-ought to have.
-These are:
-.nr ii 1i
-.ip a.out
-(or whatever the makefile generates.)
-This entry regenerates whatever this makefile is
-supposed to regenerate.
-If the makefile regenerates many things,
-this should be called
-.q all
-and should in turn
-have dependencies on everything
-the makefile can generate.
-.ip install
-Moves the objects to the final
-resting place,
-doing any special
-.i chmod 's
-or
-.i ranlib 's
-as appropriate.
-.ip sources
-Creates all the source files from \*S files.
-.ip clean
-Removes all files from the current directory
-that can be regenerated from \*S files.
-.ip print
-Prints the contents of the directory.
-.lp
-The examples shown below are only partial examples,
-and may omit some of these entries
-when they are deemed to be obvious.
-.pp
-The
-.i clean
-entry should not remove files that can be
-regenerated from the \*S files.
-It is sufficiently important to have the
-source files around at all times
-that the only time they should be removed
-is when the directory is being mothballed.
-To do this, the command:
-.(b
-sccs clean
-.)b
-can be used.
-This will remove all files for which an s-file
-exists,
-but which is not being edited.
-.sh 2 "To maintain single programs"
-.pp
-Frequently there are directories with several
-largely unrelated programs
-(such as simple commands).
-These can be put into a single makefile:
-.(b
-LDFLAGS= \-i \-s
-.sp \n(psu
-prog: prog.o
- $(CC) $(LDFLAGS) \-o prog prog.o
-prog.o: prog.c prog.h
-.sp \n(psu
-example: example.o
- $(CC) $(LDFLAGS) \-o example example.o
-example.o: example.c
-.sp \n(psu
-\&.DEFAULT:
- sccs get $<
-.)b
-The trick here
-is that the .DEFAULT rule
-is called every time
-something is needed
-that does not exist,
-and no other rule exists to make it.
-The explicit dependency of the
-.b \&.o
-file on the
-.b \&.c
-file is important.
-Another way of doing the same thing is:
-.(b
-SRCS= prog.c prog.h example.c
-.sp \n(psu
-LDFLAGS= \-i \-s
-.sp \n(psu
-prog: prog.o
- $(CC) $(LDFLAGS) \-o prog prog.o
-prog.o: prog.h
-.sp \n(psu
-example: example.o
- $(CC) $(LDFLAGS) \-o example example.o
-.sp \n(psu
-sources: $(SRCS)
-$(SRCS):
- sccs get $@
-.)b
-There are a couple of advantages to this approach:
-(1) the explicit dependencies of the .o on the .c files are
-not needed,
-(2) there is an entry called "sources" so if you want to get
-all the sources you can just say
-.q "make sources" ,
-and
-(3) the makefile is less likely to do confusing things
-since it won't try to
-.i get
-things that do not exist.
-.sh 2 "To maintain a library"
-.pp
-Libraries that are largely static
-are best updated using explicit commands,
-since
-.i make
-doesn't know about updating them properly.
-However,
-libraries that are in the process of being developed
-can be handled quite adequately.
-The problem is that the .o files
-have to be kept out of the library
-as well as in the library.
-.(b
-# configuration information
-OBJS= a.o b.o c.o d.o
-SRCS= a.c b.c c.c d.s x.h y.h z.h
-TARG= /usr/lib
-.sp \n(psu
-# programs
-GET= sccs get
-REL=
-AR= \-ar
-RANLIB= ranlib
-.sp \n(psu
-lib.a: $(OBJS)
- $(AR) rvu lib.a $(OBJS)
- $(RANLIB) lib.a
-.sp \n(psu
-install: lib.a
- sccs check
- cp lib.a $(TARG)/lib.a
- $(RANLIB) $(TARG)/lib.a
-.sp \n(psu
-sources: $(SRCS)
-$(SRCS):
- $(GET) $(REL) $@
-.sp \n(psu
-print: sources
- pr *.h *.[cs]
-clean:
- rm \-f *.o
- rm \-f core a.out $(LIB)
-.)b
-.pp
-The
-.q "$(REL)"
-in the get
-can be used to get old versions
-easily; for example:
-.(b
-make b.o REL=\-r1.3
-.)b
-.pp
-The
-.i install
-entry includes the line
-.q "sccs check"
-before anything else.
-This guarantees that all the s-files
-are up to date
-(\c
-.i i.e. ,
-nothing is being edited),
-and will abort the
-.i make
-if this condition is not met.
-.sh 2 "To maintain a large program"
-.(b
-OBJS= a.o b.o c.o d.o
-SRCS= a.c b.c c.y d.s x.h y.h z.h
-.sp \n(psu
-GET= sccs get
-REL=
-.sp \n(psu
-a.out: $(OBJS)
- $(CC) $(LDFLAGS) $(OBJS) $(LIBS)
-.sp \n(psu
-sources: $(SRCS)
-$(SRCS):
- $(GET) $(REL) $@
-.)b
-(The
-.i print
-and
-.i clean
-entries are identical to the previous case.)
-This makefile requires copies of the source and object files
-to be kept during development.
-It is probably also wise to include lines of the form:
-.(b
-a.o: x.h y.h
-b.o: z.h
-c.o: x.h y.h z.h
-z.h: x.h
-.)b
-so that modules will be recompiled
-if header files change.
-.pp
-Since
-.i make
-does not do transitive closure on dependencies,
-you may find in some makefiles lines like:
-.(b
-z.h: x.h
- touch z.h
-.)b
-This would be used in cases where file z.h
-has a line:
-.(b
-#include "x.h"
-.)b
-in order to bring the mod date of z.h in line
-with the mod date of x.h.
-When you have a makefile such as above,
-the
-.i touch
-command can be removed completely;
-the equivalent effect will be achieved
-by doing an automatic
-.i get
-on z.h.
-.sh 1 "Further Information"
-.pp
-The
-.i "SCCS/PWB User's Manual"
-gives a deeper description
-of how to use \*S.
-Of particular interest
-are the numbering of branches,
-the l-file,
-which gives a description of what deltas were used on a get,
-and certain other \*S commands.
-.pp
-The \*S manual pages
-are a good last resort.
-These should be read by software managers
-and by people who want to know
-everything about everything.
-.pp
-Both of these documents were written without the
-.i sccs
-front end in mind,
-so most of the examples are slightly different from those
-in this document.
-.bp
-.sz 12
-.ce
-.b "Quick Reference"
-.sz
-.sp 2
-.sh 1 Commands 1
-.pp
-The following commands should all be preceded with
-.q sccs .
-This list is not exhaustive;
-for more options see
-.i "Further Information" .
-.ip get 9n
-Gets files for compilation (not for editing).
-Id keywords are expanded.
-.ba 9n
-.nr ii 8n
-.ip \-r\fI\*I\fP
-Version to get.
-.ip \-p
-Send to standard output rather than to the actual file.
-.ip \-k
-Don't expand id keywords.
-.ip \-i\fIlist\fP
-List of deltas to include.
-.ip \-x\fIlist\fP
-List of deltas to exclude.
-.ip \-m
-Precede each line with \*I of creating delta.
-.ip \-c\fIdate\fP
-Don't apply any deltas created after
-.i date.
-.ba
-.ip edit 9n
-Gets files for editing.
-Id keywords are not expanded.
-Should be matched with a
-.i delta
-command.
-.ba 9n
-.nr ii 8n
-.ip \-r\fI\*I\fP
-Same as
-.i get .
-If
-.i \*I
-specifies a release that does not yet exist,
-the highest numbered delta is retrieved
-and the new delta is numbered with
-.i \*I .
-.ip \-b
-Create a branch.
-.ip \-i\fIlist\fP
-Same as
-.i get .
-.ip \-x\fIlist\fP
-Same as
-.i get .
-.ba
-.ip delta 9n
-Merge a file gotten using
-.i edit
-back into the s-file.
-Collect comments about why this delta was made.
-.ip unedit 9n
-Remove a file that has been edited previously
-without merging the changes into the s-file.
-.ip prt 9n
-Produce a report of changes.
-.ba 9n
-.nr ii 5n
-.ip \-t
-Print the descriptive text.
-.ip \-e
-Print (nearly) everything.
-.ba
-.ip info 9n
-Give a list of all files being edited.
-.ba 9n
-.nr ii 5n
-.ip \-b
-Ignore branches.
-.ip \-u[\fIuser\fP]
-Ignore files not being edited by
-.i user .
-.ba
-.ip check 9n
-Same as
-.i info ,
-except that nothing is printed if nothing is being edited
-and exit status is returned.
-.ip tell 9n
-Same as
-.i info ,
-except that one line is produced per file being edited containing
-only the file name.
-.ip clean 9n
-Remove all files that can be regenerated from the
-s-file.
-.ip what 9n
-Find and print id keywords.
-.ip admin 9n
-Create or set parameters on s-files.
-.ba 9n
-.nr ii 8n
-.ip \-i\fIfile\fP
-Create, using
-.i file
-as the initial contents.
-.ip \-z
-Rebuild the checksum in case
-the file has been trashed.
-.ip \-f\fIflag\fP
-Turn on the
-.i flag .
-.ip \-d\fIflag\fP
-Turn off (delete) the
-.i flag .
-.ip \-t\fIfile\fP
-Replace the descriptive text
-in the s-file with the contents of
-.i file .
-If
-.i file
-is omitted,
-the text is deleted.
-Useful for storing documentation
-or
-.q "design & implementation"
-documents to insure they get distributed with the
-s-file.
-.lp
-Useful flags are:
-.ip b
-Allow branches to be made using the \-b flag to
-.i edit.
-.ip d\fI\*I\fP
-Default \*I to be used
-on a
-.i get
-or
-.i edit .
-.ip i
-Cause
-.q "No Id Keywords"
-error message
-to be a fatal error rather than a warning.
-.ip t
-The module
-.q type ;
-the value of this flag replaces the
-.b %\&Y\&%
-keyword.
-.ba
-.ip fix 9n
-Remove a delta and reedit it.
-.ip delget 9n
-Do a
-.i delta
-followed by a
-.i get .
-.ip deledit 9n
-Do a
-.i delta
-followed by an
-.i edit .
-.sh 1 "Id Keywords"
-.nr ii 6n
-.ip "%\&Z\&%"
-Expands to
-.q @\&(#)
-for the
-.i what
-command to find.
-.ip "%\&M\&%"
-The current module name,
-.i e.g.,
-.q prog.c .
-.ip "%\&I\&%"
-The highest \*I applied.
-.ip "%\&W\&%"
-A shorthand for
-.q "%\&Z\&%%\&M\&% <tab> %\&I\&%" .
-.ip "%\&G\&%"
-The date of the delta
-corresponding to the
-.q "%\&I\&%"
-keyword.
-.ip "%\&R\&%"
-The current release number,
-.i i.e. ,
-the first component of the
-.q "%\&I\&%"
-keyword.
-.ip "%\&Y\&%"
-Replaced by the value of the
-.b t
-flag
-(set by
-.i admin ).
diff --git a/usr.bin/sccs/PSD.doc/spell.ok b/usr.bin/sccs/PSD.doc/spell.ok
deleted file mode 100644
index fb2fe24..0000000
--- a/usr.bin/sccs/PSD.doc/spell.ok
+++ /dev/null
@@ -1,77 +0,0 @@
-AccessSid
-Admin
-Allman
-Berkeley.Edu
-Delget
-Ingres
-LDFLAGS
-LIB
-LIBS
-OBJS
-OpsysSid
-PS1:14
-PWB
-REL
-SCCS
-SID
-SRCS
-Sccs
-SccsId
-System''PS1:14
-TARG
-a.c
-a.o
-a.out
-access.h
-admin
-b.c
-b.o
-backslash
-bi
-c.c
-c.o
-c.y
-ch
-cm7
-cmd
-cs
-d.o
-d.s
-deledit
-delget
-eric
-example.c
-example.o
-fb
-fd1
-foreach
-g.c
-info
-inline
-john
-lib
-lib.a
-makefile
-makefiles
-mod
-mothballed
-newxyz
-ok
-opsys.h
-prog
-prog.c
-prog.h
-prog.o
-prt
-rvu
-sccs
-sccsdiff
-src
-syssccs
-t.c
-ujohn
-who.c
-x.h
-xyz
-y.h
-z.h
diff --git a/usr.bin/sccs/pathnames.h b/usr.bin/sccs/pathnames.h
deleted file mode 100644
index 4da6874..0000000
--- a/usr.bin/sccs/pathnames.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
- */
-
-#include <paths.h>
-
-#define _PATH_SCCSADMIN "/usr/local/bin/admin"
-#define _PATH_SCCSBDIFF "/usr/local/bin/bdiff"
-#define _PATH_SCCSCOMB "/usr/local/bin/comb"
-#define _PATH_SCCSDELTA "/usr/local/bin/delta"
-#define _PATH_SCCSDIFF "/usr/local/bin/sccsdiff"
-#define _PATH_SCCSGET "/usr/local/bin/get"
-#define _PATH_SCCSHELP "/usr/local/bin/help"
-#define _PATH_SCCSPRS "/usr/local/bin/prs"
-#define _PATH_SCCSPRT "/usr/local/bin/prt"
-#define _PATH_SCCSRMDEL "/usr/local/bin/rmdel"
-#define _PATH_SCCSVAL "/usr/local/bin/val"
-#define _PATH_SCCSWHAT "/usr/local/bin/what"
-#undef _PATH_TMP
-#define _PATH_TMP "/tmp/sccsXXXXX"
diff --git a/usr.bin/sccs/sccs.1 b/usr.bin/sccs/sccs.1
deleted file mode 100644
index 7f4990c..0000000
--- a/usr.bin/sccs/sccs.1
+++ /dev/null
@@ -1,398 +0,0 @@
-.\" Copyright (c) 1983, 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.
-.\"
-.\" @(#)sccs.1 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt SCCS 1
-.Os BSD 4.2
-.Sh NAME
-.Nm sccs
-.Nd front end for the
-.Li SCCS
-subsystem
-.Sh SYNOPSIS
-.Nm sccs
-.Op Fl r
-.Op Fl d Ar path
-.Op Fl p Ar path
-.Ar command
-.Op flags
-.Op Ar
-.Sh DESCRIPTION
-.Nm Sccs
-is a front end to the
-.Li SCCS
-programs
-that
-helps them mesh more cleanly
-with
-the rest of UNIX.
-It
-also includes the capability to run
-.Dq set user id
-to another user
-to
-provide additional protection.
-.Pp
-Basically,
-.Nm sccs
-runs the command with the specified
-.Ar flags
-and
-.Ar args .
-Each argument is normally modified to be prepended with
-.Dq Li SCCS/s. .
-.Pp
-Flags to be interpreted by the
-.Nm sccs
-program must be before the
-.Ar command
-argument.
-Flags to be passed to the actual
-.Li SCCS
-program must come after the
-.Ar command
-argument.
-These flags are specific to the command and
-are discussed in the documentation for that command.
-.Pp
-Besides the usual
-.Li SCCS
-commands,
-several
-.Dq pseudo-commands
-can be issued.
-These are:
-.Bl -tag -width deledit
-.It Cm edit
-Equivalent
-to
-.Dq Li get \-e .
-.It Cm delget
-Perform a delta on the named files and
-then get new versions.
-The new versions will have id keywords expanded, and
-will not be editable.
-The
-.Fl m ,
-.Fl p ,
-.Fl r ,
-.Fl s ,
-and
-.Fl y
-flags will be passed to
-.Nm delta ,
-and the
-.Fl b,
-.Fl c ,
-.Fl e ,
-.Fl i ,
-.Fl k ,
-.Fl l ,
-.Fl s ,
-.\" anybody who has a bad xterm which is almost anyone
-and
-.Fl x
-flags will be passed to get.
-.It Cm deledit
-Equivalent
-to
-.Nm delget
-except that the
-.Nm get
-phase includes the
-.Fl e
-flag.
-This
-option is useful for making a
-.Em checkpoint
-of your current editing phase. The same flags will be passed to delta
-as described above, and
-all the flags listed for
-.om get
-above except
-.Fl e
-and
-.Fl k
-are
-passed to
-.Nm edit .
-.It Cm create
-Creates
-an
-.Li SCCS
-file ,
-taking
-the initial contents from the file of the same name.
-Any
-flags to
-.Nm admin
-are accepted. If the creation is successful,
-the files are renamed with a comma on the front.
-These should be removed when you are convinced that the
-.Li SCCS
-files
-have been created successfully.
-.It Cm fix
-Must
-be followed by a
-.Fl r
-flag.
-This command essentially removes the named delta, but
-leaves you with a copy of the delta
-with the changes that were in it. It
-is useful for fixing small compiler bugs, etc.
-Since it doesn't leave audit trails, it should be used carefully.
-.It Cm clean
-This routine removes everything from the current directory
-that can be recreated from SCCS files.
-It will not remove any files being edited.
-If the
-.Fl b
-flag is given, branches are ignored in the determination of
-whether they are being edited; this
-is dangerous if you are keeping the branches in the
-same directory.
-.It Cm unedit
-This
-is the opposite of an
-.Nm edit
-or
-a
-.Dq Li get \-e .
-It should be used with extreme caution, since
-any changes you made since the get will be irretrievably lost.
-.It Cm info
-Gives a listing of all files being edited.
-If the
-.Fl b
-flag
-is given, branches (i.e.,
-.Li SID Ns \&\'s
-with two or fewer components)
-are ignored. If the
-.Fl u
-flag is given (with an optional argument) then
-only files being edited by you (or the named user) are listed.
-.It Cm check
-Like
-.Nm info
-except that nothing is printed if nothing is being edited, and
-a non-zero exit status is returned if anything is being edited.
-The intent is to have this included in an
-.Em install
-entry in a makefile to insure that everything is included into the
-.Li SCCS
-file before a version is installed.
-.It Cm tell
-Gives a newline-separated list of the files being edited
-on the standard output. Takes the
-.Fl b
-and
-.Fl u
-flags like
-.Nm info
-and
-.Nm check .
-.It Cm diffs
-Gives a
-.Nm diff
-listing between the current version of the
-program(s) you have out for editing and the versions in
-.Li SCCS
-format.
-The
-.Fl r ,
-.Fl c ,
-.Fl i ,
-.Fl x ,
-and
-.Fl t
-flags are passed to
-.if n \{\
-. br
-.\}
-.Nm get ;
-the
-.Fl l ,
-.Fl s ,
-.Fl e ,
-.Fl f ,
-.Fl h ,
-and
-.Fl b
-options are passed to
-.if n \{\
-. br
-.\}
-.Nm diff .
-The
-.Fl C
-flag is passed to
-.Nm diff
-as
-.Fl c .
-.It Cm print
-This command prints out verbose information
-about the named files.
-.Pp
-.It Fl r
-Runs
-.Nm sccs
-as the real user rather than as whatever effective user
-.Nm sccs
-is
-.Dq Li set user id
-to.
-.It Fl d
-Specifies a root directory for the
-.Li SCCS
-files.
-The default is the current directory.
-If environment variable
-.Ev PROJECT
-is set,
-it will be used to determine the
-.Fl d
-flag.
-.It Fl p
-Defines the pathname of the directory in which the
-.Li SCCS
-files will be found;
-.Dq Li SCCS
-is the default.
-The
-.Fl p
-flag
-differs from the
-.Fl d
-flag
-in that the
-.Fl d
-argument is prepended to the entire pathname and the
-.Fl p
-argument is inserted before the final component of the pathname.
-For example,
-.Dq Li sccs \-d/x \-py get a/b
-will convert to
-.Dq Li get /x/a/y/s.b .
-The intent here is to create aliases such as
-.Dq Li alias syssccs sccs -d/usr/src
-which
-will be used as
-.Dq Li syssccs get cmd/who.c .
-.Pp
-Certain
-commands (such as
-.Nm admin )
-cannot be run
-.Dq Li set user id
-by all users, since this would allow anyone to change the authorizations.
-These commands are always run as the real user.
-.Sh EXAMPLES
-To get a file for editing,
-edit it,
-and produce a new delta:
-.Pp
-.Dl sccs get \-e file.c
-.Dl ex file.c
-.Dl sccs delta file.c
-.Pp
-To get a file from another directory:
-.Pp
-.Dl sccs \-p/usr/src/sccs/s. get cc.c
-.Pp
-or
-.Pp
-.Dl sccs get /usr/src/sccs/s.cc.c
-.Pp
-To make a delta of a large number of files
-in the current directory:
-.Pp
-.Dl sccs delta *.c
-.Pp
-To get a list of files being edited that are not on branches:
-.Pp
-.Dl sccs info \-b
-.Pp
-To delta everything being edited by you:
-.Pp
-.Dl sccs delta \`sccs tell \-u\`
-.Pp
-In a makefile, to get source files
-from an
-.Li SCCS
-file if it does not already exist:
-.Pp
-.Dl SRCS = <list of source files>
-.Dl $(SRCS):
-.Dl \&\tsccs get $(REL) $@
-.Sh ENVIRONMENT
-.Bl -tag -width Ar
-.It Ev PROJECT
-The PROJECT environment variable is checked by the
-.Fl d
-flag. If
-it begins with a slash, it is taken directly; otherwise,
-the home directory of a user of that name is
-examined for a subdirectory
-.Dq Li src
-or
-.Dq Li source .
-If such a directory is found, it is used.
-.El
-.Sh SEE ALSO
-.Xr what 1
-.Xr admin SCCS ,
-.Xr chghist SCCS ,
-.Xr comb SCCS ,
-.Xr delta SCCS ,
-.Xr get SCCS ,
-.Xr help SCCS ,
-.Xr prt SCCS ,
-.Xr rmdel SCCS ,
-.Xr sccsdiff SCCS ,
-.Rs
-.%A Eric Allman
-.%T "An Introduction to the Source Code Control System"
-.Re
-.Sh HISTORY
-The
-.Nm sccs
-command
-appeared in
-.Bx 4.3 .
-.Sh BUGS
-It should be able to take directory arguments on pseudo-commands
-like the
-.Li SCCS
-commands do.
diff --git a/usr.bin/sccs/sccs.c b/usr.bin/sccs/sccs.c
deleted file mode 100644
index 2dfd76d..0000000
--- a/usr.bin/sccs/sccs.c
+++ /dev/null
@@ -1,1621 +0,0 @@
-/*
- * Copyright (c) 1980, 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)sccs.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <sys/cdefs.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/dir.h>
-#include <signal.h>
-#include <sysexits.h>
-#include <errno.h>
-#include <pwd.h>
-#include <stdio.h>
-#include "pathnames.h"
-
-/*
-** SCCS.C -- human-oriented front end to the SCCS system.
-**
-** Without trying to add any functionality to speak of, this
-** program tries to make SCCS a little more accessible to human
-** types. The main thing it does is automatically put the
-** string "SCCS/s." on the front of names. Also, it has a
-** couple of things that are designed to shorten frequent
-** combinations, e.g., "delget" which expands to a "delta"
-** and a "get".
-**
-** This program can also function as a setuid front end.
-** To do this, you should copy the source, renaming it to
-** whatever you want, e.g., "syssccs". Change any defaults
-** in the program (e.g., syssccs might default -d to
-** "/usr/src/sys"). Then recompile and put the result
-** as setuid to whomever you want. In this mode, sccs
-** knows to not run setuid for certain programs in order
-** to preserve security, and so forth.
-**
-** Usage:
-** sccs [flags] command [args]
-**
-** Flags:
-** -d<dir> <dir> represents a directory to search
-** out of. It should be a full pathname
-** for general usage. E.g., if <dir> is
-** "/usr/src/sys", then a reference to the
-** file "dev/bio.c" becomes a reference to
-** "/usr/src/sys/dev/bio.c".
-** -p<path> prepends <path> to the final component
-** of the pathname. By default, this is
-** "SCCS". For example, in the -d example
-** above, the path then gets modified to
-** "/usr/src/sys/dev/SCCS/s.bio.c". In
-** more common usage (without the -d flag),
-** "prog.c" would get modified to
-** "SCCS/s.prog.c". In both cases, the
-** "s." gets automatically prepended.
-** -r run as the real user.
-**
-** Commands:
-** admin,
-** get,
-** delta,
-** rmdel,
-** cdc,
-** etc. Straight out of SCCS; only difference
-** is that pathnames get modified as
-** described above.
-** enter Front end doing "sccs admin -i<name> <name>"
-** create Macro for "enter" followed by "get".
-** edit Macro for "get -e".
-** unedit Removes a file being edited, knowing
-** about p-files, etc.
-** delget Macro for "delta" followed by "get".
-** deledit Macro for "delta" followed by "get -e".
-** branch Macro for "get -b -e", followed by "delta
-** -s -n", followd by "get -e -t -g".
-** diffs "diff" the specified version of files
-** and the checked-out version.
-** print Macro for "prs -e" followed by "get -p -m".
-** tell List what files are being edited.
-** info Print information about files being edited.
-** clean Remove all files that can be
-** regenerated from SCCS files.
-** check Like info, but return exit status, for
-** use in makefiles.
-** fix Remove a top delta & reedit, but save
-** the previous changes in that delta.
-**
-** Compilation Flags:
-** UIDUSER -- determine who the user is by looking at the
-** uid rather than the login name -- for machines
-** where SCCS gets the user in this way.
-** SCCSDIR -- if defined, forces the -d flag to take on
-** this value. This is so that the setuid
-** aspects of this program cannot be abused.
-** This flag also disables the -p flag.
-** SCCSPATH -- the default for the -p flag.
-** MYNAME -- the title this program should print when it
-** gives error messages.
-**
-** Compilation Instructions:
-** cc -O -n -s sccs.c
-** The flags listed above can be -D defined to simplify
-** recompilation for variant versions.
-**
-** Author:
-** Eric Allman, UCB/INGRES
-** Copyright 1980 Regents of the University of California
-*/
-
-
-/******************* Configuration Information ********************/
-
-# ifndef SCCSPATH
-# define SCCSPATH "SCCS" /* pathname in which to find s-files */
-# endif NOT SCCSPATH
-
-# ifndef MYNAME
-# define MYNAME "sccs" /* name used for printing errors */
-# endif NOT MYNAME
-
-/**************** End of Configuration Information ****************/
-
-typedef char bool;
-# define TRUE 1
-# define FALSE 0
-
-# define bitset(bit, word) ((bool) ((bit) & (word)))
-
-struct sccsprog
-{
- char *sccsname; /* name of SCCS routine */
- short sccsoper; /* opcode, see below */
- short sccsflags; /* flags, see below */
- char *sccspath; /* pathname of binary implementing */
-};
-
-/* values for sccsoper */
-# define PROG 0 /* call a program */
-# define CMACRO 1 /* command substitution macro */
-# define FIX 2 /* fix a delta */
-# define CLEAN 3 /* clean out recreatable files */
-# define UNEDIT 4 /* unedit a file */
-# define SHELL 5 /* call a shell file (like PROG) */
-# define DIFFS 6 /* diff between sccs & file out */
-# define DODIFF 7 /* internal call to diff program */
-# define ENTER 8 /* enter new files */
-
-/* bits for sccsflags */
-# define NO_SDOT 0001 /* no s. on front of args */
-# define REALUSER 0002 /* protected (e.g., admin) */
-
-/* modes for the "clean", "info", "check" ops */
-# define CLEANC 0 /* clean command */
-# define INFOC 1 /* info command */
-# define CHECKC 2 /* check command */
-# define TELLC 3 /* give list of files being edited */
-
-/*
-** Description of commands known to this program.
-** First argument puts the command into a class. Second arg is
-** info regarding treatment of this command. Third arg is a
-** list of flags this command accepts from macros, etc. Fourth
-** arg is the pathname of the implementing program, or the
-** macro definition, or the arg to a sub-algorithm.
-*/
-
-struct sccsprog SccsProg[] = {
- "admin", PROG, REALUSER, _PATH_SCCSADMIN,
- "cdc", PROG, 0, _PATH_SCCSRMDEL,
- "comb", PROG, 0, _PATH_SCCSCOMB,
- "delta", PROG, 0, _PATH_SCCSDELTA,
- "get", PROG, 0, _PATH_SCCSGET,
- "help", PROG, NO_SDOT, _PATH_SCCSHELP,
- "prs", PROG, 0, _PATH_SCCSPRS,
- "prt", PROG, 0, _PATH_SCCSPRT,
- "rmdel", PROG, REALUSER, _PATH_SCCSRMDEL,
- "val", PROG, 0, _PATH_SCCSVAL,
- "what", PROG, NO_SDOT, _PATH_SCCSWHAT,
- "sccsdiff", SHELL, REALUSER, _PATH_SCCSDIFF,
- "edit", CMACRO, NO_SDOT, "get -e",
- "delget", CMACRO, NO_SDOT, "delta:mysrp/get:ixbeskcl -t",
- "deledit", CMACRO, NO_SDOT,
- "delta:mysrp -n/get:ixbskcl -e -t -g",
- "fix", FIX, NO_SDOT, NULL,
- "clean", CLEAN, REALUSER|NO_SDOT,
- (char *) CLEANC,
- "info", CLEAN, REALUSER|NO_SDOT,
- (char *) INFOC,
- "check", CLEAN, REALUSER|NO_SDOT,
- (char *) CHECKC,
- "tell", CLEAN, REALUSER|NO_SDOT,
- (char *) TELLC,
- "unedit", UNEDIT, NO_SDOT, NULL,
- "diffs", DIFFS, NO_SDOT|REALUSER,
- NULL,
- "-diff", DODIFF, NO_SDOT|REALUSER,
- _PATH_SCCSBDIFF,
- "print", CMACRO, 0, "prs -e/get -p -m -s",
- "branch", CMACRO, NO_SDOT,
- "get:ixrc -e -b/delta: -s -n -ybranch-place-holder/get:pl -e -t -g",
- "enter", ENTER, NO_SDOT, NULL,
- "create", CMACRO, NO_SDOT, "enter/get:ixbeskcl -t",
- NULL, -1, 0, NULL
-};
-
-/* one line from a p-file */
-struct pfile
-{
- char *p_osid; /* old SID */
- char *p_nsid; /* new SID */
- char *p_user; /* user who did edit */
- char *p_date; /* date of get */
- char *p_time; /* time of get */
- char *p_aux; /* extra info at end */
-};
-
-char *SccsPath = SCCSPATH; /* pathname of SCCS files */
-# ifdef SCCSDIR
-char *SccsDir = SCCSDIR; /* directory to begin search from */
-# else
-char *SccsDir = "";
-# endif
-char MyName[] = MYNAME; /* name used in messages */
-int OutFile = -1; /* override output file for commands */
-bool RealUser; /* if set, running as real user */
-# ifdef DEBUG
-bool Debug; /* turn on tracing */
-# endif
-# ifndef V6
-extern char *getenv();
-# endif V6
-
-char *gstrcat(), *strcat();
-char *gstrncat(), *strncat();
-char *gstrcpy(), *strcpy();
-#define FBUFSIZ BUFSIZ
-#define PFILELG 120
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- register char *p;
- extern struct sccsprog *lookup();
- register int i;
-# ifndef V6
-# ifndef SCCSDIR
- register struct passwd *pw;
- extern struct passwd *getpwnam();
- char buf[FBUFSIZ];
-
- /* pull "SccsDir" out of the environment (possibly) */
- p = getenv("PROJECTDIR");
- if (p != NULL && p[0] != '\0')
- {
- if (p[0] == '/')
- SccsDir = p;
- else
- {
- pw = getpwnam(p);
- if (pw == NULL)
- {
- usrerr("user %s does not exist", p);
- exit(EX_USAGE);
- }
- gstrcpy(buf, pw->pw_dir, sizeof(buf));
- gstrcat(buf, "/src", sizeof(buf));
- if (access(buf, 0) < 0)
- {
- gstrcpy(buf, pw->pw_dir, sizeof(buf));
- gstrcat(buf, "/source", sizeof(buf));
- if (access(buf, 0) < 0)
- {
- usrerr("project %s has no source!", p);
- exit(EX_USAGE);
- }
- }
- SccsDir = buf;
- }
- }
-# endif SCCSDIR
-# endif V6
-
- /*
- ** Detect and decode flags intended for this program.
- */
-
- if (argc < 2)
- {
- fprintf(stderr, "Usage: %s [flags] command [flags]\n", MyName);
- exit(EX_USAGE);
- }
- argv[argc] = NULL;
-
- if (lookup(argv[0]) == NULL)
- {
- while ((p = *++argv) != NULL)
- {
- if (*p != '-')
- break;
- switch (*++p)
- {
- case 'r': /* run as real user */
- setuid(getuid());
- RealUser++;
- break;
-
-# ifndef SCCSDIR
- case 'p': /* path of sccs files */
- SccsPath = ++p;
- if (SccsPath[0] == '\0' && argv[1] != NULL)
- SccsPath = *++argv;
- break;
-
- case 'd': /* directory to search from */
- SccsDir = ++p;
- if (SccsDir[0] == '\0' && argv[1] != NULL)
- SccsDir = *++argv;
- break;
-# endif
-
-# ifdef DEBUG
- case 'T': /* trace */
- Debug++;
- break;
-# endif
-
- default:
- usrerr("unknown option -%s", p);
- break;
- }
- }
- if (SccsPath[0] == '\0')
- SccsPath = ".";
- }
-
- i = command(argv, FALSE, "");
- exit(i);
-}
-
-/*
-** COMMAND -- look up and perform a command
-**
-** This routine is the guts of this program. Given an
-** argument vector, it looks up the "command" (argv[0])
-** in the configuration table and does the necessary stuff.
-**
-** Parameters:
-** argv -- an argument vector to process.
-** forkflag -- if set, fork before executing the command.
-** editflag -- if set, only include flags listed in the
-** sccsklets field of the command descriptor.
-** arg0 -- a space-seperated list of arguments to insert
-** before argv.
-**
-** Returns:
-** zero -- command executed ok.
-** else -- error status.
-**
-** Side Effects:
-** none.
-*/
-
-command(argv, forkflag, arg0)
- char **argv;
- bool forkflag;
- char *arg0;
-{
- register struct sccsprog *cmd;
- register char *p;
- char buf[FBUFSIZ];
- extern struct sccsprog *lookup();
- char *nav[1000];
- char **np;
- register char **ap;
- register int i;
- register char *q;
- extern bool unedit();
- int rval = 0;
- extern char *index();
- extern char *makefile();
- char *editchs;
- extern char *tail();
-
-# ifdef DEBUG
- if (Debug)
- {
- printf("command:\n\t\"%s\"\n", arg0);
- for (np = argv; *np != NULL; np++)
- printf("\t\"%s\"\n", *np);
- }
-# endif
-
- /*
- ** Copy arguments.
- ** Copy from arg0 & if necessary at most one arg
- ** from argv[0].
- */
-
- np = ap = &nav[1];
- editchs = NULL;
- for (p = arg0, q = buf; *p != '\0' && *p != '/'; )
- {
- *np++ = q;
- while (*p == ' ')
- p++;
- while (*p != ' ' && *p != '\0' && *p != '/' && *p != ':')
- *q++ = *p++;
- *q++ = '\0';
- if (*p == ':')
- {
- editchs = q;
- while (*++p != '\0' && *p != '/' && *p != ' ')
- *q++ = *p;
- *q++ = '\0';
- }
- }
- *np = NULL;
- if (*ap == NULL)
- *np++ = *argv++;
-
- /*
- ** Look up command.
- ** At this point, *ap is the command name.
- */
-
- cmd = lookup(*ap);
- if (cmd == NULL)
- {
- usrerr("Unknown command \"%s\"", *ap);
- return (EX_USAGE);
- }
-
- /*
- ** Copy remaining arguments doing editing as appropriate.
- */
-
- for (; *argv != NULL; argv++)
- {
- p = *argv;
- if (*p == '-')
- {
- if (p[1] == '\0' || editchs == NULL || index(editchs, p[1]) != NULL)
- *np++ = p;
- }
- else
- {
- if (!bitset(NO_SDOT, cmd->sccsflags))
- p = makefile(p);
- if (p != NULL)
- *np++ = p;
- }
- }
- *np = NULL;
-
- /*
- ** Interpret operation associated with this command.
- */
-
- switch (cmd->sccsoper)
- {
- case SHELL: /* call a shell file */
- *ap = cmd->sccspath;
- *--ap = "sh";
- rval = callprog(_PATH_BSHELL, cmd->sccsflags, ap, forkflag);
- break;
-
- case PROG: /* call an sccs prog */
- rval = callprog(cmd->sccspath, cmd->sccsflags, ap, forkflag);
- break;
-
- case CMACRO: /* command macro */
- /* step through & execute each part of the macro */
- for (p = cmd->sccspath; *p != '\0'; p++)
- {
- q = p;
- while (*p != '\0' && *p != '/')
- p++;
- rval = command(&ap[1], *p != '\0', q);
- if (rval != 0)
- break;
- }
- break;
-
- case FIX: /* fix a delta */
- if (ap[1]==0 || strncmp(ap[1], "-r", 2)!=0)
- {
- usrerr("-r flag needed for fix command");
- rval = EX_USAGE;
- break;
- }
-
- /* get the version with all changes */
- rval = command(&ap[1], TRUE, "get -k");
-
- /* now remove that version from the s-file */
- if (rval == 0)
- rval = command(&ap[1], TRUE, "rmdel:r");
-
- /* and edit the old version (but don't clobber new vers) */
- if (rval == 0)
- rval = command(&ap[2], FALSE, "get -e -g");
- break;
-
- case CLEAN:
- rval = clean((int) cmd->sccspath, ap);
- break;
-
- case UNEDIT:
- for (argv = np = &ap[1]; *argv != NULL; argv++)
- {
- if (unedit(*argv))
- *np++ = *argv;
- }
- *np = NULL;
-
- /* get all the files that we unedited successfully */
- if (np > &ap[1])
- rval = command(&ap[1], FALSE, "get");
- break;
-
- case DIFFS: /* diff between s-file & edit file */
- /* find the end of the flag arguments */
- for (np = &ap[1]; *np != NULL && **np == '-'; np++)
- continue;
- argv = np;
-
- /* for each file, do the diff */
- p = argv[1];
- while (*np != NULL)
- {
- /* messy, but we need a null terminated argv */
- *argv = *np++;
- argv[1] = NULL;
- i = dodiff(ap, tail(*argv));
- if (rval == 0)
- rval = i;
- argv[1] = p;
- }
- break;
-
- case DODIFF: /* internal diff call */
- setuid(getuid());
- for (np = ap; *np != NULL; np++)
- {
- if ((*np)[0] == '-' && (*np)[1] == 'C')
- (*np)[1] = 'c';
- }
-
- /* insert "-" argument */
- np[1] = NULL;
- np[0] = np[-1];
- np[-1] = "-";
-
- /* execute the diff program of choice */
-# ifndef V6
- execvp("diff", ap);
-# endif
- execv(cmd->sccspath, argv);
- syserr("cannot exec %s", cmd->sccspath);
- exit(EX_OSERR);
-
- case ENTER: /* enter new sccs files */
- /* skip over flag arguments */
- for (np = &ap[1]; *np != NULL && **np == '-'; np++)
- continue;
- argv = np;
-
- /* do an admin for each file */
- p = argv[1];
- while (*np != NULL)
- {
- printf("\n%s:\n", *np);
- strcpy(buf, "-i");
- gstrcat(buf, *np, sizeof(buf));
- ap[0] = buf;
- argv[0] = tail(*np);
- argv[1] = NULL;
- rval = command(ap, TRUE, "admin");
- argv[1] = p;
- if (rval == 0)
- {
- strcpy(buf, ",");
- gstrcat(buf, tail(*np), sizeof(buf));
- if (link(*np, buf) >= 0)
- unlink(*np);
- }
- np++;
- }
- break;
-
- default:
- syserr("oper %d", cmd->sccsoper);
- exit(EX_SOFTWARE);
- }
-# ifdef DEBUG
- if (Debug)
- printf("command: rval=%d\n", rval);
-# endif
- return (rval);
-}
-
-/*
-** LOOKUP -- look up an SCCS command name.
-**
-** Parameters:
-** name -- the name of the command to look up.
-**
-** Returns:
-** ptr to command descriptor for this command.
-** NULL if no such entry.
-**
-** Side Effects:
-** none.
-*/
-
-struct sccsprog *
-lookup(name)
- char *name;
-{
- register struct sccsprog *cmd;
-
- for (cmd = SccsProg; cmd->sccsname != NULL; cmd++)
- {
- if (strcmp(cmd->sccsname, name) == 0)
- return (cmd);
- }
- return (NULL);
-}
-
-/*
-** CALLPROG -- call a program
-**
-** Used to call the SCCS programs.
-**
-** Parameters:
-** progpath -- pathname of the program to call.
-** flags -- status flags from the command descriptors.
-** argv -- an argument vector to pass to the program.
-** forkflag -- if true, fork before calling, else just
-** exec.
-**
-** Returns:
-** The exit status of the program.
-** Nothing if forkflag == FALSE.
-**
-** Side Effects:
-** Can exit if forkflag == FALSE.
-*/
-
-callprog(progpath, flags, argv, forkflag)
- char *progpath;
- short flags;
- char **argv;
- bool forkflag;
-{
- register int i;
- register int wpid;
- auto int st;
- register int sigcode;
- register int coredumped;
- register const char *sigmsg;
- char sigmsgbuf[10+1]; /* "Signal 127" + terminating '\0' */
-
-# ifdef DEBUG
- if (Debug)
- {
- printf("callprog:\n");
- for (i = 0; argv[i] != NULL; i++)
- printf("\t\"%s\"\n", argv[i]);
- }
-# endif
-
- if (*argv == NULL)
- return (-1);
-
- /*
- ** Fork if appropriate.
- */
-
- if (forkflag)
- {
-# ifdef DEBUG
- if (Debug)
- printf("Forking\n");
-# endif
- i = fork();
- if (i < 0)
- {
- syserr("cannot fork");
- exit(EX_OSERR);
- }
- else if (i > 0)
- {
- while ((wpid = wait(&st)) != -1 && wpid != i)
- ;
- if ((sigcode = st & 0377) == 0)
- st = (st >> 8) & 0377;
- else
- {
- coredumped = sigcode & 0200;
- sigcode &= 0177;
- if (sigcode != SIGINT && sigcode != SIGPIPE)
- {
- if (sigcode < NSIG)
- sigmsg = sys_siglist[sigcode];
- else
- {
- sprintf(sigmsgbuf, "Signal %d",
- sigcode);
- sigmsg = sigmsgbuf;
- }
- fprintf(stderr, "sccs: %s: %s%s", argv[0],
- sigmsg,
- coredumped ? " - core dumped": "");
- }
- st = EX_SOFTWARE;
- }
- if (OutFile >= 0)
- {
- close(OutFile);
- OutFile = -1;
- }
- return (st);
- }
- }
- else if (OutFile >= 0)
- {
- syserr("callprog: setting stdout w/o forking");
- exit(EX_SOFTWARE);
- }
-
- /* set protection as appropriate */
- if (bitset(REALUSER, flags))
- setuid(getuid());
-
- /* change standard input & output if needed */
- if (OutFile >= 0)
- {
- close(1);
- dup(OutFile);
- close(OutFile);
- }
-
- /* call real SCCS program */
- execv(progpath, argv);
- syserr("cannot execute %s", progpath);
- exit(EX_UNAVAILABLE);
- /*NOTREACHED*/
-}
-
-/*
-** MAKEFILE -- make filename of SCCS file
-**
-** If the name passed is already the name of an SCCS file,
-** just return it. Otherwise, munge the name into the name
-** of the actual SCCS file.
-**
-** There are cases when it is not clear what you want to
-** do. For example, if SccsPath is an absolute pathname
-** and the name given is also an absolute pathname, we go
-** for SccsPath (& only use the last component of the name
-** passed) -- this is important for security reasons (if
-** sccs is being used as a setuid front end), but not
-** particularly intuitive.
-**
-** Parameters:
-** name -- the file name to be munged.
-**
-** Returns:
-** The pathname of the sccs file.
-** NULL on error.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-makefile(name)
- char *name;
-{
- register char *p;
- char buf[3*FBUFSIZ];
- extern char *malloc();
- extern char *rindex();
- extern bool safepath();
- extern bool isdir();
- register char *q;
-
- p = rindex(name, '/');
- if (p == NULL)
- p = name;
- else
- p++;
-
- /*
- ** Check to see that the path is "safe", i.e., that we
- ** are not letting some nasty person use the setuid part
- ** of this program to look at or munge some presumably
- ** hidden files.
- */
-
- if (SccsDir[0] == '/' && !safepath(name))
- return (NULL);
-
- /*
- ** Create the base pathname.
- */
-
- /* first the directory part */
- if (SccsDir[0] != '\0' && name[0] != '/' && strncmp(name, "./", 2) != 0)
- {
- gstrcpy(buf, SccsDir, sizeof(buf));
- gstrcat(buf, "/", sizeof(buf));
- }
- else
- gstrcpy(buf, "", sizeof(buf));
-
- /* then the head of the pathname */
- gstrncat(buf, name, p - name, sizeof(buf));
- q = &buf[strlen(buf)];
-
- /* now copy the final part of the name, in case useful */
- gstrcpy(q, p, sizeof(buf));
-
- /* so is it useful? */
- if (strncmp(p, "s.", 2) != 0 && !isdir(buf))
- {
- /* sorry, no; copy the SCCS pathname & the "s." */
- gstrcpy(q, SccsPath, sizeof(buf));
- gstrcat(buf, "/s.", sizeof(buf));
-
- /* and now the end of the name */
- gstrcat(buf, p, sizeof(buf));
- }
-
- /* if i haven't changed it, why did I do all this? */
- if (strcmp(buf, name) == 0)
- p = name;
- else
- {
- /* but if I have, squirrel it away */
- p = malloc(strlen(buf) + 1);
- if (p == NULL)
- {
- perror("Sccs: no mem");
- exit(EX_OSERR);
- }
- strcpy(p, buf);
- }
-
- return (p);
-}
-
-/*
-** ISDIR -- return true if the argument is a directory.
-**
-** Parameters:
-** name -- the pathname of the file to check.
-**
-** Returns:
-** TRUE if 'name' is a directory, FALSE otherwise.
-**
-** Side Effects:
-** none.
-*/
-
-bool
-isdir(name)
- char *name;
-{
- struct stat stbuf;
-
- return (stat(name, &stbuf) >= 0 && (stbuf.st_mode & S_IFMT) == S_IFDIR);
-}
-
-/*
-** SAFEPATH -- determine whether a pathname is "safe"
-**
-** "Safe" pathnames only allow you to get deeper into the
-** directory structure, i.e., full pathnames and ".." are
-** not allowed.
-**
-** Parameters:
-** p -- the name to check.
-**
-** Returns:
-** TRUE -- if the path is safe.
-** FALSE -- if the path is not safe.
-**
-** Side Effects:
-** Prints a message if the path is not safe.
-*/
-
-bool
-safepath(p)
- register char *p;
-{
- extern char *index();
-
- if (*p != '/')
- {
- while (strncmp(p, "../", 3) != 0 && strcmp(p, "..") != 0)
- {
- p = index(p, '/');
- if (p == NULL)
- return (TRUE);
- p++;
- }
- }
-
- printf("You may not use full pathnames or \"..\"\n");
- return (FALSE);
-}
-
-/*
-** CLEAN -- clean out recreatable files
-**
-** Any file for which an "s." file exists but no "p." file
-** exists in the current directory is purged.
-**
-** Parameters:
-** mode -- tells whether this came from a "clean", "info", or
-** "check" command.
-** argv -- the rest of the argument vector.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Removes files in the current directory.
-** Prints information regarding files being edited.
-** Exits if a "check" command.
-*/
-
-clean(mode, argv)
- int mode;
- char **argv;
-{
- struct direct *dir;
- char buf[FBUFSIZ];
- char *bufend;
- register DIR *dirp;
- register char *basefile;
- bool gotedit;
- bool gotpfent;
- FILE *pfp;
- bool nobranch = FALSE;
- extern struct pfile *getpfent();
- register struct pfile *pf;
- register char **ap;
- extern char *username();
- char *usernm = NULL;
- char *subdir = NULL;
- char *cmdname;
-
- /*
- ** Process the argv
- */
-
- cmdname = *argv;
- for (ap = argv; *++ap != NULL; )
- {
- if (**ap == '-')
- {
- /* we have a flag */
- switch ((*ap)[1])
- {
- case 'b':
- nobranch = TRUE;
- break;
-
- case 'u':
- if ((*ap)[2] != '\0')
- usernm = &(*ap)[2];
- else if (ap[1] != NULL && ap[1][0] != '-')
- usernm = *++ap;
- else
- usernm = username();
- break;
- }
- }
- else
- {
- if (subdir != NULL)
- usrerr("too many args");
- else
- subdir = *ap;
- }
- }
-
- /*
- ** Find and open the SCCS directory.
- */
-
- gstrcpy(buf, SccsDir, sizeof(buf));
- if (buf[0] != '\0')
- gstrcat(buf, "/", sizeof(buf));
- if (subdir != NULL)
- {
- gstrcat(buf, subdir, sizeof(buf));
- gstrcat(buf, "/", sizeof(buf));
- }
- gstrcat(buf, SccsPath, sizeof(buf));
- bufend = &buf[strlen(buf)];
-
- dirp = opendir(buf);
- if (dirp == NULL)
- {
- usrerr("cannot open %s", buf);
- return (EX_NOINPUT);
- }
-
- /*
- ** Scan the SCCS directory looking for s. files.
- ** gotedit tells whether we have tried to clean any
- ** files that are being edited.
- */
-
- gotedit = FALSE;
- while (dir = readdir(dirp)) {
- if (strncmp(dir->d_name, "s.", 2) != 0)
- continue;
-
- /* got an s. file -- see if the p. file exists */
- gstrcpy(bufend, "/p.", sizeof(buf));
- basefile = bufend + 3;
- gstrcpy(basefile, &dir->d_name[2], sizeof(buf));
-
- /*
- ** open and scan the p-file.
- ** 'gotpfent' tells if we have found a valid p-file
- ** entry.
- */
-
- pfp = fopen(buf, "r");
- gotpfent = FALSE;
- if (pfp != NULL)
- {
- /* the file exists -- report it's contents */
- while ((pf = getpfent(pfp)) != NULL)
- {
- if (nobranch && isbranch(pf->p_nsid))
- continue;
- if (usernm != NULL && strcmp(usernm, pf->p_user) != 0 && mode != CLEANC)
- continue;
- gotedit = TRUE;
- gotpfent = TRUE;
- if (mode == TELLC)
- {
- printf("%s\n", basefile);
- break;
- }
- printf("%12s: being edited: ", basefile);
- putpfent(pf, stdout);
- }
- fclose(pfp);
- }
-
- /* the s. file exists and no p. file exists -- unlink the g-file */
- if (mode == CLEANC && !gotpfent)
- {
- char unlinkbuf[FBUFSIZ];
- gstrcpy(unlinkbuf, &dir->d_name[2], sizeof(unlinkbuf));
- unlink(unlinkbuf);
- }
- }
-
- /* cleanup & report results */
- closedir(dirp);
- if (!gotedit && mode == INFOC)
- {
- printf("Nothing being edited");
- if (nobranch)
- printf(" (on trunk)");
- if (usernm == NULL)
- printf("\n");
- else
- printf(" by %s\n", usernm);
- }
- if (mode == CHECKC)
- exit(gotedit);
- return (EX_OK);
-}
-
-/*
-** ISBRANCH -- is the SID a branch?
-**
-** Parameters:
-** sid -- the sid to check.
-**
-** Returns:
-** TRUE if the sid represents a branch.
-** FALSE otherwise.
-**
-** Side Effects:
-** none.
-*/
-
-isbranch(sid)
- char *sid;
-{
- register char *p;
- int dots;
-
- dots = 0;
- for (p = sid; *p != '\0'; p++)
- {
- if (*p == '.')
- dots++;
- if (dots > 1)
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
-** UNEDIT -- unedit a file
-**
-** Checks to see that the current user is actually editting
-** the file and arranges that s/he is not editting it.
-**
-** Parameters:
-** fn -- the name of the file to be unedited.
-**
-** Returns:
-** TRUE -- if the file was successfully unedited.
-** FALSE -- if the file was not unedited for some
-** reason.
-**
-** Side Effects:
-** fn is removed
-** entries are removed from pfile.
-*/
-
-bool
-unedit(fn)
- char *fn;
-{
- register FILE *pfp;
- char *cp, *pfn;
- static char tfn[] = _PATH_TMP;
- FILE *tfp;
- register char *q;
- bool delete = FALSE;
- bool others = FALSE;
- char *myname;
- extern char *username();
- struct pfile *pent;
- extern struct pfile *getpfent();
- char buf[PFILELG];
- extern char *makefile(), *rindex(), *tail();
-
- /* make "s." filename & find the trailing component */
- pfn = makefile(fn);
- if (pfn == NULL)
- return (FALSE);
- q = rindex(pfn, '/');
- if (q == NULL)
- q = &pfn[-1];
- if (q[1] != 's' || q[2] != '.')
- {
- usrerr("bad file name \"%s\"", fn);
- return (FALSE);
- }
-
- /* turn "s." into "p." & try to open it */
- *++q = 'p';
-
- pfp = fopen(pfn, "r");
- if (pfp == NULL)
- {
- printf("%12s: not being edited\n", fn);
- return (FALSE);
- }
-
- /* create temp file for editing p-file */
- mktemp(tfn);
- tfp = fopen(tfn, "w");
- if (tfp == NULL)
- {
- usrerr("cannot create \"%s\"", tfn);
- exit(EX_OSERR);
- }
-
- /* figure out who I am */
- myname = username();
-
- /*
- ** Copy p-file to temp file, doing deletions as needed.
- */
-
- while ((pent = getpfent(pfp)) != NULL)
- {
- if (strcmp(pent->p_user, myname) == 0)
- {
- /* a match */
- delete++;
- }
- else
- {
- /* output it again */
- putpfent(pent, tfp);
- others++;
- }
- }
-
- /*
- * Before changing anything, make sure we can remove
- * the file in question (assuming it exists).
- */
- if (delete) {
- extern int errno;
-
- cp = tail(fn);
- errno = 0;
- if (access(cp, 0) < 0 && errno != ENOENT)
- goto bad;
- if (errno == 0)
- /*
- * This is wrong, but the rest of the program
- * has built in assumptions about "." as well,
- * so why make unedit a special case?
- */
- if (access(".", 2) < 0) {
- bad:
- printf("%12s: can't remove\n", cp);
- fclose(tfp);
- fclose(pfp);
- unlink(tfn);
- return (FALSE);
- }
- }
- /* do final cleanup */
- if (others)
- {
- /* copy it back (perhaps it should be linked?) */
- if (freopen(tfn, "r", tfp) == NULL)
- {
- syserr("cannot reopen \"%s\"", tfn);
- exit(EX_OSERR);
- }
- if (freopen(pfn, "w", pfp) == NULL)
- {
- usrerr("cannot create \"%s\"", pfn);
- return (FALSE);
- }
- while (fgets(buf, sizeof buf, tfp) != NULL)
- fputs(buf, pfp);
- }
- else
- {
- /* it's empty -- remove it */
- unlink(pfn);
- }
- fclose(tfp);
- fclose(pfp);
- unlink(tfn);
-
- /* actually remove the g-file */
- if (delete)
- {
- /*
- * Since we've checked above, we can
- * use the return from unlink to
- * determine if the file existed or not.
- */
- if (unlink(cp) >= 0)
- printf("%12s: removed\n", cp);
- return (TRUE);
- }
- else
- {
- printf("%12s: not being edited by you\n", fn);
- return (FALSE);
- }
-}
-
-/*
-** DODIFF -- diff an s-file against a g-file
-**
-** Parameters:
-** getv -- argv for the 'get' command.
-** gfile -- name of the g-file to diff against.
-**
-** Returns:
-** Result of get.
-**
-** Side Effects:
-** none.
-*/
-
-dodiff(getv, gfile)
- char **getv;
- char *gfile;
-{
- int pipev[2];
- int rval;
- register int i;
- register int pid;
- auto int st;
- extern int errno;
- sig_t osig;
-
- printf("\n------- %s -------\n", gfile);
- fflush(stdout);
-
- /* create context for diff to run in */
- if (pipe(pipev) < 0)
- {
- syserr("dodiff: pipe failed");
- exit(EX_OSERR);
- }
- if ((pid = fork()) < 0)
- {
- syserr("dodiff: fork failed");
- exit(EX_OSERR);
- }
- else if (pid > 0)
- {
- /* in parent; run get */
- OutFile = pipev[1];
- close(pipev[0]);
- rval = command(&getv[1], TRUE, "get:rcixt -s -k -p");
- osig = signal(SIGINT, SIG_IGN);
- while (((i = wait(&st)) >= 0 && i != pid) || errno == EINTR)
- errno = 0;
- signal(SIGINT, osig);
- /* ignore result of diff */
- }
- else
- {
- /* in child, run diff */
- if (close(pipev[1]) < 0 || close(0) < 0 ||
- dup(pipev[0]) != 0 || close(pipev[0]) < 0)
- {
- syserr("dodiff: magic failed");
- exit(EX_OSERR);
- }
- command(&getv[1], FALSE, "-diff:elsfhbC");
- }
- return (rval);
-}
-
-/*
-** TAIL -- return tail of filename.
-**
-** Parameters:
-** fn -- the filename.
-**
-** Returns:
-** a pointer to the tail of the filename; e.g., given
-** "cmd/ls.c", "ls.c" is returned.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-tail(fn)
- register char *fn;
-{
- register char *p;
-
- for (p = fn; *p != 0; p++)
- if (*p == '/' && p[1] != '\0' && p[1] != '/')
- fn = &p[1];
- return (fn);
-}
-
-/*
-** GETPFENT -- get an entry from the p-file
-**
-** Parameters:
-** pfp -- p-file file pointer
-**
-** Returns:
-** pointer to p-file struct for next entry
-** NULL on EOF or error
-**
-** Side Effects:
-** Each call wipes out results of previous call.
-*/
-
-struct pfile *
-getpfent(pfp)
- FILE *pfp;
-{
- static struct pfile ent;
- static char buf[PFILELG];
- register char *p;
- extern char *nextfield();
-
- if (fgets(buf, sizeof buf, pfp) == NULL)
- return (NULL);
-
- ent.p_osid = p = buf;
- ent.p_nsid = p = nextfield(p);
- ent.p_user = p = nextfield(p);
- ent.p_date = p = nextfield(p);
- ent.p_time = p = nextfield(p);
- ent.p_aux = p = nextfield(p);
-
- return (&ent);
-}
-
-
-char *
-nextfield(p)
- register char *p;
-{
- if (p == NULL || *p == '\0')
- return (NULL);
- while (*p != ' ' && *p != '\n' && *p != '\0')
- p++;
- if (*p == '\n' || *p == '\0')
- {
- *p = '\0';
- return (NULL);
- }
- *p++ = '\0';
- return (p);
-}
- /*
-** PUTPFENT -- output a p-file entry to a file
-**
-** Parameters:
-** pf -- the p-file entry
-** f -- the file to put it on.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** pf is written onto file f.
-*/
-
-putpfent(pf, f)
- register struct pfile *pf;
- register FILE *f;
-{
- fprintf(f, "%s %s %s %s %s", pf->p_osid, pf->p_nsid,
- pf->p_user, pf->p_date, pf->p_time);
- if (pf->p_aux != NULL)
- fprintf(f, " %s", pf->p_aux);
- else
- fprintf(f, "\n");
-}
-
-/*
-** USRERR -- issue user-level error
-**
-** Parameters:
-** f -- format string.
-** p1-p3 -- parameters to a printf.
-**
-** Returns:
-** -1
-**
-** Side Effects:
-** none.
-*/
-
-/*VARARGS1*/
-usrerr(f, p1, p2, p3)
- char *f;
-{
- fprintf(stderr, "\n%s: ", MyName);
- fprintf(stderr, f, p1, p2, p3);
- fprintf(stderr, "\n");
-
- return (-1);
-}
-
-/*
-** SYSERR -- print system-generated error.
-**
-** Parameters:
-** f -- format string to a printf.
-** p1, p2, p3 -- parameters to f.
-**
-** Returns:
-** never.
-**
-** Side Effects:
-** none.
-*/
-
-/*VARARGS1*/
-syserr(f, p1, p2, p3)
- char *f;
-{
- extern int errno;
-
- fprintf(stderr, "\n%s SYSERR: ", MyName);
- fprintf(stderr, f, p1, p2, p3);
- fprintf(stderr, "\n");
- if (errno == 0)
- exit(EX_SOFTWARE);
- else
- {
- perror(NULL);
- exit(EX_OSERR);
- }
-}
- /*
-** USERNAME -- return name of the current user
-**
-** Parameters:
-** none
-**
-** Returns:
-** name of current user
-**
-** Side Effects:
-** none
-*/
-
-char *
-username()
-{
-# ifdef UIDUSER
- extern struct passwd *getpwuid();
- register struct passwd *pw;
-
- pw = getpwuid(getuid());
- if (pw == NULL)
- {
- syserr("who are you? (uid=%d)", getuid());
- exit(EX_OSERR);
- }
- return (pw->pw_name);
-# else
- extern char *getlogin();
- register char *p;
-
- p = getenv("USER");
- if (p == NULL || p[0] == '\0')
- p = getlogin();
- return (p);
-# endif UIDUSER
-}
-
-/*
-** Guarded string manipulation routines; the last argument
-** is the length of the buffer into which the strcpy or strcat
-** is to be done.
-*/
-char *gstrcat(to, from, length)
- char *to, *from;
- int length;
-{
- if (strlen(from) + strlen(to) >= length) {
- gstrbotch(to, from);
- }
- return(strcat(to, from));
-}
-
-char *gstrncat(to, from, n, length)
- char *to, *from;
- int n;
- int length;
-{
- if (n + strlen(to) >= length) {
- gstrbotch(to, from);
- }
- return(strncat(to, from, n));
-}
-
-char *gstrcpy(to, from, length)
- char *to, *from;
- int length;
-{
- if (strlen(from) >= length) {
- gstrbotch(from, (char *)0);
- }
- return(strcpy(to, from));
-}
-gstrbotch(str1, str2)
- char *str1, *str2;
-{
- usrerr("Filename(s) too long: %s %s", str1, str2);
-}
diff --git a/usr.bin/tip/acu.c b/usr.bin/tip/acu.c
deleted file mode 100644
index f7bde99..0000000
--- a/usr.bin/tip/acu.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-static acu_t *acu = NOACU;
-static int conflag;
-static void acuabort();
-static acu_t *acutype();
-static jmp_buf jmpbuf;
-/*
- * Establish connection for tip
- *
- * If DU is true, we should dial an ACU whose type is AT.
- * The phone numbers are in PN, and the call unit is in CU.
- *
- * If the PN is an '@', then we consult the PHONES file for
- * the phone numbers. This file is /etc/phones, unless overriden
- * by an exported shell variable.
- *
- * The data base files must be in the format:
- * host-name[ \t]*phone-number
- * with the possibility of multiple phone numbers
- * for a single host acting as a rotary (in the order
- * found in the file).
- */
-char *
-connect()
-{
- register char *cp = PN;
- char *phnum, string[256];
- FILE *fd;
- int tried = 0;
-
- if (!DU) { /* regular connect message */
- if (CM != NOSTR)
- pwrite(FD, CM, size(CM));
- logent(value(HOST), "", DV, "call completed");
- return (NOSTR);
- }
- /*
- * @ =>'s use data base in PHONES environment variable
- * otherwise, use /etc/phones
- */
- signal(SIGINT, acuabort);
- signal(SIGQUIT, acuabort);
- if (setjmp(jmpbuf)) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- printf("\ncall aborted\n");
- logent(value(HOST), "", "", "call aborted");
- if (acu != NOACU) {
- boolean(value(VERBOSE)) = FALSE;
- if (conflag)
- disconnect(NOSTR);
- else
- (*acu->acu_abort)();
- }
- return ("interrupt");
- }
- if ((acu = acutype(AT)) == NOACU)
- return ("unknown ACU type");
- if (*cp != '@') {
- while (*cp) {
- for (phnum = cp; *cp && *cp != ','; cp++)
- ;
- if (*cp)
- *cp++ = '\0';
-
- if (conflag = (*acu->acu_dialer)(phnum, CU)) {
- if (CM != NOSTR)
- pwrite(FD, CM, size(CM));
- logent(value(HOST), phnum, acu->acu_name,
- "call completed");
- return (NOSTR);
- } else
- logent(value(HOST), phnum, acu->acu_name,
- "call failed");
- tried++;
- }
- } else {
- if ((fd = fopen(PH, "r")) == NOFILE) {
- printf("%s: ", PH);
- return ("can't open phone number file");
- }
- while (fgets(string, sizeof(string), fd) != NOSTR) {
- for (cp = string; !any(*cp, " \t\n"); cp++)
- ;
- if (*cp == '\n') {
- fclose(fd);
- return ("unrecognizable host name");
- }
- *cp++ = '\0';
- if (strcmp(string, value(HOST)))
- continue;
- while (any(*cp, " \t"))
- cp++;
- if (*cp == '\n') {
- fclose(fd);
- return ("missing phone number");
- }
- for (phnum = cp; *cp && *cp != ',' && *cp != '\n'; cp++)
- ;
- if (*cp)
- *cp++ = '\0';
-
- if (conflag = (*acu->acu_dialer)(phnum, CU)) {
- fclose(fd);
- if (CM != NOSTR)
- pwrite(FD, CM, size(CM));
- logent(value(HOST), phnum, acu->acu_name,
- "call completed");
- return (NOSTR);
- } else
- logent(value(HOST), phnum, acu->acu_name,
- "call failed");
- tried++;
- }
- fclose(fd);
- }
- if (!tried)
- logent(value(HOST), "", acu->acu_name, "missing phone number");
- else
- (*acu->acu_abort)();
- return (tried ? "call failed" : "missing phone number");
-}
-
-disconnect(reason)
- char *reason;
-{
- if (!conflag) {
- logent(value(HOST), "", DV, "call terminated");
- return;
- }
- if (reason == NOSTR) {
- logent(value(HOST), "", acu->acu_name, "call terminated");
- if (boolean(value(VERBOSE)))
- printf("\r\ndisconnecting...");
- } else
- logent(value(HOST), "", acu->acu_name, reason);
- (*acu->acu_disconnect)();
-}
-
-static void
-acuabort(s)
-{
- signal(s, SIG_IGN);
- longjmp(jmpbuf, 1);
-}
-
-static acu_t *
-acutype(s)
- register char *s;
-{
- register acu_t *p;
- extern acu_t acutable[];
-
- for (p = acutable; p->acu_name != '\0'; p++)
- if (!strcmp(s, p->acu_name))
- return (p);
- return (NOACU);
-}
diff --git a/usr.bin/tip/aculib/biz22.c b/usr.bin/tip/aculib/biz22.c
deleted file mode 100644
index 93c5e53..0000000
--- a/usr.bin/tip/aculib/biz22.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-#define DISCONNECT_CMD "\20\04" /* disconnection string */
-
-static void sigALRM();
-static int timeout = 0;
-static jmp_buf timeoutbuf;
-
-/*
- * Dial up on a BIZCOMP Model 1022 with either
- * tone dialing (mod = "V")
- * pulse dialing (mod = "W")
- */
-static int
-biz_dialer(num, mod)
- char *num, *mod;
-{
- register int connected = 0;
- char cbuf[40];
- static int cmd(), detect();
-
- if (boolean(value(VERBOSE)))
- printf("\nstarting call...");
- /*
- * Disable auto-answer and configure for tone/pulse
- * dialing
- */
- if (cmd("\02K\r")) {
- printf("can't initialize bizcomp...");
- return (0);
- }
- strcpy(cbuf, "\02.\r");
- cbuf[1] = *mod;
- if (cmd(cbuf)) {
- printf("can't set dialing mode...");
- return (0);
- }
- strcpy(cbuf, "\02D");
- strcat(cbuf, num);
- strcat(cbuf, "\r");
- write(FD, cbuf, strlen(cbuf));
- if (!detect("7\r")) {
- printf("can't get dial tone...");
- return (0);
- }
- if (boolean(value(VERBOSE)))
- printf("ringing...");
- /*
- * The reply from the BIZCOMP should be:
- * 2 \r or 7 \r failure
- * 1 \r success
- */
- connected = detect("1\r");
-#ifdef ACULOG
- if (timeout) {
- char line[80];
-
- sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
- logent(value(HOST), num, "biz1022", line);
- }
-#endif
- if (timeout)
- biz22_disconnect(); /* insurance */
- return (connected);
-}
-
-biz22w_dialer(num, acu)
- char *num, *acu;
-{
-
- return (biz_dialer(num, "W"));
-}
-
-biz22f_dialer(num, acu)
- char *num, *acu;
-{
-
- return (biz_dialer(num, "V"));
-}
-
-biz22_disconnect()
-{
- int rw = 2;
-
- write(FD, DISCONNECT_CMD, 4);
- sleep(2);
- ioctl(FD, TIOCFLUSH, &rw);
-}
-
-biz22_abort()
-{
-
- write(FD, "\02", 1);
-}
-
-static void
-sigALRM()
-{
-
- timeout = 1;
- longjmp(timeoutbuf, 1);
-}
-
-static int
-cmd(s)
- register char *s;
-{
- sig_t f;
- char c;
-
- write(FD, s, strlen(s));
- f = signal(SIGALRM, sigALRM);
- if (setjmp(timeoutbuf)) {
- biz22_abort();
- signal(SIGALRM, f);
- return (1);
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, &c, 1);
- alarm(0);
- signal(SIGALRM, f);
- c &= 0177;
- return (c != '\r');
-}
-
-static int
-detect(s)
- register char *s;
-{
- sig_t f;
- char c;
-
- f = signal(SIGALRM, sigALRM);
- timeout = 0;
- while (*s) {
- if (setjmp(timeoutbuf)) {
- biz22_abort();
- break;
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, &c, 1);
- alarm(0);
- c &= 0177;
- if (c != *s++)
- return (0);
- }
- signal(SIGALRM, f);
- return (timeout == 0);
-}
diff --git a/usr.bin/tip/aculib/biz31.c b/usr.bin/tip/aculib/biz31.c
deleted file mode 100644
index 412974d..0000000
--- a/usr.bin/tip/aculib/biz31.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)biz31.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-#define MAXRETRY 3 /* sync up retry count */
-#define DISCONNECT_CMD "\21\25\11\24" /* disconnection string */
-
-static void sigALRM();
-static int timeout = 0;
-static jmp_buf timeoutbuf;
-
-/*
- * Dial up on a BIZCOMP Model 1031 with either
- * tone dialing (mod = "f")
- * pulse dialing (mod = "w")
- */
-static int
-biz_dialer(num, mod)
- char *num, *mod;
-{
- register int connected = 0;
-
- if (!bizsync(FD)) {
- logent(value(HOST), "", "biz", "out of sync");
- printf("bizcomp out of sync\n");
- delock(uucplock);
- exit(0);
- }
- if (boolean(value(VERBOSE)))
- printf("\nstarting call...");
- echo("#\rk$\r$\n"); /* disable auto-answer */
- echo("$>$.$ #\r"); /* tone/pulse dialing */
- echo(mod);
- echo("$\r$\n");
- echo("$>$.$ #\re$ "); /* disconnection sequence */
- echo(DISCONNECT_CMD);
- echo("\r$\n$\r$\n");
- echo("$>$.$ #\rr$ "); /* repeat dial */
- echo(num);
- echo("\r$\n");
- if (boolean(value(VERBOSE)))
- printf("ringing...");
- /*
- * The reply from the BIZCOMP should be:
- * `^G NO CONNECTION\r\n^G\r\n' failure
- * ` CONNECTION\r\n^G' success
- */
- connected = detect(" ");
-#ifdef ACULOG
- if (timeout) {
- char line[80];
-
- sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
- logent(value(HOST), num, "biz", line);
- }
-#endif
- if (!connected)
- flush(" NO CONNECTION\r\n\07\r\n");
- else
- flush("CONNECTION\r\n\07");
- if (timeout)
- biz31_disconnect(); /* insurance */
- return (connected);
-}
-
-biz31w_dialer(num, acu)
- char *num, *acu;
-{
-
- return (biz_dialer(num, "w"));
-}
-
-biz31f_dialer(num, acu)
- char *num, *acu;
-{
-
- return (biz_dialer(num, "f"));
-}
-
-biz31_disconnect()
-{
-
- write(FD, DISCONNECT_CMD, 4);
- sleep(2);
- ioctl(FD, TIOCFLUSH);
-}
-
-biz31_abort()
-{
-
- write(FD, "\33", 1);
-}
-
-static int
-echo(s)
- register char *s;
-{
- char c;
-
- while (c = *s++) switch (c) {
-
- case '$':
- read(FD, &c, 1);
- s++;
- break;
-
- case '#':
- c = *s++;
- write(FD, &c, 1);
- break;
-
- default:
- write(FD, &c, 1);
- read(FD, &c, 1);
- }
-}
-
-static void
-sigALRM()
-{
-
- timeout = 1;
- longjmp(timeoutbuf, 1);
-}
-
-static int
-detect(s)
- register char *s;
-{
- sig_t f;
- char c;
-
- f = signal(SIGALRM, sigALRM);
- timeout = 0;
- while (*s) {
- if (setjmp(timeoutbuf)) {
- printf("\07timeout waiting for reply\n");
- biz31_abort();
- break;
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, &c, 1);
- alarm(0);
- if (c != *s++)
- break;
- }
- signal(SIGALRM, f);
- return (timeout == 0);
-}
-
-static int
-flush(s)
- register char *s;
-{
- sig_t f;
- char c;
-
- f = signal(SIGALRM, sigALRM);
- while (*s++) {
- if (setjmp(timeoutbuf))
- break;
- alarm(10);
- read(FD, &c, 1);
- alarm(0);
- }
- signal(SIGALRM, f);
- timeout = 0; /* guard against disconnection */
-}
-
-/*
- * This convoluted piece of code attempts to get
- * the bizcomp in sync. If you don't have the capacity or nread
- * call there are gory ways to simulate this.
- */
-static int
-bizsync(fd)
-{
-#ifdef FIOCAPACITY
- struct capacity b;
-# define chars(b) ((b).cp_nbytes)
-# define IOCTL FIOCAPACITY
-#endif
-#ifdef FIONREAD
- long b;
-# define chars(b) (b)
-# define IOCTL FIONREAD
-#endif
- register int already = 0;
- char buf[10];
-
-retry:
- if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0 && chars(b) > 0)
- ioctl(fd, TIOCFLUSH);
- write(fd, "\rp>\r", 4);
- sleep(1);
- if (ioctl(fd, IOCTL, (caddr_t)&b) >= 0) {
- if (chars(b) != 10) {
- nono:
- if (already > MAXRETRY)
- return (0);
- write(fd, DISCONNECT_CMD, 4);
- sleep(2);
- already++;
- goto retry;
- } else {
- read(fd, buf, 10);
- if (strncmp(buf, "p >\r\n\r\n>", 8))
- goto nono;
- }
- }
- return (1);
-}
diff --git a/usr.bin/tip/aculib/courier.c b/usr.bin/tip/aculib/courier.c
deleted file mode 100644
index 85f7b0d..0000000
--- a/usr.bin/tip/aculib/courier.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)courier.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for calling up on a Courier modem.
- * Derived from Hayes driver.
- */
-#include "tip.h"
-#include <stdio.h>
-
-#define MAXRETRY 5
-
-static void sigALRM();
-static int timeout = 0;
-static int connected = 0;
-static jmp_buf timeoutbuf, intbuf;
-static int coursync();
-
-cour_dialer(num, acu)
- register char *num;
- char *acu;
-{
- register char *cp;
-#ifdef ACULOG
- char line[80];
-#endif
- static int cour_connect(), cour_swallow();
-
- if (boolean(value(VERBOSE)))
- printf("Using \"%s\"\n", acu);
-
- ioctl(FD, TIOCHPCL, 0);
- /*
- * Get in synch.
- */
- if (!coursync()) {
-badsynch:
- printf("can't synchronize with courier\n");
-#ifdef ACULOG
- logent(value(HOST), num, "courier", "can't synch up");
-#endif
- return (0);
- }
- cour_write(FD, "AT E0\r", 6); /* turn off echoing */
- sleep(1);
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- cour_verbose_read();
-#endif
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
- cour_write(FD, "AT C1 E0 H0 Q0 X6 V1\r", 21);
- if (!cour_swallow("\r\nOK\r\n"))
- goto badsynch;
- fflush(stdout);
- cour_write(FD, "AT D", 4);
- for (cp = num; *cp; cp++)
- if (*cp == '=')
- *cp = ',';
- cour_write(FD, num, strlen(num));
- cour_write(FD, "\r", 1);
- connected = cour_connect();
-#ifdef ACULOG
- if (timeout) {
- sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
- logent(value(HOST), num, "cour", line);
- }
-#endif
- if (timeout)
- cour_disconnect();
- return (connected);
-}
-
-cour_disconnect()
-{
- /* first hang up the modem*/
- ioctl(FD, TIOCCDTR, 0);
- sleep(1);
- ioctl(FD, TIOCSDTR, 0);
- coursync(); /* reset */
- close(FD);
-}
-
-cour_abort()
-{
- cour_write(FD, "\r", 1); /* send anything to abort the call */
- cour_disconnect();
-}
-
-static void
-sigALRM()
-{
- printf("\07timeout waiting for reply\n");
- timeout = 1;
- longjmp(timeoutbuf, 1);
-}
-
-static int
-cour_swallow(match)
- register char *match;
- {
- sig_t f;
- char c;
-
- f = signal(SIGALRM, sigALRM);
- timeout = 0;
- do {
- if (*match =='\0') {
- signal(SIGALRM, f);
- return (1);
- }
- if (setjmp(timeoutbuf)) {
- signal(SIGALRM, f);
- return (0);
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, &c, 1);
- alarm(0);
- c &= 0177;
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- putchar(c);
-#endif
- } while (c == *match++);
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- fflush(stdout);
-#endif
- signal(SIGALRM, SIG_DFL);
- return (0);
-}
-
-struct baud_msg {
- char *msg;
- int baud;
-} baud_msg[] = {
- "", B300,
- " 1200", B1200,
- " 2400", B2400,
- " 9600", B9600,
- " 9600/ARQ", B9600,
- 0, 0,
-};
-
-static int
-cour_connect()
-{
- char c;
- int nc, nl, n;
- struct sgttyb sb;
- char dialer_buf[64];
- struct baud_msg *bm;
- sig_t f;
-
- if (cour_swallow("\r\n") == 0)
- return (0);
- f = signal(SIGALRM, sigALRM);
-again:
- nc = 0; nl = sizeof(dialer_buf)-1;
- bzero(dialer_buf, sizeof(dialer_buf));
- timeout = 0;
- for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) {
- if (setjmp(timeoutbuf))
- break;
- alarm(number(value(DIALTIMEOUT)));
- n = read(FD, &c, 1);
- alarm(0);
- if (n <= 0)
- break;
- c &= 0x7f;
- if (c == '\r') {
- if (cour_swallow("\n") == 0)
- break;
- if (!dialer_buf[0])
- goto again;
- if (strcmp(dialer_buf, "RINGING") == 0 &&
- boolean(value(VERBOSE))) {
-#ifdef DEBUG
- printf("%s\r\n", dialer_buf);
-#endif
- goto again;
- }
- if (strncmp(dialer_buf, "CONNECT",
- sizeof("CONNECT")-1) != 0)
- break;
- for (bm = baud_msg ; bm->msg ; bm++)
- if (strcmp(bm->msg,
- dialer_buf+sizeof("CONNECT")-1) == 0) {
- if (ioctl(FD, TIOCGETP, &sb) < 0) {
- perror("TIOCGETP");
- goto error;
- }
- sb.sg_ispeed = sb.sg_ospeed = bm->baud;
- if (ioctl(FD, TIOCSETP, &sb) < 0) {
- perror("TIOCSETP");
- goto error;
- }
- signal(SIGALRM, f);
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- printf("%s\r\n", dialer_buf);
-#endif
- return (1);
- }
- break;
- }
- dialer_buf[nc] = c;
-#ifdef notdef
- if (boolean(value(VERBOSE)))
- putchar(c);
-#endif
- }
-error1:
- printf("%s\r\n", dialer_buf);
-error:
- signal(SIGALRM, f);
- return (0);
-}
-
-/*
- * This convoluted piece of code attempts to get
- * the courier in sync.
- */
-static int
-coursync()
-{
- int already = 0;
- int len;
- char buf[40];
-
- while (already++ < MAXRETRY) {
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
- cour_write(FD, "\rAT Z\r", 6); /* reset modem */
- bzero(buf, sizeof(buf));
- sleep(1);
- ioctl(FD, FIONREAD, &len);
- if (len) {
- len = read(FD, buf, sizeof(buf));
-#ifdef DEBUG
- buf[len] = '\0';
- printf("coursync: (\"%s\")\n\r", buf);
-#endif
- if (index(buf, '0') ||
- (index(buf, 'O') && index(buf, 'K')))
- return(1);
- }
- /*
- * If not strapped for DTR control,
- * try to get command mode.
- */
- sleep(1);
- cour_write(FD, "+++", 3);
- sleep(1);
- /*
- * Toggle DTR to force anyone off that might have left
- * the modem connected.
- */
- ioctl(FD, TIOCCDTR, 0);
- sleep(1);
- ioctl(FD, TIOCSDTR, 0);
- }
- cour_write(FD, "\rAT Z\r", 6);
- return (0);
-}
-
-cour_write(fd, cp, n)
-int fd;
-char *cp;
-int n;
-{
- struct sgttyb sb;
-#ifdef notdef
- if (boolean(value(VERBOSE)))
- write(1, cp, n);
-#endif
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
- cour_nap();
- for ( ; n-- ; cp++) {
- write(fd, cp, 1);
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
- cour_nap();
- }
-}
-
-#ifdef DEBUG
-cour_verbose_read()
-{
- int n = 0;
- char buf[BUFSIZ];
-
- if (ioctl(FD, FIONREAD, &n) < 0)
- return;
- if (n <= 0)
- return;
- if (read(FD, buf, n) != n)
- return;
- write(1, buf, n);
-}
-#endif
-
-/*
- * Code stolen from /usr/src/lib/libc/gen/sleep.c
- */
-#define mask(s) (1<<((s)-1))
-#define setvec(vec, a) \
- vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0
-
-static napms = 50; /* Give the courier 50 milliseconds between characters */
-
-static int ringring;
-
-cour_nap()
-{
-
- static void cour_napx();
- int omask;
- struct itimerval itv, oitv;
- register struct itimerval *itp = &itv;
- struct sigvec vec, ovec;
-
- timerclear(&itp->it_interval);
- timerclear(&itp->it_value);
- if (setitimer(ITIMER_REAL, itp, &oitv) < 0)
- return;
- setvec(ovec, SIG_DFL);
- omask = sigblock(mask(SIGALRM));
- itp->it_value.tv_sec = napms/1000;
- itp->it_value.tv_usec = ((napms%1000)*1000);
- setvec(vec, cour_napx);
- ringring = 0;
- (void) sigvec(SIGALRM, &vec, &ovec);
- (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0);
- while (!ringring)
- sigpause(omask &~ mask(SIGALRM));
- (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0);
- (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0);
- (void) sigsetmask(omask);
-}
-
-static void
-cour_napx()
-{
- ringring = 1;
-}
diff --git a/usr.bin/tip/aculib/df.c b/usr.bin/tip/aculib/df.c
deleted file mode 100644
index 5f294f9..0000000
--- a/usr.bin/tip/aculib/df.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)df.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Dial the DF02-AC or DF03-AC
- */
-
-#include "tip.h"
-
-static jmp_buf Sjbuf;
-static void timeout();
-
-df02_dialer(num, acu)
- char *num, *acu;
-{
-
- return (df_dialer(num, acu, 0));
-}
-
-df03_dialer(num, acu)
- char *num, *acu;
-{
-
- return (df_dialer(num, acu, 1));
-}
-
-df_dialer(num, acu, df03)
- char *num, *acu;
- int df03;
-{
- register int f = FD;
- struct sgttyb buf;
- int speed = 0, rw = 2;
- char c = '\0';
-
- ioctl(f, TIOCHPCL, 0); /* make sure it hangs up when done */
- if (setjmp(Sjbuf)) {
- printf("connection timed out\r\n");
- df_disconnect();
- return (0);
- }
- if (boolean(value(VERBOSE)))
- printf("\ndialing...");
- fflush(stdout);
-#ifdef TIOCMSET
- if (df03) {
- int st = TIOCM_ST; /* secondary Transmit flag */
-
- ioctl(f, TIOCGETP, &buf);
- if (buf.sg_ospeed != B1200) { /* must dial at 1200 baud */
- speed = buf.sg_ospeed;
- buf.sg_ospeed = buf.sg_ispeed = B1200;
- ioctl(f, TIOCSETP, &buf);
- ioctl(f, TIOCMBIC, &st); /* clear ST for 300 baud */
- } else
- ioctl(f, TIOCMBIS, &st); /* set ST for 1200 baud */
- }
-#endif
- signal(SIGALRM, timeout);
- alarm(5 * strlen(num) + 10);
- ioctl(f, TIOCFLUSH, &rw);
- write(f, "\001", 1);
- sleep(1);
- write(f, "\002", 1);
- write(f, num, strlen(num));
- read(f, &c, 1);
-#ifdef TIOCMSET
- if (df03 && speed) {
- buf.sg_ispeed = buf.sg_ospeed = speed;
- ioctl(f, TIOCSETP, &buf);
- }
-#endif
- return (c == 'A');
-}
-
-df_disconnect()
-{
- int rw = 2;
-
- write(FD, "\001", 1);
- sleep(1);
- ioctl(FD, TIOCFLUSH, &rw);
-}
-
-
-df_abort()
-{
-
- df_disconnect();
-}
-
-
-static void
-timeout()
-{
-
- longjmp(Sjbuf, 1);
-}
diff --git a/usr.bin/tip/aculib/dn11.c b/usr.bin/tip/aculib/dn11.c
deleted file mode 100644
index 152b376..0000000
--- a/usr.bin/tip/aculib/dn11.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)dn11.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for dialing up on DN-11
- */
-#include "tip.h"
-
-int dn_abort();
-void alarmtr();
-static jmp_buf jmpbuf;
-static int child = -1, dn;
-
-dn_dialer(num, acu)
- char *num, *acu;
-{
- extern errno;
- char *p, *q, phone[40];
- int lt, nw, connected = 1;
- register int timelim;
-
- if (boolean(value(VERBOSE)))
- printf("\nstarting call...");
- if ((dn = open(acu, 1)) < 0) {
- if (errno == EBUSY)
- printf("line busy...");
- else
- printf("acu open error...");
- return (0);
- }
- if (setjmp(jmpbuf)) {
- kill(child, SIGKILL);
- close(dn);
- return (0);
- }
- signal(SIGALRM, alarmtr);
- timelim = 5 * strlen(num);
- alarm(timelim < 30 ? 30 : timelim);
- if ((child = fork()) == 0) {
- /*
- * ignore this stuff for aborts
- */
- signal(SIGALRM, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- sleep(2);
- nw = write(dn, num, lt = strlen(num));
- exit(nw != lt);
- }
- /*
- * open line - will return on carrier
- */
- if ((FD = open(DV, 2)) < 0) {
- if (errno == EIO)
- printf("lost carrier...");
- else
- printf("dialup line open failed...");
- alarm(0);
- kill(child, SIGKILL);
- close(dn);
- return (0);
- }
- alarm(0);
- ioctl(dn, TIOCHPCL, 0);
- signal(SIGALRM, SIG_DFL);
- while ((nw = wait(&lt)) != child && nw != -1)
- ;
- fflush(stdout);
- close(dn);
- if (lt != 0) {
- close(FD);
- return (0);
- }
- return (1);
-}
-
-void
-alarmtr()
-{
- alarm(0);
- longjmp(jmpbuf, 1);
-}
-
-/*
- * Insurance, for some reason we don't seem to be
- * hanging up...
- */
-dn_disconnect()
-{
-
- sleep(2);
- if (FD > 0)
- ioctl(FD, TIOCCDTR, 0);
- close(FD);
-}
-
-dn_abort()
-{
-
- sleep(2);
- if (child > 0)
- kill(child, SIGKILL);
- if (dn > 0)
- close(dn);
- if (FD > 0)
- ioctl(FD, TIOCCDTR, 0);
- close(FD);
-}
diff --git a/usr.bin/tip/aculib/hayes.c b/usr.bin/tip/aculib/hayes.c
deleted file mode 100644
index a2196f4..0000000
--- a/usr.bin/tip/aculib/hayes.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)hayes.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for calling up on a Hayes Modem
- * (based on the old VenTel driver).
- * The modem is expected to be strapped for "echo".
- * Also, the switches enabling the DTR and CD lines
- * must be set correctly.
- * NOTICE:
- * The easy way to hang up a modem is always simply to
- * clear the DTR signal. However, if the +++ sequence
- * (which switches the modem back to local mode) is sent
- * before modem is hung up, removal of the DTR signal
- * has no effect (except that it prevents the modem from
- * recognizing commands).
- * (by Helge Skrivervik, Calma Company, Sunnyvale, CA. 1984)
- */
-/*
- * TODO:
- * It is probably not a good idea to switch the modem
- * state between 'verbose' and terse (status messages).
- * This should be kicked out and we should use verbose
- * mode only. This would make it consistent with normal
- * interactive use thru the command 'tip dialer'.
- */
-#include "tip.h"
-
-#define min(a,b) ((a < b) ? a : b)
-
-static void sigALRM();
-static int timeout = 0;
-static jmp_buf timeoutbuf;
-static char gobble();
-#define DUMBUFLEN 40
-static char dumbuf[DUMBUFLEN];
-
-#define DIALING 1
-#define IDLE 2
-#define CONNECTED 3
-#define FAILED 4
-static int state = IDLE;
-
-hay_dialer(num, acu)
- register char *num;
- char *acu;
-{
- register char *cp;
- register int connected = 0;
- char dummy;
-#ifdef ACULOG
- char line[80];
-#endif
- if (hay_sync() == 0) /* make sure we can talk to the modem */
- return(0);
- if (boolean(value(VERBOSE)))
- printf("\ndialing...");
- fflush(stdout);
- ioctl(FD, TIOCHPCL, 0);
- ioctl(FD, TIOCFLUSH, 0); /* get rid of garbage */
- write(FD, "ATv0\r", 5); /* tell modem to use short status codes */
- gobble("\r");
- gobble("\r");
- write(FD, "ATTD", 4); /* send dial command */
- write(FD, num, strlen(num));
- state = DIALING;
- write(FD, "\r", 1);
- connected = 0;
- if (gobble("\r")) {
- if ((dummy = gobble("01234")) != '1')
- error_rep(dummy);
- else
- connected = 1;
- }
- if (connected)
- state = CONNECTED;
- else {
- state = FAILED;
- return (connected); /* lets get out of here.. */
- }
- ioctl(FD, TIOCFLUSH, 0);
-#ifdef ACULOG
- if (timeout) {
- sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
- logent(value(HOST), num, "hayes", line);
- }
-#endif
- if (timeout)
- hay_disconnect(); /* insurance */
- return (connected);
-}
-
-
-hay_disconnect()
-{
- char c;
- int len, rlen;
-
- /* first hang up the modem*/
-#ifdef DEBUG
- printf("\rdisconnecting modem....\n\r");
-#endif
- ioctl(FD, TIOCCDTR, 0);
- sleep(1);
- ioctl(FD, TIOCSDTR, 0);
- goodbye();
-}
-
-hay_abort()
-{
-
- char c;
-
- write(FD, "\r", 1); /* send anything to abort the call */
- hay_disconnect();
-}
-
-static void
-sigALRM()
-{
-
- printf("\07timeout waiting for reply\n\r");
- timeout = 1;
- longjmp(timeoutbuf, 1);
-}
-
-static char
-gobble(match)
- register char *match;
-{
- char c;
- sig_t f;
- int i, status = 0;
-
- f = signal(SIGALRM, sigALRM);
- timeout = 0;
-#ifdef DEBUG
- printf("\ngobble: waiting for %s\n", match);
-#endif
- do {
- if (setjmp(timeoutbuf)) {
- signal(SIGALRM, f);
- return (0);
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, &c, 1);
- alarm(0);
- c &= 0177;
-#ifdef DEBUG
- printf("%c 0x%x ", c, c);
-#endif
- for (i = 0; i < strlen(match); i++)
- if (c == match[i])
- status = c;
- } while (status == 0);
- signal(SIGALRM, SIG_DFL);
-#ifdef DEBUG
- printf("\n");
-#endif
- return (status);
-}
-
-error_rep(c)
- register char c;
-{
- printf("\n\r");
- switch (c) {
-
- case '0':
- printf("OK");
- break;
-
- case '1':
- printf("CONNECT");
- break;
-
- case '2':
- printf("RING");
- break;
-
- case '3':
- printf("NO CARRIER");
- break;
-
- case '4':
- printf("ERROR in input");
- break;
-
- case '5':
- printf("CONNECT 1200");
- break;
-
- default:
- printf("Unknown Modem error: %c (0x%x)", c, c);
- }
- printf("\n\r");
- return;
-}
-
-/*
- * set modem back to normal verbose status codes.
- */
-goodbye()
-{
- int len, rlen;
- char c;
-
- ioctl(FD, TIOCFLUSH, &len); /* get rid of trash */
- if (hay_sync()) {
- sleep(1);
-#ifndef DEBUG
- ioctl(FD, TIOCFLUSH, 0);
-#endif
- write(FD, "ATH0\r", 5); /* insurance */
-#ifndef DEBUG
- c = gobble("03");
- if (c != '0' && c != '3') {
- printf("cannot hang up modem\n\r");
- printf("please use 'tip dialer' to make sure the line is hung up\n\r");
- }
-#endif
- sleep(1);
- ioctl(FD, FIONREAD, &len);
-#ifdef DEBUG
- printf("goodbye1: len=%d -- ", len);
- rlen = read(FD, dumbuf, min(len, DUMBUFLEN));
- dumbuf[rlen] = '\0';
- printf("read (%d): %s\r\n", rlen, dumbuf);
-#endif
- write(FD, "ATv1\r", 5);
- sleep(1);
-#ifdef DEBUG
- ioctl(FD, FIONREAD, &len);
- printf("goodbye2: len=%d -- ", len);
- rlen = read(FD, dumbuf, min(len, DUMBUFLEN));
- dumbuf[rlen] = '\0';
- printf("read (%d): %s\r\n", rlen, dumbuf);
-#endif
- }
- ioctl(FD, TIOCFLUSH, 0); /* clear the input buffer */
- ioctl(FD, TIOCCDTR, 0); /* clear DTR (insurance) */
- close(FD);
-}
-
-#define MAXRETRY 5
-
-hay_sync()
-{
- int len, retry = 0;
-
- while (retry++ <= MAXRETRY) {
- write(FD, "AT\r", 3);
- sleep(1);
- ioctl(FD, FIONREAD, &len);
- if (len) {
- len = read(FD, dumbuf, min(len, DUMBUFLEN));
- if (index(dumbuf, '0') ||
- (index(dumbuf, 'O') && index(dumbuf, 'K')))
- return(1);
-#ifdef DEBUG
- dumbuf[len] = '\0';
- printf("hay_sync: (\"%s\") %d\n\r", dumbuf, retry);
-#endif
- }
- ioctl(FD, TIOCCDTR, 0);
- ioctl(FD, TIOCSDTR, 0);
- }
- printf("Cannot synchronize with hayes...\n\r");
- return(0);
-}
diff --git a/usr.bin/tip/aculib/t3000.c b/usr.bin/tip/aculib/t3000.c
deleted file mode 100644
index 5e07359..0000000
--- a/usr.bin/tip/aculib/t3000.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)t3000.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for calling up on a Telebit T3000 modem.
- * Derived from Courier driver.
- */
-#include "tip.h"
-#include <stdio.h>
-
-#define MAXRETRY 5
-
-static void sigALRM();
-static int timeout = 0;
-static int connected = 0;
-static jmp_buf timeoutbuf, intbuf;
-static int t3000_sync();
-
-t3000_dialer(num, acu)
- register char *num;
- char *acu;
-{
- register char *cp;
-#ifdef ACULOG
- char line[80];
-#endif
- static int t3000_connect(), t3000_swallow();
-
- if (boolean(value(VERBOSE)))
- printf("Using \"%s\"\n", acu);
-
- ioctl(FD, TIOCHPCL, 0);
- /*
- * Get in synch.
- */
- if (!t3000_sync()) {
-badsynch:
- printf("can't synchronize with t3000\n");
-#ifdef ACULOG
- logent(value(HOST), num, "t3000", "can't synch up");
-#endif
- return (0);
- }
- t3000_write(FD, "AT E0\r", 6); /* turn off echoing */
- sleep(1);
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- t3000_verbose_read();
-#endif
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
- t3000_write(FD, "AT E0 H0 Q0 X4 V1\r", 18);
- if (!t3000_swallow("\r\nOK\r\n"))
- goto badsynch;
- fflush(stdout);
- t3000_write(FD, "AT D", 4);
- for (cp = num; *cp; cp++)
- if (*cp == '=')
- *cp = ',';
- t3000_write(FD, num, strlen(num));
- t3000_write(FD, "\r", 1);
- connected = t3000_connect();
-#ifdef ACULOG
- if (timeout) {
- sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
- logent(value(HOST), num, "t3000", line);
- }
-#endif
- if (timeout)
- t3000_disconnect();
- return (connected);
-}
-
-t3000_disconnect()
-{
- /* first hang up the modem*/
- ioctl(FD, TIOCCDTR, 0);
- sleep(1);
- ioctl(FD, TIOCSDTR, 0);
- t3000_sync(); /* reset */
- close(FD);
-}
-
-t3000_abort()
-{
- t3000_write(FD, "\r", 1); /* send anything to abort the call */
- t3000_disconnect();
-}
-
-static void
-sigALRM()
-{
- printf("\07timeout waiting for reply\n");
- timeout = 1;
- longjmp(timeoutbuf, 1);
-}
-
-static int
-t3000_swallow(match)
- register char *match;
- {
- sig_t f;
- char c;
-
- f = signal(SIGALRM, sigALRM);
- timeout = 0;
- do {
- if (*match =='\0') {
- signal(SIGALRM, f);
- return (1);
- }
- if (setjmp(timeoutbuf)) {
- signal(SIGALRM, f);
- return (0);
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, &c, 1);
- alarm(0);
- c &= 0177;
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- putchar(c);
-#endif
- } while (c == *match++);
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- fflush(stdout);
-#endif
- signal(SIGALRM, SIG_DFL);
- return (0);
-}
-
-#ifndef B19200 /* XXX */
-#define B19200 EXTA
-#define B38400 EXTB
-#endif
-
-struct tbaud_msg {
- char *msg;
- int baud;
- int baud2;
-} tbaud_msg[] = {
- "", B300, 0,
- " 1200", B1200, 0,
- " 2400", B2400, 0,
- " 4800", B4800, 0,
- " 9600", B9600, 0,
- " 14400", B19200, B9600,
- " 19200", B19200, B9600,
- " 38400", B38400, B9600,
- " 57600", B38400, B9600,
- " 7512", B9600, 0,
- " 1275", B2400, 0,
- " 7200", B9600, 0,
- " 12000", B19200, B9600,
- 0, 0, 0,
-};
-
-static int
-t3000_connect()
-{
- char c;
- int nc, nl, n;
- struct sgttyb sb;
- char dialer_buf[64];
- struct tbaud_msg *bm;
- sig_t f;
-
- if (t3000_swallow("\r\n") == 0)
- return (0);
- f = signal(SIGALRM, sigALRM);
-again:
- nc = 0; nl = sizeof(dialer_buf)-1;
- bzero(dialer_buf, sizeof(dialer_buf));
- timeout = 0;
- for (nc = 0, nl = sizeof(dialer_buf)-1 ; nl > 0 ; nc++, nl--) {
- if (setjmp(timeoutbuf))
- break;
- alarm(number(value(DIALTIMEOUT)));
- n = read(FD, &c, 1);
- alarm(0);
- if (n <= 0)
- break;
- c &= 0x7f;
- if (c == '\r') {
- if (t3000_swallow("\n") == 0)
- break;
- if (!dialer_buf[0])
- goto again;
- if (strcmp(dialer_buf, "RINGING") == 0 &&
- boolean(value(VERBOSE))) {
-#ifdef DEBUG
- printf("%s\r\n", dialer_buf);
-#endif
- goto again;
- }
- if (strncmp(dialer_buf, "CONNECT",
- sizeof("CONNECT")-1) != 0)
- break;
- for (bm = tbaud_msg ; bm->msg ; bm++)
- if (strcmp(bm->msg,
- dialer_buf+sizeof("CONNECT")-1) == 0) {
- if (ioctl(FD, TIOCGETP, &sb) < 0) {
- perror("TIOCGETP");
- goto error;
- }
- sb.sg_ispeed = sb.sg_ospeed = bm->baud;
- if (ioctl(FD, TIOCSETP, &sb) < 0) {
- if (bm->baud2) {
- sb.sg_ispeed =
- sb.sg_ospeed =
- bm->baud2;
- if (ioctl(FD,
- TIOCSETP,
- &sb) >= 0)
- goto isok;
- }
- perror("TIOCSETP");
- goto error;
- }
-isok:
- signal(SIGALRM, f);
-#ifdef DEBUG
- if (boolean(value(VERBOSE)))
- printf("%s\r\n", dialer_buf);
-#endif
- return (1);
- }
- break;
- }
- dialer_buf[nc] = c;
-#ifdef notdef
- if (boolean(value(VERBOSE)))
- putchar(c);
-#endif
- }
-error1:
- printf("%s\r\n", dialer_buf);
-error:
- signal(SIGALRM, f);
- return (0);
-}
-
-/*
- * This convoluted piece of code attempts to get
- * the t3000 in sync.
- */
-static int
-t3000_sync()
-{
- int already = 0;
- int len;
- char buf[40];
-
- while (already++ < MAXRETRY) {
- ioctl(FD, TIOCFLUSH, 0); /* flush any clutter */
- t3000_write(FD, "\rAT Z\r", 6); /* reset modem */
- bzero(buf, sizeof(buf));
- sleep(2);
- ioctl(FD, FIONREAD, &len);
-#if 1
-if (len == 0) len = 1;
-#endif
- if (len) {
- len = read(FD, buf, sizeof(buf));
-#ifdef DEBUG
- buf[len] = '\0';
- printf("t3000_sync: (\"%s\")\n\r", buf);
-#endif
- if (index(buf, '0') ||
- (index(buf, 'O') && index(buf, 'K')))
- return(1);
- }
- /*
- * If not strapped for DTR control,
- * try to get command mode.
- */
- sleep(1);
- t3000_write(FD, "+++", 3);
- sleep(1);
- /*
- * Toggle DTR to force anyone off that might have left
- * the modem connected.
- */
- ioctl(FD, TIOCCDTR, 0);
- sleep(1);
- ioctl(FD, TIOCSDTR, 0);
- }
- t3000_write(FD, "\rAT Z\r", 6);
- return (0);
-}
-
-t3000_write(fd, cp, n)
-int fd;
-char *cp;
-int n;
-{
- struct sgttyb sb;
-
-#ifdef notdef
- if (boolean(value(VERBOSE)))
- write(1, cp, n);
-#endif
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
- t3000_nap();
- for ( ; n-- ; cp++) {
- write(fd, cp, 1);
- ioctl(fd, TIOCGETP, &sb);
- ioctl(fd, TIOCSETP, &sb);
- t3000_nap();
- }
-}
-
-#ifdef DEBUG
-t3000_verbose_read()
-{
- int n = 0;
- char buf[BUFSIZ];
-
- if (ioctl(FD, FIONREAD, &n) < 0)
- return;
- if (n <= 0)
- return;
- if (read(FD, buf, n) != n)
- return;
- write(1, buf, n);
-}
-#endif
-
-/*
- * Code stolen from /usr/src/lib/libc/gen/sleep.c
- */
-#define mask(s) (1<<((s)-1))
-#define setvec(vec, a) \
- vec.sv_handler = a; vec.sv_mask = vec.sv_onstack = 0
-
-static napms = 50; /* Give the t3000 50 milliseconds between characters */
-
-static int ringring;
-
-t3000_nap()
-{
-
- static void t3000_napx();
- int omask;
- struct itimerval itv, oitv;
- register struct itimerval *itp = &itv;
- struct sigvec vec, ovec;
-
- timerclear(&itp->it_interval);
- timerclear(&itp->it_value);
- if (setitimer(ITIMER_REAL, itp, &oitv) < 0)
- return;
- setvec(ovec, SIG_DFL);
- omask = sigblock(mask(SIGALRM));
- itp->it_value.tv_sec = napms/1000;
- itp->it_value.tv_usec = ((napms%1000)*1000);
- setvec(vec, t3000_napx);
- ringring = 0;
- (void) sigvec(SIGALRM, &vec, &ovec);
- (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0);
- while (!ringring)
- sigpause(omask &~ mask(SIGALRM));
- (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0);
- (void) setitimer(ITIMER_REAL, &oitv, (struct itimerval *)0);
- (void) sigsetmask(omask);
-}
-
-static void
-t3000_napx()
-{
- ringring = 1;
-}
diff --git a/usr.bin/tip/aculib/v3451.c b/usr.bin/tip/aculib/v3451.c
deleted file mode 100644
index 1623a58..0000000
--- a/usr.bin/tip/aculib/v3451.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)v3451.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for calling up on a Vadic 3451 Modem
- */
-#include "tip.h"
-
-static jmp_buf Sjbuf;
-
-v3451_dialer(num, acu)
- register char *num;
- char *acu;
-{
- sig_t func;
- int ok;
- int slow = number(value(BAUDRATE)) < 1200, rw = 2;
- char phone[50];
-#ifdef ACULOG
- char line[80];
-#endif
- static int expect();
- static void vawrite();
-
- /*
- * Get in synch
- */
- vawrite("I\r", 1 + slow);
- vawrite("I\r", 1 + slow);
- vawrite("I\r", 1 + slow);
- vawrite("\005\r", 2 + slow);
- if (!expect("READY")) {
- printf("can't synchronize with vadic 3451\n");
-#ifdef ACULOG
- logent(value(HOST), num, "vadic", "can't synch up");
-#endif
- return (0);
- }
- ioctl(FD, TIOCHPCL, 0);
- sleep(1);
- vawrite("D\r", 2 + slow);
- if (!expect("NUMBER?")) {
- printf("Vadic will not accept dial command\n");
-#ifdef ACULOG
- logent(value(HOST), num, "vadic", "will not accept dial");
-#endif
- return (0);
- }
- strcpy(phone, num);
- strcat(phone, "\r");
- vawrite(phone, 1 + slow);
- if (!expect(phone)) {
- printf("Vadic will not accept phone number\n");
-#ifdef ACULOG
- logent(value(HOST), num, "vadic", "will not accept number");
-#endif
- return (0);
- }
- func = signal(SIGINT,SIG_IGN);
- /*
- * You cannot interrupt the Vadic when its dialing;
- * even dropping DTR does not work (definitely a
- * brain damaged design).
- */
- vawrite("\r", 1 + slow);
- vawrite("\r", 1 + slow);
- if (!expect("DIALING:")) {
- printf("Vadic failed to dial\n");
-#ifdef ACULOG
- logent(value(HOST), num, "vadic", "failed to dial");
-#endif
- return (0);
- }
- if (boolean(value(VERBOSE)))
- printf("\ndialing...");
- ok = expect("ON LINE");
- signal(SIGINT, func);
- if (!ok) {
- printf("call failed\n");
-#ifdef ACULOG
- logent(value(HOST), num, "vadic", "call failed");
-#endif
- return (0);
- }
- ioctl(FD, TIOCFLUSH, &rw);
- return (1);
-}
-
-v3451_disconnect()
-{
-
- close(FD);
-}
-
-v3451_abort()
-{
-
- close(FD);
-}
-
-static void
-vawrite(cp, delay)
- register char *cp;
- int delay;
-{
-
- for (; *cp; sleep(delay), cp++)
- write(FD, cp, 1);
-}
-
-static
-expect(cp)
- register char *cp;
-{
- char buf[300];
- register char *rp = buf;
- int timeout = 30, online = 0;
- static int notin();
- static void alarmtr();
-
- if (strcmp(cp, "\"\"") == 0)
- return (1);
- *rp = 0;
- /*
- * If we are waiting for the Vadic to complete
- * dialing and get a connection, allow more time
- * Unfortunately, the Vadic times out 24 seconds after
- * the last digit is dialed
- */
- online = strcmp(cp, "ON LINE") == 0;
- if (online)
- timeout = number(value(DIALTIMEOUT));
- signal(SIGALRM, alarmtr);
- if (setjmp(Sjbuf))
- return (0);
- alarm(timeout);
- while (notin(cp, buf) && rp < buf + sizeof (buf) - 1) {
- if (online && notin("FAILED CALL", buf) == 0)
- return (0);
- if (read(FD, rp, 1) < 0) {
- alarm(0);
- return (0);
- }
- if (*rp &= 0177)
- rp++;
- *rp = '\0';
- }
- alarm(0);
- return (1);
-}
-
-static void
-alarmtr()
-{
- longjmp(Sjbuf, 1);
-}
-
-static int
-notin(sh, lg)
- char *sh, *lg;
-{
- static int prefix();
-
- for (; *lg; lg++)
- if (prefix(sh, lg))
- return (0);
- return (1);
-}
-
-static
-prefix(s1, s2)
- register char *s1, *s2;
-{
- register char c;
-
- while ((c = *s1++) == *s2++)
- if (c == '\0')
- return (1);
- return (c == '\0');
-}
diff --git a/usr.bin/tip/aculib/v831.c b/usr.bin/tip/aculib/v831.c
deleted file mode 100644
index 38aa230..0000000
--- a/usr.bin/tip/aculib/v831.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)v831.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for dialing up on Vadic 831
- */
-#include "tip.h"
-
-int v831_abort();
-static void alarmtr();
-extern int errno;
-
-static jmp_buf jmpbuf;
-static int child = -1;
-
-v831_dialer(num, acu)
- char *num, *acu;
-{
- int status, pid, connected = 1;
- register int timelim;
- static int dialit();
-
- if (boolean(value(VERBOSE)))
- printf("\nstarting call...");
-#ifdef DEBUG
- printf ("(acu=%s)\n", acu);
-#endif
- if ((AC = open(acu, O_RDWR)) < 0) {
- if (errno == EBUSY)
- printf("line busy...");
- else
- printf("acu open error...");
- return (0);
- }
- if (setjmp(jmpbuf)) {
- kill(child, SIGKILL);
- close(AC);
- return (0);
- }
- signal(SIGALRM, alarmtr);
- timelim = 5 * strlen(num);
- alarm(timelim < 30 ? 30 : timelim);
- if ((child = fork()) == 0) {
- /*
- * ignore this stuff for aborts
- */
- signal(SIGALRM, SIG_IGN);
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- sleep(2);
- exit(dialit(num, acu) != 'A');
- }
- /*
- * open line - will return on carrier
- */
- if ((FD = open(DV, O_RDWR)) < 0) {
-#ifdef DEBUG
- printf("(after open, errno=%d)\n", errno);
-#endif
- if (errno == EIO)
- printf("lost carrier...");
- else
- printf("dialup line open failed...");
- alarm(0);
- kill(child, SIGKILL);
- close(AC);
- return (0);
- }
- alarm(0);
-#ifdef notdef
- ioctl(AC, TIOCHPCL, 0);
-#endif
- signal(SIGALRM, SIG_DFL);
- while ((pid = wait(&status)) != child && pid != -1)
- ;
- if (status) {
- close(AC);
- return (0);
- }
- return (1);
-}
-
-static void
-alarmtr()
-{
- alarm(0);
- longjmp(jmpbuf, 1);
-}
-
-/*
- * Insurance, for some reason we don't seem to be
- * hanging up...
- */
-v831_disconnect()
-{
- struct sgttyb cntrl;
-
- sleep(2);
-#ifdef DEBUG
- printf("[disconnect: FD=%d]\n", FD);
-#endif
- if (FD > 0) {
- ioctl(FD, TIOCCDTR, 0);
- ioctl(FD, TIOCGETP, &cntrl);
- cntrl.sg_ispeed = cntrl.sg_ospeed = 0;
- ioctl(FD, TIOCSETP, &cntrl);
- ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
- }
- close(FD);
-}
-
-v831_abort()
-{
-
-#ifdef DEBUG
- printf("[abort: AC=%d]\n", AC);
-#endif
- sleep(2);
- if (child > 0)
- kill(child, SIGKILL);
- if (AC > 0)
- ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
- close(AC);
- if (FD > 0)
- ioctl(FD, TIOCCDTR, 0);
- close(FD);
-}
-
-/*
- * Sigh, this probably must be changed at each site.
- */
-struct vaconfig {
- char *vc_name;
- char vc_rack;
- char vc_modem;
-} vaconfig[] = {
- { "/dev/cua0",'4','0' },
- { "/dev/cua1",'4','1' },
- { 0 }
-};
-
-#define pc(x) (c = x, write(AC,&c,1))
-#define ABORT 01
-#define SI 017
-#define STX 02
-#define ETX 03
-
-static int
-dialit(phonenum, acu)
- register char *phonenum;
- char *acu;
-{
- register struct vaconfig *vp;
- struct sgttyb cntrl;
- char c;
- int i, two = 2;
- static char *sanitize();
-
- phonenum = sanitize(phonenum);
-#ifdef DEBUG
- printf ("(dial phonenum=%s)\n", phonenum);
-#endif
- if (*phonenum == '<' && phonenum[1] == 0)
- return ('Z');
- for (vp = vaconfig; vp->vc_name; vp++)
- if (strcmp(vp->vc_name, acu) == 0)
- break;
- if (vp->vc_name == 0) {
- printf("Unable to locate dialer (%s)\n", acu);
- return ('K');
- }
- ioctl(AC, TIOCGETP, &cntrl);
- cntrl.sg_ispeed = cntrl.sg_ospeed = B2400;
- cntrl.sg_flags = RAW | EVENP | ODDP;
- ioctl(AC, TIOCSETP, &cntrl);
- ioctl(AC, TIOCFLUSH, &two);
- pc(STX);
- pc(vp->vc_rack);
- pc(vp->vc_modem);
- while (*phonenum && *phonenum != '<')
- pc(*phonenum++);
- pc(SI);
- pc(ETX);
- sleep(1);
- i = read(AC, &c, 1);
-#ifdef DEBUG
- printf("read %d chars, char=%c, errno %d\n", i, c, errno);
-#endif
- if (i != 1)
- c = 'M';
- if (c == 'B' || c == 'G') {
- char cc, oc = c;
-
- pc(ABORT);
- read(AC, &cc, 1);
-#ifdef DEBUG
- printf("abort response=%c\n", cc);
-#endif
- c = oc;
- v831_disconnect();
- }
- close(AC);
-#ifdef DEBUG
- printf("dialit: returns %c\n", c);
-#endif
- return (c);
-}
-
-static char *
-sanitize(s)
- register char *s;
-{
- static char buf[128];
- register char *cp;
-
- for (cp = buf; *s; s++) {
- if (!isdigit(*s) && *s == '<' && *s != '_')
- continue;
- if (*s == '_')
- *s = '=';
- *cp++ = *s;
- }
- *cp++ = 0;
- return (buf);
-}
diff --git a/usr.bin/tip/aculib/ventel.c b/usr.bin/tip/aculib/ventel.c
deleted file mode 100644
index 28b0d28..0000000
--- a/usr.bin/tip/aculib/ventel.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)ventel.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Routines for calling up on a Ventel Modem
- * The Ventel is expected to be strapped for local echo (just like uucp)
- */
-#include "tip.h"
-
-#define MAXRETRY 5
-
-static void sigALRM();
-static int timeout = 0;
-static jmp_buf timeoutbuf;
-
-/*
- * some sleep calls have been replaced by this macro
- * because some ventel modems require two <cr>s in less than
- * a second in order to 'wake up'... yes, it is dirty...
- */
-#define delay(num,denom) busyloop(CPUSPEED*num/denom)
-#define CPUSPEED 1000000 /* VAX 780 is 1MIPS */
-#define DELAY(n) { register long N = (n); while (--N > 0); }
-busyloop(n) { DELAY(n); }
-
-ven_dialer(num, acu)
- register char *num;
- char *acu;
-{
- register char *cp;
- register int connected = 0;
- char *msg, *index(), line[80];
- static int gobble(), vensync();
- static void echo();
-
- /*
- * Get in synch with a couple of carriage returns
- */
- if (!vensync(FD)) {
- printf("can't synchronize with ventel\n");
-#ifdef ACULOG
- logent(value(HOST), num, "ventel", "can't synch up");
-#endif
- return (0);
- }
- if (boolean(value(VERBOSE)))
- printf("\ndialing...");
- fflush(stdout);
- ioctl(FD, TIOCHPCL, 0);
- echo("#k$\r$\n$D$I$A$L$:$ ");
- for (cp = num; *cp; cp++) {
- delay(1, 10);
- write(FD, cp, 1);
- }
- delay(1, 10);
- write(FD, "\r", 1);
- gobble('\n', line);
- if (gobble('\n', line))
- connected = gobble('!', line);
- ioctl(FD, TIOCFLUSH);
-#ifdef ACULOG
- if (timeout) {
- sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
- logent(value(HOST), num, "ventel", line);
- }
-#endif
- if (timeout)
- ven_disconnect(); /* insurance */
- if (connected || timeout || !boolean(value(VERBOSE)))
- return (connected);
- /* call failed, parse response for user */
- cp = index(line, '\r');
- if (cp)
- *cp = '\0';
- for (cp = line; cp = index(cp, ' '); cp++)
- if (cp[1] == ' ')
- break;
- if (cp) {
- while (*cp == ' ')
- cp++;
- msg = cp;
- while (*cp) {
- if (isupper(*cp))
- *cp = tolower(*cp);
- cp++;
- }
- printf("%s...", msg);
- }
- return (connected);
-}
-
-ven_disconnect()
-{
-
- close(FD);
-}
-
-ven_abort()
-{
-
- write(FD, "\03", 1);
- close(FD);
-}
-
-static void
-echo(s)
- register char *s;
-{
- char c;
-
- while (c = *s++) switch (c) {
-
- case '$':
- read(FD, &c, 1);
- s++;
- break;
-
- case '#':
- c = *s++;
- write(FD, &c, 1);
- break;
-
- default:
- write(FD, &c, 1);
- read(FD, &c, 1);
- }
-}
-
-static void
-sigALRM()
-{
- printf("\07timeout waiting for reply\n");
- timeout = 1;
- longjmp(timeoutbuf, 1);
-}
-
-static int
-gobble(match, response)
- register char match;
- char response[];
-{
- register char *cp = response;
- sig_t f;
- char c;
-
- f = signal(SIGALRM, sigALRM);
- timeout = 0;
- do {
- if (setjmp(timeoutbuf)) {
- signal(SIGALRM, f);
- *cp = '\0';
- return (0);
- }
- alarm(number(value(DIALTIMEOUT)));
- read(FD, cp, 1);
- alarm(0);
- c = (*cp++ &= 0177);
-#ifdef notdef
- if (boolean(value(VERBOSE)))
- putchar(c);
-#endif
- } while (c != '\n' && c != match);
- signal(SIGALRM, SIG_DFL);
- *cp = '\0';
- return (c == match);
-}
-
-#define min(a,b) ((a)>(b)?(b):(a))
-/*
- * This convoluted piece of code attempts to get
- * the ventel in sync. If you don't have FIONREAD
- * there are gory ways to simulate this.
- */
-static int
-vensync(fd)
-{
- int already = 0, nread;
- char buf[60];
-
- /*
- * Toggle DTR to force anyone off that might have left
- * the modem connected, and insure a consistent state
- * to start from.
- *
- * If you don't have the ioctl calls to diddle directly
- * with DTR, you can always try setting the baud rate to 0.
- */
- ioctl(FD, TIOCCDTR, 0);
- sleep(1);
- ioctl(FD, TIOCSDTR, 0);
- while (already < MAXRETRY) {
- /*
- * After reseting the modem, send it two \r's to
- * autobaud on. Make sure to delay between them
- * so the modem can frame the incoming characters.
- */
- write(fd, "\r", 1);
- delay(1,10);
- write(fd, "\r", 1);
- sleep(2);
- if (ioctl(fd, FIONREAD, (caddr_t)&nread) < 0) {
- perror("tip: ioctl");
- continue;
- }
- while (nread > 0) {
- read(fd, buf, min(nread, 60));
- if ((buf[nread - 1] & 0177) == '$')
- return (1);
- nread -= min(nread, 60);
- }
- sleep(1);
- already++;
- }
- return (0);
-}
-
diff --git a/usr.bin/tip/acutab.c b/usr.bin/tip/acutab.c
deleted file mode 100644
index 112b43e..0000000
--- a/usr.bin/tip/acutab.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)acutab.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-extern int df02_dialer(), df03_dialer(), df_disconnect(), df_abort(),
- biz31f_dialer(), biz31_disconnect(), biz31_abort(),
- biz31w_dialer(),
- biz22f_dialer(), biz22_disconnect(), biz22_abort(),
- biz22w_dialer(),
- ven_dialer(), ven_disconnect(), ven_abort(),
- hay_dialer(), hay_disconnect(), hay_abort(),
- cour_dialer(), cour_disconnect(), cour_abort(),
- t3000_dialer(), t3000_disconnect(), t3000_abort(),
- v3451_dialer(), v3451_disconnect(), v3451_abort(),
- v831_dialer(), v831_disconnect(), v831_abort(),
- dn_dialer(), dn_disconnect(), dn_abort();
-
-acu_t acutable[] = {
-#if BIZ1031
- "biz31f", biz31f_dialer, biz31_disconnect, biz31_abort,
- "biz31w", biz31w_dialer, biz31_disconnect, biz31_abort,
-#endif
-#if BIZ1022
- "biz22f", biz22f_dialer, biz22_disconnect, biz22_abort,
- "biz22w", biz22w_dialer, biz22_disconnect, biz22_abort,
-#endif
-#if DF02
- "df02", df02_dialer, df_disconnect, df_abort,
-#endif
-#if DF03
- "df03", df03_dialer, df_disconnect, df_abort,
-#endif
-#if DN11
- "dn11", dn_dialer, dn_disconnect, dn_abort,
-#endif
-#ifdef VENTEL
- "ventel",ven_dialer, ven_disconnect, ven_abort,
-#endif
-#ifdef HAYES
- "hayes",hay_dialer, hay_disconnect, hay_abort,
-#endif
-#ifdef COURIER
- "courier",cour_dialer, cour_disconnect, cour_abort,
-#endif
-#ifdef T3000
- "t3000",t3000_dialer, t3000_disconnect, t3000_abort,
-#endif
-#ifdef V3451
-#ifndef V831
- "vadic",v3451_dialer, v3451_disconnect, v3451_abort,
-#endif
- "v3451",v3451_dialer, v3451_disconnect, v3451_abort,
-#endif
-#ifdef V831
-#ifndef V3451
- "vadic",v831_dialer, v831_disconnect, v831_abort,
-#endif
- "v831",v831_dialer, v831_disconnect, v831_abort,
-#endif
- 0, 0, 0, 0
-};
-
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c
deleted file mode 100644
index 63bfee2..0000000
--- a/usr.bin/tip/cmds.c
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-#include "pathnames.h"
-
-/*
- * tip
- *
- * miscellaneous commands
- */
-
-int quant[] = { 60, 60, 24 };
-
-char null = '\0';
-char *sep[] = { "second", "minute", "hour" };
-static char *argv[10]; /* argument vector for take and put */
-
-void timeout(); /* timeout function called on alarm */
-void stopsnd(); /* SIGINT handler during file transfers */
-void intcopy(); /* interrupt routine for file transfers */
-
-/*
- * FTP - remote ==> local
- * get a file from the remote host
- */
-getfl(c)
- char c;
-{
- char buf[256], *cp, *expand();
-
- putchar(c);
- /*
- * get the UNIX receiving file's name
- */
- if (prompt("Local file name? ", copyname))
- return;
- cp = expand(copyname);
- if ((sfd = creat(cp, 0666)) < 0) {
- printf("\r\n%s: cannot creat\r\n", copyname);
- return;
- }
-
- /*
- * collect parameters
- */
- if (prompt("List command for remote system? ", buf)) {
- unlink(copyname);
- return;
- }
- transfer(buf, sfd, value(EOFREAD));
-}
-
-/*
- * Cu-like take command
- */
-cu_take(cc)
- char cc;
-{
- int fd, argc;
- char line[BUFSIZ], *expand(), *cp;
-
- if (prompt("[take] ", copyname))
- return;
- if ((argc = args(copyname, argv)) < 1 || argc > 2) {
- printf("usage: <take> from [to]\r\n");
- return;
- }
- if (argc == 1)
- argv[1] = argv[0];
- cp = expand(argv[1]);
- if ((fd = creat(cp, 0666)) < 0) {
- printf("\r\n%s: cannot create\r\n", argv[1]);
- return;
- }
- sprintf(line, "cat %s;echo \01", argv[0]);
- transfer(line, fd, "\01");
-}
-
-static jmp_buf intbuf;
-/*
- * Bulk transfer routine --
- * used by getfl(), cu_take(), and pipefile()
- */
-transfer(buf, fd, eofchars)
- char *buf, *eofchars;
-{
- register int ct;
- char c, buffer[BUFSIZ];
- register char *p = buffer;
- register int cnt, eof;
- time_t start;
- sig_t f;
- char r;
-
- pwrite(FD, buf, size(buf));
- quit = 0;
- kill(pid, SIGIOT);
- read(repdes[0], (char *)&ccc, 1); /* Wait until read process stops */
-
- /*
- * finish command
- */
- r = '\r';
- pwrite(FD, &r, 1);
- do
- read(FD, &c, 1);
- while ((c&0177) != '\n');
- ioctl(0, TIOCSETC, &defchars);
-
- (void) setjmp(intbuf);
- f = signal(SIGINT, intcopy);
- start = time(0);
- for (ct = 0; !quit;) {
- eof = read(FD, &c, 1) <= 0;
- c &= 0177;
- if (quit)
- continue;
- if (eof || any(c, eofchars))
- break;
- if (c == 0)
- continue; /* ignore nulls */
- if (c == '\r')
- continue;
- *p++ = c;
-
- if (c == '\n' && boolean(value(VERBOSE)))
- printf("\r%d", ++ct);
- if ((cnt = (p-buffer)) == number(value(FRAMESIZE))) {
- if (write(fd, buffer, cnt) != cnt) {
- printf("\r\nwrite error\r\n");
- quit = 1;
- }
- p = buffer;
- }
- }
- if (cnt = (p-buffer))
- if (write(fd, buffer, cnt) != cnt)
- printf("\r\nwrite error\r\n");
-
- if (boolean(value(VERBOSE)))
- prtime(" lines transferred in ", time(0)-start);
- ioctl(0, TIOCSETC, &tchars);
- write(fildes[1], (char *)&ccc, 1);
- signal(SIGINT, f);
- close(fd);
-}
-
-/*
- * FTP - remote ==> local process
- * send remote input to local process via pipe
- */
-pipefile()
-{
- int cpid, pdes[2];
- char buf[256];
- int status, p;
- extern int errno;
-
- if (prompt("Local command? ", buf))
- return;
-
- if (pipe(pdes)) {
- printf("can't establish pipe\r\n");
- return;
- }
-
- if ((cpid = fork()) < 0) {
- printf("can't fork!\r\n");
- return;
- } else if (cpid) {
- if (prompt("List command for remote system? ", buf)) {
- close(pdes[0]), close(pdes[1]);
- kill (cpid, SIGKILL);
- } else {
- close(pdes[0]);
- signal(SIGPIPE, intcopy);
- transfer(buf, pdes[1], value(EOFREAD));
- signal(SIGPIPE, SIG_DFL);
- while ((p = wait(&status)) > 0 && p != cpid)
- ;
- }
- } else {
- register int f;
-
- dup2(pdes[0], 0);
- close(pdes[0]);
- for (f = 3; f < 20; f++)
- close(f);
- execute(buf);
- printf("can't execl!\r\n");
- exit(0);
- }
-}
-
-/*
- * Interrupt service routine for FTP
- */
-void
-stopsnd()
-{
-
- stop = 1;
- signal(SIGINT, SIG_IGN);
-}
-
-/*
- * FTP - local ==> remote
- * send local file to remote host
- * terminate transmission with pseudo EOF sequence
- */
-sendfile(cc)
- char cc;
-{
- FILE *fd;
- char *fnamex;
- char *expand();
-
- putchar(cc);
- /*
- * get file name
- */
- if (prompt("Local file name? ", fname))
- return;
-
- /*
- * look up file
- */
- fnamex = expand(fname);
- if ((fd = fopen(fnamex, "r")) == NULL) {
- printf("%s: cannot open\r\n", fname);
- return;
- }
- transmit(fd, value(EOFWRITE), NULL);
- if (!boolean(value(ECHOCHECK))) {
- struct sgttyb buf;
-
- ioctl(FD, TIOCGETP, &buf); /* this does a */
- ioctl(FD, TIOCSETP, &buf); /* wflushtty */
- }
-}
-
-/*
- * Bulk transfer routine to remote host --
- * used by sendfile() and cu_put()
- */
-transmit(fd, eofchars, command)
- FILE *fd;
- char *eofchars, *command;
-{
- char *pc, lastc;
- int c, ccount, lcount;
- time_t start_t, stop_t;
- sig_t f;
-
- kill(pid, SIGIOT); /* put TIPOUT into a wait state */
- stop = 0;
- f = signal(SIGINT, stopsnd);
- ioctl(0, TIOCSETC, &defchars);
- read(repdes[0], (char *)&ccc, 1);
- if (command != NULL) {
- for (pc = command; *pc; pc++)
- send(*pc);
- if (boolean(value(ECHOCHECK)))
- read(FD, (char *)&c, 1); /* trailing \n */
- else {
- struct sgttyb buf;
-
- ioctl(FD, TIOCGETP, &buf); /* this does a */
- ioctl(FD, TIOCSETP, &buf); /* wflushtty */
- sleep(5); /* wait for remote stty to take effect */
- }
- }
- lcount = 0;
- lastc = '\0';
- start_t = time(0);
- while (1) {
- ccount = 0;
- do {
- c = getc(fd);
- if (stop)
- goto out;
- if (c == EOF)
- goto out;
- if (c == 0177 && !boolean(value(RAWFTP)))
- continue;
- lastc = c;
- if (c < 040) {
- if (c == '\n') {
- if (!boolean(value(RAWFTP)))
- c = '\r';
- }
- else if (c == '\t') {
- if (!boolean(value(RAWFTP))) {
- if (boolean(value(TABEXPAND))) {
- send(' ');
- while ((++ccount % 8) != 0)
- send(' ');
- continue;
- }
- }
- } else
- if (!boolean(value(RAWFTP)))
- continue;
- }
- send(c);
- } while (c != '\r' && !boolean(value(RAWFTP)));
- if (boolean(value(VERBOSE)))
- printf("\r%d", ++lcount);
- if (boolean(value(ECHOCHECK))) {
- timedout = 0;
- alarm((int)value(ETIMEOUT));
- do { /* wait for prompt */
- read(FD, (char *)&c, 1);
- if (timedout || stop) {
- if (timedout)
- printf("\r\ntimed out at eol\r\n");
- alarm(0);
- goto out;
- }
- } while ((c&0177) != character(value(PROMPT)));
- alarm(0);
- }
- }
-out:
- if (lastc != '\n' && !boolean(value(RAWFTP)))
- send('\r');
- for (pc = eofchars; *pc; pc++)
- send(*pc);
- stop_t = time(0);
- fclose(fd);
- signal(SIGINT, f);
- if (boolean(value(VERBOSE)))
- if (boolean(value(RAWFTP)))
- prtime(" chars transferred in ", stop_t-start_t);
- else
- prtime(" lines transferred in ", stop_t-start_t);
- write(fildes[1], (char *)&ccc, 1);
- ioctl(0, TIOCSETC, &tchars);
-}
-
-/*
- * Cu-like put command
- */
-cu_put(cc)
- char cc;
-{
- FILE *fd;
- char line[BUFSIZ];
- int argc;
- char *expand();
- char *copynamex;
-
- if (prompt("[put] ", copyname))
- return;
- if ((argc = args(copyname, argv)) < 1 || argc > 2) {
- printf("usage: <put> from [to]\r\n");
- return;
- }
- if (argc == 1)
- argv[1] = argv[0];
- copynamex = expand(argv[0]);
- if ((fd = fopen(copynamex, "r")) == NULL) {
- printf("%s: cannot open\r\n", copynamex);
- return;
- }
- if (boolean(value(ECHOCHECK)))
- sprintf(line, "cat>%s\r", argv[1]);
- else
- sprintf(line, "stty -echo;cat>%s;stty echo\r", argv[1]);
- transmit(fd, "\04", line);
-}
-
-/*
- * FTP - send single character
- * wait for echo & handle timeout
- */
-send(c)
- char c;
-{
- char cc;
- int retry = 0;
-
- cc = c;
- pwrite(FD, &cc, 1);
-#ifdef notdef
- if (number(value(CDELAY)) > 0 && c != '\r')
- nap(number(value(CDELAY)));
-#endif
- if (!boolean(value(ECHOCHECK))) {
-#ifdef notdef
- if (number(value(LDELAY)) > 0 && c == '\r')
- nap(number(value(LDELAY)));
-#endif
- return;
- }
-tryagain:
- timedout = 0;
- alarm((int)value(ETIMEOUT));
- read(FD, &cc, 1);
- alarm(0);
- if (timedout) {
- printf("\r\ntimeout error (%s)\r\n", ctrl(c));
- if (retry++ > 3)
- return;
- pwrite(FD, &null, 1); /* poke it */
- goto tryagain;
- }
-}
-
-void
-timeout()
-{
- signal(SIGALRM, timeout);
- timedout = 1;
-}
-
-/*
- * Stolen from consh() -- puts a remote file on the output of a local command.
- * Identical to consh() except for where stdout goes.
- */
-pipeout(c)
-{
- char buf[256];
- int cpid, status, p;
- time_t start;
-
- putchar(c);
- if (prompt("Local command? ", buf))
- return;
- kill(pid, SIGIOT); /* put TIPOUT into a wait state */
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- ioctl(0, TIOCSETC, &defchars);
- read(repdes[0], (char *)&ccc, 1);
- /*
- * Set up file descriptors in the child and
- * let it go...
- */
- if ((cpid = fork()) < 0)
- printf("can't fork!\r\n");
- else if (cpid) {
- start = time(0);
- while ((p = wait(&status)) > 0 && p != cpid)
- ;
- } else {
- register int i;
-
- dup2(FD, 1);
- for (i = 3; i < 20; i++)
- close(i);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- execute(buf);
- printf("can't find `%s'\r\n", buf);
- exit(0);
- }
- if (boolean(value(VERBOSE)))
- prtime("away for ", time(0)-start);
- write(fildes[1], (char *)&ccc, 1);
- ioctl(0, TIOCSETC, &tchars);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
-}
-
-#ifdef CONNECT
-/*
- * Fork a program with:
- * 0 <-> remote tty in
- * 1 <-> remote tty out
- * 2 <-> local tty out
- */
-consh(c)
-{
- char buf[256];
- int cpid, status, p;
- time_t start;
-
- putchar(c);
- if (prompt("Local command? ", buf))
- return;
- kill(pid, SIGIOT); /* put TIPOUT into a wait state */
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- ioctl(0, TIOCSETC, &defchars);
- read(repdes[0], (char *)&ccc, 1);
- /*
- * Set up file descriptors in the child and
- * let it go...
- */
- if ((cpid = fork()) < 0)
- printf("can't fork!\r\n");
- else if (cpid) {
- start = time(0);
- while ((p = wait(&status)) > 0 && p != cpid)
- ;
- } else {
- register int i;
-
- dup2(FD, 0);
- dup2(3, 1);
- for (i = 3; i < 20; i++)
- close(i);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- execute(buf);
- printf("can't find `%s'\r\n", buf);
- exit(0);
- }
- if (boolean(value(VERBOSE)))
- prtime("away for ", time(0)-start);
- write(fildes[1], (char *)&ccc, 1);
- ioctl(0, TIOCSETC, &tchars);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
-}
-#endif
-
-/*
- * Escape to local shell
- */
-shell()
-{
- int shpid, status;
- extern char **environ;
- char *cp;
-
- printf("[sh]\r\n");
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- unraw();
- if (shpid = fork()) {
- while (shpid != wait(&status));
- raw();
- printf("\r\n!\r\n");
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- return;
- } else {
- signal(SIGQUIT, SIG_DFL);
- signal(SIGINT, SIG_DFL);
- if ((cp = rindex(value(SHELL), '/')) == NULL)
- cp = value(SHELL);
- else
- cp++;
- shell_uid();
- execl(value(SHELL), cp, 0);
- printf("\r\ncan't execl!\r\n");
- exit(1);
- }
-}
-
-/*
- * TIPIN portion of scripting
- * initiate the conversation with TIPOUT
- */
-setscript()
-{
- char c;
- /*
- * enable TIPOUT side for dialogue
- */
- kill(pid, SIGEMT);
- if (boolean(value(SCRIPT)))
- write(fildes[1], value(RECORD), size(value(RECORD)));
- write(fildes[1], "\n", 1);
- /*
- * wait for TIPOUT to finish
- */
- read(repdes[0], &c, 1);
- if (c == 'n')
- printf("can't create %s\r\n", value(RECORD));
-}
-
-/*
- * Change current working directory of
- * local portion of tip
- */
-chdirectory()
-{
- char dirname[80];
- register char *cp = dirname;
-
- if (prompt("[cd] ", dirname)) {
- if (stoprompt)
- return;
- cp = value(HOME);
- }
- if (chdir(cp) < 0)
- printf("%s: bad directory\r\n", cp);
- printf("!\r\n");
-}
-
-tipabort(msg)
- char *msg;
-{
-
- kill(pid, SIGTERM);
- disconnect(msg);
- if (msg != NOSTR)
- printf("\r\n%s", msg);
- printf("\r\n[EOT]\r\n");
- daemon_uid();
- (void)uu_unlock(uucplock);
- unraw();
- exit(0);
-}
-
-finish()
-{
- char *dismsg;
-
- if ((dismsg = value(DISCONNECT)) != NOSTR) {
- write(FD, dismsg, strlen(dismsg));
- sleep(5);
- }
- tipabort(NOSTR);
-}
-
-void
-intcopy()
-{
- raw();
- quit = 1;
- longjmp(intbuf, 1);
-}
-
-execute(s)
- char *s;
-{
- register char *cp;
-
- if ((cp = rindex(value(SHELL), '/')) == NULL)
- cp = value(SHELL);
- else
- cp++;
- shell_uid();
- execl(value(SHELL), cp, "-c", s, 0);
-}
-
-args(buf, a)
- char *buf, *a[];
-{
- register char *p = buf, *start;
- register char **parg = a;
- register int n = 0;
-
- do {
- while (*p && (*p == ' ' || *p == '\t'))
- p++;
- start = p;
- if (*p)
- *parg = p;
- while (*p && (*p != ' ' && *p != '\t'))
- p++;
- if (p != start)
- parg++, n++;
- if (*p)
- *p++ = '\0';
- } while (*p);
-
- return(n);
-}
-
-prtime(s, a)
- char *s;
- time_t a;
-{
- register i;
- int nums[3];
-
- for (i = 0; i < 3; i++) {
- nums[i] = (int)(a % quant[i]);
- a /= quant[i];
- }
- printf("%s", s);
- while (--i >= 0)
- if (nums[i] || i == 0 && nums[1] == 0 && nums[2] == 0)
- printf("%d %s%c ", nums[i], sep[i],
- nums[i] == 1 ? '\0' : 's');
- printf("\r\n!\r\n");
-}
-
-variable()
-{
- char buf[256];
-
- if (prompt("[set] ", buf))
- return;
- vlex(buf);
- if (vtable[BEAUTIFY].v_access&CHANGED) {
- vtable[BEAUTIFY].v_access &= ~CHANGED;
- kill(pid, SIGSYS);
- }
- if (vtable[SCRIPT].v_access&CHANGED) {
- vtable[SCRIPT].v_access &= ~CHANGED;
- setscript();
- /*
- * So that "set record=blah script" doesn't
- * cause two transactions to occur.
- */
- if (vtable[RECORD].v_access&CHANGED)
- vtable[RECORD].v_access &= ~CHANGED;
- }
- if (vtable[RECORD].v_access&CHANGED) {
- vtable[RECORD].v_access &= ~CHANGED;
- if (boolean(value(SCRIPT)))
- setscript();
- }
- if (vtable[TAND].v_access&CHANGED) {
- vtable[TAND].v_access &= ~CHANGED;
- if (boolean(value(TAND)))
- tandem("on");
- else
- tandem("off");
- }
- if (vtable[LECHO].v_access&CHANGED) {
- vtable[LECHO].v_access &= ~CHANGED;
- HD = boolean(value(LECHO));
- }
- if (vtable[PARITY].v_access&CHANGED) {
- vtable[PARITY].v_access &= ~CHANGED;
- setparity();
- }
-}
-
-/*
- * Turn tandem mode on or off for remote tty.
- */
-tandem(option)
- char *option;
-{
- struct sgttyb rmtty;
-
- ioctl(FD, TIOCGETP, &rmtty);
- if (strcmp(option,"on") == 0) {
- rmtty.sg_flags |= TANDEM;
- arg.sg_flags |= TANDEM;
- } else {
- rmtty.sg_flags &= ~TANDEM;
- arg.sg_flags &= ~TANDEM;
- }
- ioctl(FD, TIOCSETP, &rmtty);
- ioctl(0, TIOCSETP, &arg);
-}
-
-/*
- * Send a break.
- */
-genbrk()
-{
-
- ioctl(FD, TIOCSBRK, NULL);
- sleep(1);
- ioctl(FD, TIOCCBRK, NULL);
-}
-
-/*
- * Suspend tip
- */
-suspend(c)
- char c;
-{
-
- unraw();
- kill(c == CTRL('y') ? getpid() : 0, SIGTSTP);
- raw();
-}
-
-/*
- * expand a file name if it includes shell meta characters
- */
-
-char *
-expand(name)
- char name[];
-{
- static char xname[BUFSIZ];
- char cmdbuf[BUFSIZ];
- register int pid, l, rc;
- register char *cp, *Shell;
- int s, pivec[2], (*sigint)();
-
- if (!anyof(name, "~{[*?$`'\"\\"))
- return(name);
- /* sigint = signal(SIGINT, SIG_IGN); */
- if (pipe(pivec) < 0) {
- perror("pipe");
- /* signal(SIGINT, sigint) */
- return(name);
- }
- sprintf(cmdbuf, "echo %s", name);
- if ((pid = vfork()) == 0) {
- Shell = value(SHELL);
- if (Shell == NOSTR)
- Shell = _PATH_BSHELL;
- close(pivec[0]);
- close(1);
- dup(pivec[1]);
- close(pivec[1]);
- close(2);
- shell_uid();
- execl(Shell, Shell, "-c", cmdbuf, 0);
- _exit(1);
- }
- if (pid == -1) {
- perror("fork");
- close(pivec[0]);
- close(pivec[1]);
- return(NOSTR);
- }
- close(pivec[1]);
- l = read(pivec[0], xname, BUFSIZ);
- close(pivec[0]);
- while (wait(&s) != pid);
- ;
- s &= 0377;
- if (s != 0 && s != SIGPIPE) {
- fprintf(stderr, "\"Echo\" failed\n");
- return(NOSTR);
- }
- if (l < 0) {
- perror("read");
- return(NOSTR);
- }
- if (l == 0) {
- fprintf(stderr, "\"%s\": No match\n", name);
- return(NOSTR);
- }
- if (l == BUFSIZ) {
- fprintf(stderr, "Buffer overflow expanding \"%s\"\n", name);
- return(NOSTR);
- }
- xname[l] = 0;
- for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
- ;
- *++cp = '\0';
- return(xname);
-}
-
-/*
- * Are any of the characters in the two strings the same?
- */
-
-anyof(s1, s2)
- register char *s1, *s2;
-{
- register int c;
-
- while (c = *s1++)
- if (any(c, s2))
- return(1);
- return(0);
-}
diff --git a/usr.bin/tip/cmdtab.c b/usr.bin/tip/cmdtab.c
deleted file mode 100644
index f6bcb60..0000000
--- a/usr.bin/tip/cmdtab.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-extern int shell(), getfl(), sendfile(), chdirectory();
-extern int finish(), help(), pipefile(), pipeout(), consh(), variable();
-extern int cu_take(), cu_put(), dollar(), genbrk(), suspend();
-
-esctable_t etable[] = {
- { '!', NORM, "shell", shell },
- { '<', NORM, "receive file from remote host", getfl },
- { '>', NORM, "send file to remote host", sendfile },
- { 't', NORM, "take file from remote UNIX", cu_take },
- { 'p', NORM, "put file to remote UNIX", cu_put },
- { '|', NORM, "pipe remote file", pipefile },
- { '$', NORM, "pipe local command to remote host", pipeout },
-#ifdef CONNECT
- { 'C', NORM, "connect program to remote host",consh },
-#endif
- { 'c', NORM, "change directory", chdirectory },
- { '.', NORM, "exit from tip", finish },
- {CTRL('d'),NORM,"exit from tip", finish },
- {CTRL('y'),NORM,"suspend tip (local+remote)", suspend },
- {CTRL('z'),NORM,"suspend tip (local only)", suspend },
- { 's', NORM, "set variable", variable },
- { '?', NORM, "get this summary", help },
- { '#', NORM, "send break", genbrk },
- { 0, 0, 0 }
-};
diff --git a/usr.bin/tip/cu.c b/usr.bin/tip/cu.c
deleted file mode 100644
index fae2b3c..0000000
--- a/usr.bin/tip/cu.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-void cleanup();
-
-/*
- * Botch the interface to look like cu's
- */
-cumain(argc, argv)
- char *argv[];
-{
- register int i;
- static char sbuf[12];
-
- if (argc < 2) {
- printf("usage: cu telno [-t] [-s speed] [-a acu] [-l line] [-#]\n");
- exit(8);
- }
- CU = DV = NOSTR;
- BR = DEFBR;
- for (; argc > 1; argv++, argc--) {
- if (argv[1][0] != '-')
- PN = argv[1];
- else switch (argv[1][1]) {
-
- case 't':
- HW = 1, DU = -1;
- --argc;
- continue;
-
- case 'a':
- CU = argv[2]; ++argv; --argc;
- break;
-
- case 's':
- if (argc < 3 || speed(atoi(argv[2])) == 0) {
- fprintf(stderr, "cu: unsupported speed %s\n",
- argv[2]);
- exit(3);
- }
- BR = atoi(argv[2]); ++argv; --argc;
- break;
-
- case 'l':
- DV = argv[2]; ++argv; --argc;
- break;
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (CU)
- CU[strlen(CU)-1] = argv[1][1];
- if (DV)
- DV[strlen(DV)-1] = argv[1][1];
- break;
-
- default:
- printf("Bad flag %s", argv[1]);
- break;
- }
- }
- signal(SIGINT, cleanup);
- signal(SIGQUIT, cleanup);
- signal(SIGHUP, cleanup);
- signal(SIGTERM, cleanup);
-
- /*
- * The "cu" host name is used to define the
- * attributes of the generic dialer.
- */
- (void)sprintf(sbuf, "cu%d", BR);
- if ((i = hunt(sbuf)) == 0) {
- printf("all ports busy\n");
- exit(3);
- }
- if (i == -1) {
- printf("link down\n");
- (void)uu_unlock(uucplock);
- exit(3);
- }
- setbuf(stdout, NULL);
- loginit();
- user_uid();
- vinit();
- setparity("none");
- boolean(value(VERBOSE)) = 0;
- if (HW)
- ttysetup(speed(BR));
- if (connect()) {
- printf("Connect failed\n");
- daemon_uid();
- (void)uu_unlock(uucplock);
- exit(1);
- }
- if (!HW)
- ttysetup(speed(BR));
-}
diff --git a/usr.bin/tip/hunt.c b/usr.bin/tip/hunt.c
deleted file mode 100644
index 650ac26..0000000
--- a/usr.bin/tip/hunt.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-extern char *getremote();
-extern char *rindex();
-
-static jmp_buf deadline;
-static int deadfl;
-
-void
-dead()
-{
- deadfl = 1;
- longjmp(deadline, 1);
-}
-
-hunt(name)
- char *name;
-{
- register char *cp;
- sig_t f;
-
- f = signal(SIGALRM, dead);
- while (cp = getremote(name)) {
- deadfl = 0;
- uucplock = rindex(cp, '/')+1;
- if (uu_lock(uucplock) < 0)
- continue;
- /*
- * Straight through call units, such as the BIZCOMP,
- * VADIC and the DF, must indicate they're hardwired in
- * order to get an open file descriptor placed in FD.
- * Otherwise, as for a DN-11, the open will have to
- * be done in the "open" routine.
- */
- if (!HW)
- break;
- if (setjmp(deadline) == 0) {
- alarm(10);
- FD = open(cp, O_RDWR);
- }
- alarm(0);
- if (FD < 0) {
- perror(cp);
- deadfl = 1;
- }
- if (!deadfl) {
- ioctl(FD, TIOCEXCL, 0);
- ioctl(FD, TIOCHPCL, 0);
- signal(SIGALRM, SIG_DFL);
- return ((int)cp);
- }
- (void)uu_unlock(uucplock);
- }
- signal(SIGALRM, f);
- return (deadfl ? -1 : (int)cp);
-}
diff --git a/usr.bin/tip/log.c b/usr.bin/tip/log.c
deleted file mode 100644
index 5da2c45..0000000
--- a/usr.bin/tip/log.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-#ifdef ACULOG
-static FILE *flog = NULL;
-
-/*
- * Log file maintenance routines
- */
-
-logent(group, num, acu, message)
- char *group, *num, *acu, *message;
-{
- char *user, *timestamp;
- struct passwd *pwd;
- long t;
-
- if (flog == NULL)
- return;
- if (flock(fileno(flog), LOCK_EX) < 0) {
- perror("tip: flock");
- return;
- }
- if ((user = getlogin()) == NOSTR)
- if ((pwd = getpwuid(getuid())) == NOPWD)
- user = "???";
- else
- user = pwd->pw_name;
- t = time(0);
- timestamp = ctime(&t);
- timestamp[24] = '\0';
- fprintf(flog, "%s (%s) <%s, %s, %s> %s\n",
- user, timestamp, group,
-#ifdef PRISTINE
- "",
-#else
- num,
-#endif
- acu, message);
- (void) fflush(flog);
- (void) flock(fileno(flog), LOCK_UN);
-}
-
-loginit()
-{
- flog = fopen(value(LOG), "a");
- if (flog == NULL)
- fprintf(stderr, "can't open log file %s.\r\n", value(LOG));
-}
-#endif
diff --git a/usr.bin/tip/partab.c b/usr.bin/tip/partab.c
deleted file mode 100644
index 1da4e23..0000000
--- a/usr.bin/tip/partab.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)partab.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Even parity table for 0-0177
- */
-char evenpartab[] = {
- 0000,0201,0202,0003,0204,0005,0006,0207,
- 0210,0011,0012,0213,0014,0215,0216,0017,
- 0220,0021,0022,0223,0024,0225,0226,0027,
- 0030,0231,0232,0033,0234,0035,0036,0237,
- 0240,0041,0042,0243,0044,0245,0246,0047,
- 0050,0251,0252,0053,0254,0055,0056,0257,
- 0060,0261,0262,0063,0264,0065,0066,0267,
- 0270,0071,0072,0273,0074,0275,0276,0077,
- 0300,0101,0102,0303,0104,0305,0306,0107,
- 0110,0311,0312,0113,0314,0115,0116,0317,
- 0120,0321,0322,0123,0324,0125,0126,0327,
- 0330,0131,0132,0333,0134,0335,0336,0137,
- 0140,0341,0342,0143,0344,0145,0146,0347,
- 0350,0151,0152,0353,0154,0355,0356,0157,
- 0360,0161,0162,0363,0164,0365,0366,0167,
- 0170,0371,0372,0173,0374,0175,0176,0377,
-};
diff --git a/usr.bin/tip/remcap.c b/usr.bin/tip/remcap.c
deleted file mode 100644
index 7a7e0c2..0000000
--- a/usr.bin/tip/remcap.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)remcap.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * remcap - routines for dealing with the remote host data base
- *
- * derived from termcap
- */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include "pathnames.h"
-
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif
-#define MAXHOP 32 /* max number of tc= indirections */
-
-#define tgetent rgetent
-#define tnchktc rnchktc
-#define tnamatch rnamatch
-#define tgetnum rgetnum
-#define tgetflag rgetflag
-#define tgetstr rgetstr
-#define E_TERMCAP RM = _PATH_REMOTE
-#define V_TERMCAP "REMOTE"
-#define V_TERM "HOST"
-
-char *RM;
-
-/*
- * termcap - routines for dealing with the terminal capability data base
- *
- * BUG: Should use a "last" pointer in tbuf, so that searching
- * for capabilities alphabetically would not be a n**2/2
- * process when large numbers of capabilities are given.
- * Note: If we add a last pointer now we will screw up the
- * tc capability. We really should compile termcap.
- *
- * Essentially all the work here is scanning and decoding escapes
- * in string capabilities. We don't use stdio because the editor
- * doesn't, and because living w/o it is not hard.
- */
-
-static char *tbuf;
-static int hopcount; /* detect infinite loops in termcap, init 0 */
-static char *tskip();
-char *tgetstr();
-static char *tdecode();
-static char *remotefile;
-
-/*
- * Get an entry for terminal name in buffer bp,
- * from the termcap file. Parse is very rudimentary;
- * we just notice escaped newlines.
- */
-tgetent(bp, name)
- char *bp, *name;
-{
- char lbuf[BUFSIZ], *cp, *p;
- int rc1, rc2;
-
- remotefile = cp = getenv(V_TERMCAP);
- if (cp == (char *)0 || strcmp(cp, _PATH_REMOTE) == 0) {
- remotefile = cp = _PATH_REMOTE;
- return (getent(bp, name, cp));
- } else {
- if ((rc1 = getent(bp, name, cp)) != 1)
- *bp = '\0';
- remotefile = cp = _PATH_REMOTE;
- rc2 = getent(lbuf, name, cp);
- if (rc1 != 1 && rc2 != 1)
- return (rc2);
- if (rc2 == 1) {
- p = lbuf;
- if (rc1 == 1)
- while (*p++ != ':')
- ;
- if (strlen(bp) + strlen(p) > BUFSIZ) {
- write(2, "Remcap entry too long\n", 23);
- return (-1);
- }
- strcat(bp, p);
- }
- tbuf = bp;
- return (1);
- }
-}
-
-getent(bp, name, cp)
- char *bp, *name, *cp;
-{
- register int c;
- register int i = 0, cnt = 0;
- char ibuf[BUFSIZ], *cp2;
- int tf;
-
- tbuf = bp;
- tf = 0;
- /*
- * TERMCAP can have one of two things in it. It can be the
- * name of a file to use instead of /etc/termcap. In this
- * case it better start with a "/". Or it can be an entry to
- * use so we don't have to read the file. In this case it
- * has to already have the newlines crunched out.
- */
- if (cp && *cp) {
- if (*cp!='/') {
- cp2 = getenv(V_TERM);
- if (cp2 == (char *)0 || strcmp(name,cp2) == 0) {
- strcpy(bp,cp);
- return (tnchktc());
- } else
- tf = open(E_TERMCAP, O_RDONLY);
- } else
- tf = open(RM = cp, O_RDONLY);
- }
- if (tf == 0)
- tf = open(E_TERMCAP, O_RDONLY);
- if (tf < 0)
- return (-1);
- for (;;) {
- cp = bp;
- for (;;) {
- if (i == cnt) {
- cnt = read(tf, ibuf, BUFSIZ);
- if (cnt <= 0) {
- close(tf);
- return (0);
- }
- i = 0;
- }
- c = ibuf[i++];
- if (c == '\n') {
- if (cp > bp && cp[-1] == '\\') {
- cp--;
- continue;
- }
- break;
- }
- if (cp >= bp+BUFSIZ) {
- write(2,"Remcap entry too long\n", 23);
- break;
- } else
- *cp++ = c;
- }
- *cp = 0;
-
- /*
- * The real work for the match.
- */
- if (tnamatch(name)) {
- close(tf);
- return (tnchktc());
- }
- }
-}
-
-/*
- * tnchktc: check the last entry, see if it's tc=xxx. If so,
- * recursively find xxx and append that entry (minus the names)
- * to take the place of the tc=xxx entry. This allows termcap
- * entries to say "like an HP2621 but doesn't turn on the labels".
- * Note that this works because of the left to right scan.
- */
-tnchktc()
-{
- register char *p, *q;
- char tcname[16]; /* name of similar terminal */
- char tcbuf[BUFSIZ];
- char *holdtbuf = tbuf;
- int l;
- char *cp;
-
- p = tbuf + strlen(tbuf) - 2; /* before the last colon */
- while (*--p != ':')
- if (p<tbuf) {
- write(2, "Bad remcap entry\n", 18);
- return (0);
- }
- p++;
- /* p now points to beginning of last field */
- if (p[0] != 't' || p[1] != 'c')
- return (1);
- strcpy(tcname, p+3);
- q = tcname;
- while (*q && *q != ':')
- q++;
- *q = 0;
- if (++hopcount > MAXHOP) {
- write(2, "Infinite tc= loop\n", 18);
- return (0);
- }
- if (getent(tcbuf, tcname, remotefile) != 1) {
- if (strcmp(remotefile, _PATH_REMOTE) == 0)
- return (0);
- else if (getent(tcbuf, tcname, _PATH_REMOTE) != 1)
- return (0);
- }
- for (q = tcbuf; *q++ != ':'; )
- ;
- l = p - holdtbuf + strlen(q);
- if (l > BUFSIZ) {
- write(2, "Remcap entry too long\n", 23);
- q[BUFSIZ - (p-holdtbuf)] = 0;
- }
- strcpy(p, q);
- tbuf = holdtbuf;
- return (1);
-}
-
-/*
- * Tnamatch deals with name matching. The first field of the termcap
- * entry is a sequence of names separated by |'s, so we compare
- * against each such name. The normal : terminator after the last
- * name (before the first field) stops us.
- */
-tnamatch(np)
- char *np;
-{
- register char *Np, *Bp;
-
- Bp = tbuf;
- if (*Bp == '#')
- return (0);
- for (;;) {
- for (Np = np; *Np && *Bp == *Np; Bp++, Np++)
- continue;
- if (*Np == 0 && (*Bp == '|' || *Bp == ':' || *Bp == 0))
- return (1);
- while (*Bp && *Bp != ':' && *Bp != '|')
- Bp++;
- if (*Bp == 0 || *Bp == ':')
- return (0);
- Bp++;
- }
-}
-
-/*
- * Skip to the next field. Notice that this is very dumb, not
- * knowing about \: escapes or any such. If necessary, :'s can be put
- * into the termcap file in octal.
- */
-static char *
-tskip(bp)
- register char *bp;
-{
-
- while (*bp && *bp != ':')
- bp++;
- if (*bp == ':')
- bp++;
- return (bp);
-}
-
-/*
- * Return the (numeric) option id.
- * Numeric options look like
- * li#80
- * i.e. the option string is separated from the numeric value by
- * a # character. If the option is not found we return -1.
- * Note that we handle octal numbers beginning with 0.
- */
-tgetnum(id)
- char *id;
-{
- register int i, base;
- register char *bp = tbuf;
-
- for (;;) {
- bp = tskip(bp);
- if (*bp == 0)
- return (-1);
- if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
- continue;
- if (*bp == '@')
- return (-1);
- if (*bp != '#')
- continue;
- bp++;
- base = 10;
- if (*bp == '0')
- base = 8;
- i = 0;
- while (isdigit(*bp))
- i *= base, i += *bp++ - '0';
- return (i);
- }
-}
-
-/*
- * Handle a flag option.
- * Flag options are given "naked", i.e. followed by a : or the end
- * of the buffer. Return 1 if we find the option, or 0 if it is
- * not given.
- */
-tgetflag(id)
- char *id;
-{
- register char *bp = tbuf;
-
- for (;;) {
- bp = tskip(bp);
- if (!*bp)
- return (0);
- if (*bp++ == id[0] && *bp != 0 && *bp++ == id[1]) {
- if (!*bp || *bp == ':')
- return (1);
- else if (*bp == '@')
- return (0);
- }
- }
-}
-
-/*
- * Get a string valued option.
- * These are given as
- * cl=^Z
- * Much decoding is done on the strings, and the strings are
- * placed in area, which is a ref parameter which is updated.
- * No checking on area overflow.
- */
-char *
-tgetstr(id, area)
- char *id, **area;
-{
- register char *bp = tbuf;
-
- for (;;) {
- bp = tskip(bp);
- if (!*bp)
- return (0);
- if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
- continue;
- if (*bp == '@')
- return (0);
- if (*bp != '=')
- continue;
- bp++;
- return (tdecode(bp, area));
- }
-}
-
-/*
- * Tdecode does the grung work to decode the
- * string capability escapes.
- */
-static char *
-tdecode(str, area)
- register char *str;
- char **area;
-{
- register char *cp;
- register int c;
- register char *dp;
- int i;
-
- cp = *area;
- while ((c = *str++) && c != ':') {
- switch (c) {
-
- case '^':
- c = *str++ & 037;
- break;
-
- case '\\':
- dp = "E\033^^\\\\::n\nr\rt\tb\bf\f";
- c = *str++;
-nextc:
- if (*dp++ == c) {
- c = *dp++;
- break;
- }
- dp++;
- if (*dp)
- goto nextc;
- if (isdigit(c)) {
- c -= '0', i = 2;
- do
- c <<= 3, c |= *str++ - '0';
- while (--i && isdigit(*str));
- }
- break;
- }
- *cp++ = c;
- }
- *cp++ = 0;
- str = *area;
- *area = cp;
- return (str);
-}
diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c
deleted file mode 100644
index 9b86066..0000000
--- a/usr.bin/tip/remote.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "pathnames.h"
-#include "tip.h"
-
-/*
- * Attributes to be gleened from remote host description
- * data base.
- */
-static char **caps[] = {
- &AT, &DV, &CM, &CU, &EL, &IE, &OE, &PN, &PR, &DI,
- &ES, &EX, &FO, &RC, &RE, &PA
-};
-
-static char *capstrings[] = {
- "at", "dv", "cm", "cu", "el", "ie", "oe", "pn", "pr",
- "di", "es", "ex", "fo", "rc", "re", "pa", 0
-};
-
-static char *db_array[3] = { _PATH_REMOTE, 0, 0 };
-
-#define cgetflag(f) (cgetcap(bp, f, ':') != NULL)
-
-static
-getremcap(host)
- register char *host;
-{
- register char **p, ***q;
- char *bp;
- char *rempath;
- int stat;
-
- rempath = getenv("REMOTE");
- if (rempath != NULL)
- if (*rempath != '/')
- /* we have an entry */
- cgetset(rempath);
- else { /* we have a path */
- db_array[1] = rempath;
- db_array[2] = _PATH_REMOTE;
- }
-
- if ((stat = cgetent(&bp, db_array, host)) < 0) {
- if (DV ||
- host[0] == '/' && access(DV = host, R_OK | W_OK) == 0) {
- CU = DV;
- HO = host;
- HW = 1;
- DU = 0;
- if (!BR)
- BR = DEFBR;
- FS = DEFFS;
- return;
- }
- switch(stat) {
- case -1:
- fprintf(stderr, "tip: unknown host %s\n", host);
- break;
- case -2:
- fprintf(stderr,
- "tip: can't open host description file\n");
- break;
- case -3:
- fprintf(stderr,
- "tip: possible reference loop in host description file\n");
- break;
- }
- exit(3);
- }
-
- for (p = capstrings, q = caps; *p != NULL; p++, q++)
- if (**q == NULL)
- cgetstr(bp, *p, *q);
- if (!BR && (cgetnum(bp, "br", &BR) == -1))
- BR = DEFBR;
- if (cgetnum(bp, "fs", &FS) == -1)
- FS = DEFFS;
- if (DU < 0)
- DU = 0;
- else
- DU = cgetflag("du");
- if (DV == NOSTR) {
- fprintf(stderr, "%s: missing device spec\n", host);
- exit(3);
- }
- if (DU && CU == NOSTR)
- CU = DV;
- if (DU && PN == NOSTR) {
- fprintf(stderr, "%s: missing phone number\n", host);
- exit(3);
- }
-
- HD = cgetflag("hd");
-
- /*
- * This effectively eliminates the "hw" attribute
- * from the description file
- */
- if (!HW)
- HW = (CU == NOSTR) || (DU && equal(DV, CU));
- HO = host;
- /*
- * see if uppercase mode should be turned on initially
- */
- if (cgetflag("ra"))
- boolean(value(RAISE)) = 1;
- if (cgetflag("ec"))
- boolean(value(ECHOCHECK)) = 1;
- if (cgetflag("be"))
- boolean(value(BEAUTIFY)) = 1;
- if (cgetflag("nb"))
- boolean(value(BEAUTIFY)) = 0;
- if (cgetflag("sc"))
- boolean(value(SCRIPT)) = 1;
- if (cgetflag("tb"))
- boolean(value(TABEXPAND)) = 1;
- if (cgetflag("vb"))
- boolean(value(VERBOSE)) = 1;
- if (cgetflag("nv"))
- boolean(value(VERBOSE)) = 0;
- if (cgetflag("ta"))
- boolean(value(TAND)) = 1;
- if (cgetflag("nt"))
- boolean(value(TAND)) = 0;
- if (cgetflag("rw"))
- boolean(value(RAWFTP)) = 1;
- if (cgetflag("hd"))
- boolean(value(HALFDUPLEX)) = 1;
- if (RE == NOSTR)
- RE = (char *)"tip.record";
- if (EX == NOSTR)
- EX = (char *)"\t\n\b\f";
- if (ES != NOSTR)
- vstring("es", ES);
- if (FO != NOSTR)
- vstring("fo", FO);
- if (PR != NOSTR)
- vstring("pr", PR);
- if (RC != NOSTR)
- vstring("rc", RC);
- if (cgetnum(bp, "dl", &DL) == -1)
- DL = 0;
- if (cgetnum(bp, "cl", &CL) == -1)
- CL = 0;
- if (cgetnum(bp, "et", &ET) == -1)
- ET = 10;
-}
-
-char *
-getremote(host)
- char *host;
-{
- register char *cp;
- static char *next;
- static int lookedup = 0;
-
- if (!lookedup) {
- if (host == NOSTR && (host = getenv("HOST")) == NOSTR) {
- fprintf(stderr, "tip: no host specified\n");
- exit(3);
- }
- getremcap(host);
- next = DV;
- lookedup++;
- }
- /*
- * We return a new device each time we're called (to allow
- * a rotary action to be simulated)
- */
- if (next == NOSTR)
- return (NOSTR);
- if ((cp = index(next, ',')) == NULL) {
- DV = next;
- next = NOSTR;
- } else {
- *cp++ = '\0';
- DV = next;
- next = cp;
- }
- return (DV);
-}
diff --git a/usr.bin/tip/tip.1 b/usr.bin/tip/tip.1
deleted file mode 100644
index 10b8a3e..0000000
--- a/usr.bin/tip/tip.1
+++ /dev/null
@@ -1,451 +0,0 @@
-.\" Copyright (c) 1980, 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.
-.\"
-.\" @(#)tip.1 8.4 (Berkeley) 4/18/94
-.\"
-.Dd April 18, 1994
-.Dt TIP 1
-.Os BSD 4
-.Sh NAME
-.Nm tip ,
-.Nm cu
-.Nd connect to a remote system
-.Sh SYNOPSIS
-.Nm tip
-.Op Fl v
-.Fl Ns Ns Ar speed
-.Ar system\-name
-.Nm tip
-.Op Fl v
-.Fl Ns Ns Ar speed
-.Ar phone\-number
-.Nm cu
-.Ar phone\-number
-.Op Fl t
-.Op Fl s Ar speed
-.Op Fl a Ar acu
-.Op Fl l Ar line
-.Op Fl #
-.Sh DESCRIPTION
-.Nm Tip
-and
-.Ar cu
-establish a full-duplex connection to another machine,
-giving the appearance of being logged in directly on the
-remote cpu. It goes without saying that you must have a login
-on the machine (or equivalent) to which you wish to connect.
-The preferred interface is
-.Nm tip .
-The
-.Ar cu
-interface is included for those people attached to the
-``call
-.Ux Ns ''
-command of version 7. This manual page
-describes only
-.Nm tip .
-.Pp
-Available Option:
-.Bl -tag -width indent
-.It Fl v
-Set verbose mode.
-.El
-.Pp
-Typed characters are normally transmitted directly to the remote
-machine (which does the echoing as well). A tilde (`~') appearing
-as the first character of a line is an escape signal; the following
-are recognized:
-.Bl -tag -width flag
-.It Ic \&~^D No or Ic \&~ .
-Drop the connection and exit
-(you may still be logged in on the
-remote machine).
-.It Ic \&~c Op Ar name
-Change directory to
-.Ar name
-(no argument
-implies change to your home directory).
-.It Ic \&~!
-Escape to a shell (exiting the shell will
-return you to tip).
-.It Ic \&~>
-Copy file from local to remote.
-.Nm Tip
-prompts for the name of a local file to transmit.
-.It Ic \&~<
-Copy file from remote to local.
-.Nm Tip
-prompts first for the name of the file to be sent, then for
-a command to be executed on the remote machine.
-.It Ic \&~p Ar from Op Ar to
-Send a file to a remote
-.Ux
-host. The put command causes the remote
-.Ux
-system to run the command string ``cat > 'to''', while
-.Nm tip
-sends it the ``from''
-file. If the ``to'' file isn't specified the ``from'' file name is used.
-This command is actually a
-.Ux
-specific version of the ``~>'' command.
-.It Ic \&~t Ar from Op Ar to
-Take a file from a remote
-.Ux
-host.
-As in the put command the ``to'' file
-defaults to the ``from'' file name if it isn't specified.
-The remote host
-executes the command string ``cat 'from';echo ^A'' to send the file to
-.Nm tip .
-.It Ic \&~|
-Pipe the output from a remote command to a local
-.Ux
-process.
-The command string sent to the local
-.Ux
-system is processed by the shell.
-.It Ic \&~$
-Pipe the output from a local
-.Ux
-process to the remote host.
-The command string sent to the local
-.Ux
-system is processed by the shell.
-.It Ic \&~C
-Fork a child process on the local system to perform special protocols
-such as \s-1XMODEM\s+1. The child program will be run with the following
-somewhat unusual arrangement of file descriptors:
-.nf
-.in +1i
-0 <-> local tty in
-1 <-> local tty out
-2 <-> local tty out
-3 <-> remote tty in
-4 <-> remote tty out
-.in -1i
-.fi
-.It Ic \&~#
-Send a
-.Dv BREAK
-to the remote system.
-For systems which don't support the
-necessary
-.Ar ioctl
-call the break is simulated by a sequence of line speed changes
-and
-.Dv DEL
-characters.
-.It Ic \&~s
-Set a variable (see the discussion below).
-.It Ic \&~^Z
-Stop
-.Nm tip
-(only available with job control).
-.It Ic \&~^Y
-Stop only the ``local side'' of
-.Nm tip
-(only available with job control);
-the ``remote side'' of
-.Nm tip ,
-the side that displays output from the remote host, is left running.
-.It Ic \&~?
-Get a summary of the tilde escapes
-.El
-.Pp
-.Nm Tip
-uses the file
-.Pa /etc/remote
-to find how to reach a particular
-system and to find out how it should operate while talking
-to the system;
-refer to
-.Xr remote 5
-for a full description.
-Each system has a default baud rate with which to
-establish a connection. If this value is not suitable, the baud rate
-to be used may be specified on the command line, e.g.
-.Ql "tip -300 mds" .
-.Pp
-When
-.Nm tip
-establishes a connection it sends out a
-connection message to the remote system; the default value, if any,
-is defined in
-.Pa /etc/remote
-(see
-.Xr remote 5 ) .
-.Pp
-When
-.Nm tip
-prompts for an argument (e.g. during setup of
-a file transfer) the line typed may be edited with the standard
-erase and kill characters. A null line in response to a prompt,
-or an interrupt, will abort the dialogue and return you to the
-remote machine.
-.Pp
-.Nm Tip
-guards against multiple users connecting to a remote system
-by opening modems and terminal lines with exclusive access,
-and by honoring the locking protocol used by
-.Xr uucico 8 .
-.Pp
-During file transfers
-.Nm tip
-provides a running count of the number of lines transferred.
-When using the ~> and ~< commands, the ``eofread'' and ``eofwrite''
-variables are used to recognize end-of-file when reading, and
-specify end-of-file when writing (see below). File transfers
-normally depend on tandem mode for flow control. If the remote
-system does not support tandem mode, ``echocheck'' may be set
-to indicate
-.Nm tip
-should synchronize with the remote system on the echo of each
-transmitted character.
-.Pp
-When
-.Nm tip
-must dial a phone number to connect to a system it will print
-various messages indicating its actions.
-.Nm Tip
-supports the
-.Tn DEC DN Ns-11
-and
-Racal-Vadic 831 auto-call-units;
-the
-.Tn DEC DF Ns \&02
-and
-.Tn DF Ns \&03 ,
-Ventel 212+, Racal-Vadic 3451, and
-Bizcomp 1031 and 1032 integral call unit/modems.
-.Ss VARIABLES
-.Nm Tip
-maintains a set of
-.Ar variables
-which control its operation.
-Some of these variables are read-only to normal users (root is allowed
-to change anything of interest). Variables may be displayed
-and set through the ``s'' escape. The syntax for variables is patterned
-after
-.Xr vi 1
-and
-.Xr Mail 1 .
-Supplying ``all''
-as an argument to the set command displays all variables readable by
-the user. Alternatively, the user may request display of a particular
-variable by attaching a `?' to the end. For example ``escape?''
-displays the current escape character.
-.Pp
-Variables are numeric, string, character, or boolean values. Boolean
-variables are set merely by specifying their name; they may be reset
-by prepending a `!' to the name. Other variable types are set by
-concatenating an `=' and the value. The entire assignment must not
-have any blanks in it. A single set command may be used to interrogate
-as well as set a number of variables.
-Variables may be initialized at run time by placing set commands
-(without the ``~s'' prefix in a file
-.Pa .tiprc
-in one's home directory). The
-.Fl v
-option causes
-.Nm tip
-to display the sets as they are made.
-Certain common variables have abbreviations.
-The following is a list of common variables,
-their abbreviations, and their default values.
-.Bl -tag -width Ar
-.It Ar beautify
-(bool) Discard unprintable characters when a session is being scripted;
-abbreviated
-.Ar be .
-.It Ar baudrate
-(num) The baud rate at which the connection was established;
-abbreviated
-.Ar ba .
-.It Ar dialtimeout
-(num) When dialing a phone number, the time (in seconds)
-to wait for a connection to be established; abbreviated
-.Ar dial .
-.It Ar echocheck
-(bool) Synchronize with the remote host during file transfer by
-waiting for the echo of the last character transmitted; default is
-.Ar off .
-.It Ar eofread
-(str) The set of characters which signify an end-of-transmission
-during a ~< file transfer command; abbreviated
-.Ar eofr .
-.It Ar eofwrite
-(str) The string sent to indicate end-of-transmission during
-a ~> file transfer command; abbreviated
-.Ar eofw .
-.It Ar eol
-(str) The set of characters which indicate an end-of-line.
-.Nm Tip
-will recognize escape characters only after an end-of-line.
-.It Ar escape
-(char) The command prefix (escape) character; abbreviated
-.Ar es ;
-default value is `~'.
-.It Ar exceptions
-(str) The set of characters which should not be discarded
-due to the beautification switch; abbreviated
-.Ar ex ;
-default value is ``\et\en\ef\eb''.
-.It Ar force
-(char) The character used to force literal data transmission;
-abbreviated
-.Ar fo ;
-default value is `^P'.
-.It Ar framesize
-(num) The amount of data (in bytes) to buffer between file system
-writes when receiving files; abbreviated
-.Ar fr .
-.It Ar host
-(str) The name of the host to which you are connected; abbreviated
-.Ar ho .
-.It Ar prompt
-(char) The character which indicates an end-of-line on the remote
-host; abbreviated
-.Ar pr ;
-default value is `\en'. This value is used to synchronize during
-data transfers. The count of lines transferred during a file transfer
-command is based on receipt of this character.
-.It Ar raise
-(bool) Upper case mapping mode; abbreviated
-.Ar ra ;
-default value is
-.Ar off .
-When this mode is enabled, all lower case letters will be mapped to
-upper case by
-.Nm tip
-for transmission to the remote machine.
-.It Ar raisechar
-(char) The input character used to toggle upper case mapping mode;
-abbreviated
-.Ar rc ;
-default value is `^A'.
-.It Ar record
-(str) The name of the file in which a session script is recorded;
-abbreviated
-.Ar rec ;
-default value is ``tip.record''.
-.It Ar script
-(bool) Session scripting mode; abbreviated
-.Ar sc ;
-default is
-.Ar off .
-When
-.Ar script
-is
-.Li true ,
-.Nm tip
-will record everything transmitted by the remote machine in
-the script record file specified in
-.Ar record .
-If the
-.Ar beautify
-switch is on, only printable
-.Tn ASCII
-characters will be included in
-the script file (those characters betwee 040 and 0177). The
-variable
-.Ar exceptions
-is used to indicate characters which are an exception to the normal
-beautification rules.
-.It Ar tabexpand
-(bool) Expand tabs to spaces during file transfers; abbreviated
-.Ar tab ;
-default value is
-.Ar false .
-Each tab is expanded to 8 spaces.
-.It Ar verbose
-(bool) Verbose mode; abbreviated
-.Ar verb ;
-default is
-.Ar true .
-When verbose mode is enabled,
-.Nm tip
-prints messages while dialing, shows the current number
-of lines transferred during a file transfer operations,
-and more.
-.El
-.Sh ENVIRONMENT
-.Nm Tip
-uses the following environment variables:
-.Bl -tag -width Fl
-.It Ev SHELL
-(str) The name of the shell to use for the ~! command; default
-value is ``/bin/sh'', or taken from the environment.
-.It Ev HOME
-(str) The home directory to use for the ~c command; default
-value is taken from the environment.
-.It Ev HOST
-Check for a default host if none specified.
-.El
-.Pp
-The variables
-.Ev ${REMOTE}
-and
-.Ev ${PHONES}
-are also exported.
-.Sh FILES
-.Bl -tag -width /var/spool/uucp/LCK..* -compact
-.It Pa /etc/remote
-Global system descriptions.
-.It Pa /etc/phones
-Global phone number data base.
-.It ${REMOTE}
-Private system descriptions.
-.It ${PHONES}
-Private phone numbers.
-.It ~/.tiprc
-Initialization file.
-.It Pa tip.record
-Record file.
-.It /var/log/aculog
-Line access log.
-.It Pa /var/spool/uucp/LCK..*
-Lock file to avoid conflicts with
-.Xr uucp .
-.El
-.Sh DIAGNOSTICS
-Diagnostics are, hopefully, self explanatory.
-.Sh SEE ALSO
-.Xr remote 5 ,
-.Xr phones 5
-.Sh HISTORY
-The
-.Nm tip
-appeared command in
-.Bx 4.2 .
-.Sh BUGS
-The full set of variables is undocumented and should, probably, be
-pared down.
diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c
deleted file mode 100644
index ce29a21..0000000
--- a/usr.bin/tip/value.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-
-#define MIDDLE 35
-
-static value_t *vlookup();
-static int col = 0;
-
-/*
- * Variable manipulation
- */
-vinit()
-{
- register value_t *p;
- register char *cp;
- FILE *f;
- char file[256];
-
- for (p = vtable; p->v_name != NULL; p++) {
- if (p->v_type&ENVIRON)
- if (cp = getenv(p->v_name))
- p->v_value = cp;
- if (p->v_type&IREMOTE)
- number(p->v_value) = *address(p->v_value);
- }
- /*
- * Read the .tiprc file in the HOME directory
- * for sets
- */
- strcpy(file, value(HOME));
- strcat(file, "/.tiprc");
- if ((f = fopen(file, "r")) != NULL) {
- register char *tp;
-
- while (fgets(file, sizeof(file)-1, f) != NULL) {
- if (vflag)
- printf("set %s", file);
- if (tp = rindex(file, '\n'))
- *tp = '\0';
- vlex(file);
- }
- fclose(f);
- }
- /*
- * To allow definition of exception prior to fork
- */
- vtable[EXCEPTIONS].v_access &= ~(WRITE<<PUBLIC);
-}
-
-static int vaccess();
-
-/*VARARGS1*/
-vassign(p, v)
- register value_t *p;
- char *v;
-{
-
- if (!vaccess(p->v_access, WRITE)) {
- printf("access denied\r\n");
- return;
- }
- switch (p->v_type&TMASK) {
-
- case STRING:
- if (p->v_value && equal(p->v_value, v))
- return;
- if (!(p->v_type&(ENVIRON|INIT)))
- free(p->v_value);
- if ((p->v_value = malloc(size(v)+1)) == NOSTR) {
- printf("out of core\r\n");
- return;
- }
- p->v_type &= ~(ENVIRON|INIT);
- strcpy(p->v_value, v);
- break;
-
- case NUMBER:
- if (number(p->v_value) == number(v))
- return;
- number(p->v_value) = number(v);
- break;
-
- case BOOL:
- if (boolean(p->v_value) == (*v != '!'))
- return;
- boolean(p->v_value) = (*v != '!');
- break;
-
- case CHAR:
- if (character(p->v_value) == *v)
- return;
- character(p->v_value) = *v;
- }
- p->v_access |= CHANGED;
-}
-
-static void vprint();
-
-vlex(s)
- register char *s;
-{
- register value_t *p;
- static void vtoken();
-
- if (equal(s, "all")) {
- for (p = vtable; p->v_name; p++)
- if (vaccess(p->v_access, READ))
- vprint(p);
- } else {
- register char *cp;
-
- do {
- if (cp = vinterp(s, ' '))
- cp++;
- vtoken(s);
- s = cp;
- } while (s);
- }
- if (col > 0) {
- printf("\r\n");
- col = 0;
- }
-}
-
-static void
-vtoken(s)
- register char *s;
-{
- register value_t *p;
- register char *cp;
- char *expand();
-
- if (cp = index(s, '=')) {
- *cp = '\0';
- if (p = vlookup(s)) {
- cp++;
- if (p->v_type&NUMBER)
- vassign(p, atoi(cp));
- else {
- if (strcmp(s, "record") == 0)
- cp = expand(cp);
- vassign(p, cp);
- }
- return;
- }
- } else if (cp = index(s, '?')) {
- *cp = '\0';
- if ((p = vlookup(s)) && vaccess(p->v_access, READ)) {
- vprint(p);
- return;
- }
- } else {
- if (*s != '!')
- p = vlookup(s);
- else
- p = vlookup(s+1);
- if (p != NOVAL) {
- vassign(p, s);
- return;
- }
- }
- printf("%s: unknown variable\r\n", s);
-}
-
-static void
-vprint(p)
- register value_t *p;
-{
- register char *cp;
- extern char *interp(), *ctrl();
-
- if (col > 0 && col < MIDDLE)
- while (col++ < MIDDLE)
- putchar(' ');
- col += size(p->v_name);
- switch (p->v_type&TMASK) {
-
- case BOOL:
- if (boolean(p->v_value) == FALSE) {
- col++;
- putchar('!');
- }
- printf("%s", p->v_name);
- break;
-
- case STRING:
- printf("%s=", p->v_name);
- col++;
- if (p->v_value) {
- cp = interp(p->v_value, NULL);
- col += size(cp);
- printf("%s", cp);
- }
- break;
-
- case NUMBER:
- col += 6;
- printf("%s=%-5d", p->v_name, number(p->v_value));
- break;
-
- case CHAR:
- printf("%s=", p->v_name);
- col++;
- if (p->v_value) {
- cp = ctrl(character(p->v_value));
- col += size(cp);
- printf("%s", cp);
- }
- break;
- }
- if (col >= MIDDLE) {
- col = 0;
- printf("\r\n");
- return;
- }
-}
-
-
-static int
-vaccess(mode, rw)
- register unsigned mode, rw;
-{
- if (mode & (rw<<PUBLIC))
- return (1);
- if (mode & (rw<<PRIVATE))
- return (1);
- return ((mode & (rw<<ROOT)) && getuid() == 0);
-}
-
-static value_t *
-vlookup(s)
- register char *s;
-{
- register value_t *p;
-
- for (p = vtable; p->v_name; p++)
- if (equal(p->v_name, s) || (p->v_abrev && equal(p->v_abrev, s)))
- return (p);
- return (NULL);
-}
-
-char *
-vinterp(s, stop)
- register char *s;
- char stop;
-{
- register char *p = s, c;
- int num;
-
- while ((c = *s++) && c != stop)
- switch (c) {
-
- case '^':
- if (*s)
- *p++ = *s++ - 0100;
- else
- *p++ = c;
- break;
-
- case '\\':
- num = 0;
- c = *s++;
- if (c >= '0' && c <= '7')
- num = (num<<3)+(c-'0');
- else {
- register char *q = "n\nr\rt\tb\bf\f";
-
- for (; *q; q++)
- if (c == *q++) {
- *p++ = *q;
- goto cont;
- }
- *p++ = c;
- cont:
- break;
- }
- if ((c = *s++) >= '0' && c <= '7') {
- num = (num<<3)+(c-'0');
- if ((c = *s++) >= '0' && c <= '7')
- num = (num<<3)+(c-'0');
- else
- s--;
- } else
- s--;
- *p++ = num;
- break;
-
- default:
- *p++ = c;
- }
- *p = '\0';
- return (c == stop ? s-1 : NULL);
-}
-
-/*
- * assign variable s with value v (for NUMBER or STRING or CHAR types)
- */
-
-vstring(s,v)
- register char *s;
- register char *v;
-{
- register value_t *p;
- char *expand();
-
- p = vlookup(s);
- if (p == 0)
- return (1);
- if (p->v_type&NUMBER)
- vassign(p, atoi(v));
- else {
- if (strcmp(s, "record") == 0)
- v = expand(v);
- vassign(p, v);
- }
- return (0);
-}
diff --git a/usr.bin/tip/vars.c b/usr.bin/tip/vars.c
deleted file mode 100644
index debe01b..0000000
--- a/usr.bin/tip/vars.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "tip.h"
-#include "pathnames.h"
-
-/*
- * Definition of variables
- */
-value_t vtable[] = {
- { "beautify", BOOL, (READ|WRITE)<<PUBLIC,
- "be", (char *)TRUE },
- { "baudrate", NUMBER|IREMOTE|INIT, (READ<<PUBLIC)|(WRITE<<ROOT),
- "ba", (char *)&BR },
- { "dialtimeout",NUMBER, (READ<<PUBLIC)|(WRITE<<ROOT),
- "dial", (char *)60 },
- { "eofread", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "eofr", (char *)&IE },
- { "eofwrite", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "eofw", (char *)&OE },
- { "eol", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- NOSTR, (char *)&EL },
- { "escape", CHAR, (READ|WRITE)<<PUBLIC,
- "es", (char *)'~' },
- { "exceptions", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC,
- "ex", (char *)&EX },
- { "force", CHAR, (READ|WRITE)<<PUBLIC,
- "fo", (char *)CTRL('p') },
- { "framesize", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "fr", (char *)&FS },
- { "host", STRING|IREMOTE|INIT, READ<<PUBLIC,
- "ho", (char *)&HO },
- { "log", STRING|INIT, (READ|WRITE)<<ROOT,
- NOSTR, _PATH_ACULOG },
- { "phones", STRING|INIT|IREMOTE, READ<<PUBLIC,
- NOSTR, (char *)&PH },
- { "prompt", CHAR, (READ|WRITE)<<PUBLIC,
- "pr", (char *)'\n' },
- { "raise", BOOL, (READ|WRITE)<<PUBLIC,
- "ra", (char *)FALSE },
- { "raisechar", CHAR, (READ|WRITE)<<PUBLIC,
- "rc", (char *)CTRL('a') },
- { "record", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC,
- "rec", (char *)&RE },
- { "remote", STRING|INIT|IREMOTE, READ<<PUBLIC,
- NOSTR, (char *)&RM },
- { "script", BOOL, (READ|WRITE)<<PUBLIC,
- "sc", (char *)FALSE },
- { "tabexpand", BOOL, (READ|WRITE)<<PUBLIC,
- "tab", (char *)FALSE },
- { "verbose", BOOL, (READ|WRITE)<<PUBLIC,
- "verb", (char *)TRUE },
- { "SHELL", STRING|ENVIRON|INIT, (READ|WRITE)<<PUBLIC,
- NULL, _PATH_BSHELL },
- { "HOME", STRING|ENVIRON, (READ|WRITE)<<PUBLIC,
- NOSTR, NOSTR },
- { "echocheck", BOOL, (READ|WRITE)<<PUBLIC,
- "ec", (char *)FALSE },
- { "disconnect", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "di", (char *)&DI },
- { "tandem", BOOL, (READ|WRITE)<<PUBLIC,
- "ta", (char *)TRUE },
- { "linedelay", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "ldelay", (char *)&DL },
- { "chardelay", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "cdelay", (char *)&CL },
- { "etimeout", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
- "et", (char *)&ET },
- { "rawftp", BOOL, (READ|WRITE)<<PUBLIC,
- "raw", (char *)FALSE },
- { "halfduplex", BOOL, (READ|WRITE)<<PUBLIC,
- "hdx", (char *)FALSE },
- { "localecho", BOOL, (READ|WRITE)<<PUBLIC,
- "le", (char *)FALSE },
- { "parity", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC,
- "par", (char *)&PA },
- { NOSTR, NULL, NULL, NOSTR, NOSTR }
-};
diff --git a/usr.bin/uucp/acucntrl/acucntrl.c b/usr.bin/uucp/acucntrl/acucntrl.c
deleted file mode 100644
index deba6ba..0000000
--- a/usr.bin/uucp/acucntrl/acucntrl.c
+++ /dev/null
@@ -1,814 +0,0 @@
-/*-
- * Copyright (c) 1985, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1985, 1986, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)acucntrl.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/* acucntrl - turn around tty line between dialin and dialout
- *
- * Usage: acucntrl {enable,disable} /dev/ttydX
- *
- * History:
- * First written by Allan Wilkes (fisher!allan)
- *
- * Modified June 8,1983 by W.Sebok (astrovax!wls) to poke kernel rather
- * than use kernel hack to turn on/off modem control, using subroutine
- * stolen from program written by Tsutomu Shimomura
- * {astrovax,escher}!tsutomu
- *
- * Worked over many times by W.Sebok (i.e. hacked to death)
- *
- * Operation:
- * disable (i.e. setup for dialing out)
- * (1) check input arguments
- * (2) look in _PATH_UTMP to check that the line is not in use by another
- * (3) disable modem control on terminal
- * (4) check for carrier on device
- * (5) change owner of device to real id
- * (6) edit _PATH_TTYS, changing the first character of the appropriate
- * line to 0
- * (7) send a hangup to process 1 to poke init to disable getty
- * (8) post uid name in capitals in _PATH_UTMP to let world know device
- * has been grabbed
- * (9) make sure that DTR is on
- *
- * enable (i.e.) restore for dialin
- * (1) check input arguments
- * (2) look in _PATH_UTMP to check that the line is not in use by another
- * (3) make sure modem control on terminal is disabled
- * (4) turn off DTR to make sure line is hung up
- * (5) condition line: clear exclusive use and set hangup on close modes
- * (6) turn on modem control
- * (7) edit _PATH_TTYS, changing the first character of the appropriate
- * line to 1
- * (8) send a hangup to process 1 to poke init to enable getty
- * (9) clear uid name for _PATH_UTMP
- */
-
-/* #define SENSECARRIER */
-
-#include "uucp.h"
-#ifdef DIALINOUT
-#include <sys/buf.h>
-#include <signal.h>
-#include <sys/conf.h>
-#ifdef vax
-#ifdef BSD4_2
-#include <vaxuba/ubavar.h>
-#else
-#include <sys/ubavar.h>
-#endif
-#endif /* vax */
-#include <sys/stat.h>
-#include <nlist.h>
-#include <sgtty.h>
-#include <utmp.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <sys/file.h>
-#include "pathnames.h"
-
-#define NDZLINE 8 /* lines/dz */
-#define NDHLINE 16 /* lines/dh */
-#define NDMFLINE 8 /* lines/dmf */
-
-#define DZ11 1
-#define DH11 2
-#define DMF 3
-
-#define NLVALUE(val) (nl[val].n_value)
-
-struct nlist nl[] = {
-#define CDEVSW 0
- { "_cdevsw" },
-
-#define DZOPEN 1
- { "_dzopen" },
-#define DZINFO 2
- { "_dzinfo" },
-#define NDZ11 3
- { "_dz_cnt" },
-#define DZSCAR 4
- { "_dzsoftCAR" },
-
-#define DHOPEN 5
- { "_dhopen" },
-#define DHINFO 6
- { "_dhinfo" },
-#define NDH11 7
- { "_ndh11" },
-#define DHSCAR 8
- { "_dhsoftCAR" },
-
-#define DMFOPEN 9
- { "_dmfopen" },
-#define DMFINFO 10
- { "_dmfinfo" },
-#define NDMF 11
- { "_ndmf" },
-#define DMFSCAR 12
- { "_dmfsoftCAR" },
-
- { "\0" }
-};
-
-#define ENABLE 1
-#define DISABLE 0
-
-char Etcttys[] = _PATH_TTYS;
-#ifdef BSD4_3
-FILE *ttysfile, *nttysfile;
-char NEtcttys[] = _PATH_NEWTTYS;
-extern long ftell();
-#endif BSD4_3
-char Devhome[] = _PATH_DEV;
-
-char usage[] = "Usage: acucntrl {dis|en}able ttydX\n";
-
-struct utmp utmp;
-char resettty, resetmodem;
-int etcutmp;
-off_t utmploc;
-off_t ttyslnbeg;
-extern int errno;
-extern char *sys_errlist[];
-off_t lseek();
-
-#define NAMSIZ sizeof(utmp.ut_name)
-#define LINSIZ sizeof(utmp.ut_line)
-
-main(argc, argv)
-int argc; char *argv[];
-{
- register char *p;
- register int i;
- char uname[NAMSIZ], Uname[NAMSIZ];
- int enable ;
- char *device;
- int devfile;
- int uid, gid;
- struct passwd *getpwuid();
- char *rindex();
-
- /* check input arguments */
- if (argc!=3 && argc != 4) {
- fprintf(stderr, usage);
- exit(1);
- }
-
- /* interpret command type */
- if (prefix(argv[1], "disable") || strcmp(argv[1], "dialout")==0)
- enable = 0;
- else if (prefix(argv[1], "enable") || strcmp(argv[1], "dialin")==0)
- enable = 1;
- else {
- fprintf(stderr, usage);
- exit(1);
- }
-
- device = rindex(argv[2], '/');
- device = (device == NULL) ? argv[2]: device+1;
-
- opnttys(device);
-
-#ifdef vax
- /* Get nlist info */
- nlist(_PATH_UNIX, nl);
-#endif vax
-
- /* Chdir to /dev */
- if(chdir(Devhome) < 0) {
- fprintf(stderr, "Cannot chdir to %s: %s\r\n",
- Devhome, sys_errlist[errno]);
- exit(1);
- }
-
- /* Get uid information */
- uid = getuid();
- gid = getgid();
-
- p = getpwuid(uid)->pw_name;
- if (p==NULL) {
- fprintf(stderr, "cannot get uid name\n");
- exit(1);
- }
-
- if (strcmp(p, "uucp") == 0 && argc == 4)
- p = argv[3];
-
- /* to upper case */
- i = 0;
- do {
- uname[i] = *p;
- Uname[i++] = (*p>='a' && *p<='z') ? (*p - ('a'-'A')) : *p;
- } while (*p++ && i<NAMSIZ);
-
- /* check to see if line is being used */
- if( (etcutmp = open(_PATH_UTMP, 2)) < 0) {
- fprintf(stderr, "On open %s open: %s\n",
- _PATH_UTMP, sys_errlist[errno]);
- exit(1);
- }
-
- (void)lseek(etcutmp, utmploc, 0);
-
- i = read(etcutmp, (char *)&utmp, sizeof(struct utmp));
-
- if(
- i == sizeof(struct utmp) &&
- utmp.ut_line[0] != '\0' &&
- utmp.ut_name[0] != '\0' &&
- (
- !upcase(utmp.ut_name, NAMSIZ) ||
- (
- uid != 0 &&
- strncmp(utmp.ut_name, Uname, NAMSIZ) != 0
- )
- )
- ) {
- fprintf(stderr, "%s in use by %s\n", device, utmp.ut_name);
- exit(2);
- }
-
-#ifndef sequent
- /* Disable modem control */
- if (setmodem(device, DISABLE) < 0) {
- fprintf(stderr, "Unable to disable modem control\n");
- exit(1);
- }
-#endif !sequent
-
- if (enable) {
-#ifdef sequent
- if (setmodem(device, ENABLE) < 0) {
- fprintf(stderr, "Cannot Enable modem control\n");
- (void)setmodem(device, i);
- exit(1);
- }
-#endif sequent
-#ifndef sequent
- if((devfile = open(device, 1)) < 0) {
- fprintf(stderr, "On open of %s: %s\n",
- device, sys_errlist[errno]);
- (void)setmodem(device, resetmodem);
- exit(1);
- }
- /* Try one last time to hang up */
- if (ioctl(devfile, (int)TIOCCDTR, (char *)0) < 0)
- fprintf(stderr, "On TIOCCDTR ioctl: %s\n",
- sys_errlist[errno]);
-
- if (ioctl(devfile, (int)TIOCNXCL, (char *)0) < 0)
- fprintf(stderr,
- "Cannot clear Exclusive Use on %s: %s\n",
- device, sys_errlist[errno]);
-
- if (ioctl(devfile, (int)TIOCHPCL, (char *)0) < 0)
- fprintf(stderr,
- "Cannot set hangup on close on %s: %s\n",
- device, sys_errlist[errno]);
-
-#endif !sequent
- i = resetmodem;
-
-#ifndef sequent
- if (setmodem(device, ENABLE) < 0) {
- fprintf(stderr, "Cannot Enable modem control\n");
- (void)setmodem(device, i);
- exit(1);
- }
-#endif sequent
- resetmodem=i;
-
- if (settys(ENABLE)) {
- fprintf(stderr, "%s already enabled\n", device);
- } else {
- pokeinit(device, Uname, enable);
- }
- post(device, "");
-
- } else {
-#if defined(TIOCMGET) && defined(SENSECARRIER)
- if (uid!=0) {
- int linestat = 0;
-
- /* check for presence of carrier */
- sleep(2); /* need time after modem control turnoff */
-
- if((devfile = open(device, 1)) < 0) {
- fprintf(stderr, "On open of %s: %s\n",
- device, sys_errlist[errno]);
- (void)setmodem(device, resetmodem);
- exit(1);
- }
-
- (void)ioctl(devfile, TIOCMGET, &linestat);
-
- if (linestat&TIOCM_CAR) {
- fprintf(stderr, "%s is in use (Carrier On)\n",
- device);
- (void)setmodem(device, resetmodem);
- exit(2);
- }
- (void)close(devfile);
- }
-#endif TIOCMGET
- /* chown device */
- if(chown(device, uid, gid) < 0)
- fprintf(stderr, "Cannot chown %s: %s\n",
- device, sys_errlist[errno]);
-
-
- /* poke init */
- if(settys(DISABLE)) {
- fprintf(stderr, "%s already disabled\n", device);
- } else {
- pokeinit(device, Uname, enable);
- }
- post(device, Uname);
-#ifdef sequent
- /* Disable modem control */
- if (setmodem(device, DISABLE) < 0) {
- fprintf(stderr, "Unable to disable modem control\n");
- exit(1);
- }
-#endif sequent
- if((devfile = open(device, O_RDWR|O_NDELAY)) < 0) {
- fprintf(stderr, "On %s open: %s\n",
- device, sys_errlist[errno]);
- } else {
- if(ioctl(devfile, (int)TIOCSDTR, (char *)0) < 0)
- fprintf(stderr,
- "Cannot set DTR on %s: %s\n",
- device, sys_errlist[errno]);
- }
- }
-
- exit(0);
-}
-
-/* return true if no lower case */
-upcase(str, len)
-register char *str;
-register int len;
-{
- for (; *str, --len >= 0 ; str++)
- if (*str>='a' && *str<='z')
- return(0);
- return(1);
-}
-
-/* Post name to public */
-post(device, name)
-char *device, *name;
-{
- (void)time((time_t *)&utmp.ut_time);
- strncpy(utmp.ut_line, device, LINSIZ);
- strncpy(utmp.ut_name, name, NAMSIZ);
- if (lseek(etcutmp, utmploc, 0) < 0)
- fprintf(stderr, "on lseek in %s: %s",
- _PATH_UTMP, sys_errlist[errno]);
- if (write(etcutmp, (char *)&utmp, sizeof(utmp)) < 0)
- fprintf(stderr, "on write in %s: %s",
- _PATH_UTMP, sys_errlist[errno]);
-}
-
-/* poke process 1 and wait for it to do its thing */
-pokeinit(device, uname, enable)
-char *uname, *device; int enable;
-{
- struct utmp utmp;
- register int i;
-
- post(device, uname);
-
- /* poke init */
- if (kill(1, SIGHUP)) {
- fprintf(stderr,
- "Cannot send hangup to init process: %s\n",
- sys_errlist[errno]);
- (void)settys(resettty);
- (void)setmodem(device, resetmodem);
- exit(1);
- }
-
- if (enable)
- return;
-
- /* wait till init has responded, clearing the utmp entry */
- i = 100;
- do {
- sleep(1);
- if (lseek(etcutmp, utmploc, 0) < 0)
- fprintf(stderr, "On lseek in %s: %s",
- _PATH_UTMP, sys_errlist[errno]);
- if (read(etcutmp, (char *)&utmp, sizeof utmp) < 0)
- fprintf(stderr, "On read from %s: %s",
- _PATH_UTMP, sys_errlist[errno]);
- } while (utmp.ut_name[0] != '\0' && --i > 0);
-}
-
-#ifdef BSD4_3
-/* identify terminal line in ttys */
-opnttys(device)
-char *device;
-{
- register int ndevice;
- register char *p;
- char *index();
- char linebuf[BUFSIZ];
-
- ttysfile = NULL;
- do {
- if (ttysfile != NULL) {
- fclose(ttysfile);
- sleep(5);
- }
- ttysfile = fopen(Etcttys, "r");
- if(ttysfile == NULL) {
- fprintf(stderr, "Cannot open %s: %s\n", Etcttys,
- sys_errlist[errno]);
- exit(1);
- }
- } while (flock(fileno(ttysfile), LOCK_NB|LOCK_EX) < 0);
- nttysfile = fopen(NEtcttys, "w");
- if(nttysfile == NULL) {
- fprintf(stderr, "Cannot open %s: %s\n", Etcttys,
- sys_errlist[errno]);
- exit(1);
- }
-
- ndevice = strlen(device);
-#ifndef BRL4_2
- utmploc = sizeof(utmp);
-#else BRL4_2
- utmploc = 0;
-#endif BRL4_2
-
- while(fgets(linebuf, sizeof(linebuf) - 1, ttysfile) != NULL) {
- if(strncmp(device, linebuf, ndevice) == 0)
- return;
- ttyslnbeg += strlen(linebuf);
- if (linebuf[0] != '#' && linebuf[0] != '\0')
- utmploc += sizeof(utmp);
- if (fputs(linebuf, nttysfile) == NULL) {
- fprintf(stderr, "On %s write: %s\n",
- Etcttys, sys_errlist[errno]);
- exit(1);
- }
-
- }
- fprintf(stderr, "%s not found in %s\n", device, Etcttys);
- exit(1);
-}
-
-/* modify appropriate line in _PATH_TTYS to turn on/off the device */
-settys(enable)
-int enable;
-{
- register char *cp, *cp2;
- char lbuf[BUFSIZ];
- int i;
- char c1, c2;
-
- (void) fseek(ttysfile, ttyslnbeg, 0);
- if(fgets(lbuf, BUFSIZ, ttysfile) == NULL) {
- fprintf(stderr, "On %s read: %s\n",
- Etcttys, sys_errlist[errno]);
- exit(1);
- }
- /* format is now */
- /* ttyd0 std.100 dialup on secure # comment */
- /* except, 2nd item may have embedded spaces inside quotes, Hubert */
- cp = lbuf;
- for (i=0;*cp && i<3;i++) {
- if (*cp == '"') {
- cp++;
- while (*cp && *cp != '"')
- cp++;
- if (*cp != '\0')
- cp++;
- }else {
- while (*cp && *cp != ' ' && *cp != '\t')
- cp++;
- }
- while (*cp && (*cp == ' ' || *cp == '\t'))
- cp++;
- }
- if (*cp == '\0') {
- fprintf(stderr,"Badly formatted line in %s:\n%s",
- _PATH_TTYS, lbuf);
- exit(1);
- }
- c1 = *--cp;
- *cp++ = '\0';
- cp2 = cp;
- while (*cp && *cp != ' ' && *cp != '\t' && *cp != '\n')
- cp++;
- if (*cp == '\0') {
- fprintf(stderr,"Badly formatted line in %s:\n%s",
- _PATH_TTYS, lbuf);
- exit(1);
- }
- c2 = *cp;
- *cp++ = '\0';
- while (*cp && (*cp == ' ' || *cp == '\t'))
- cp++;
- resettty = strcmp("on", cp2) != 0;
- fprintf(nttysfile,"%s%c%s%c%s", lbuf, c1, enable ? "on" : "off", c2, cp);
- if (ferror(nttysfile)) {
- fprintf(stderr, "On %s fprintf: %s\n",
- NEtcttys, sys_errlist[errno]);
- exit(1);
- }
- while(fgets(lbuf, sizeof(lbuf) - 1, ttysfile) != NULL) {
- if (fputs(lbuf, nttysfile) == NULL) {
- fprintf(stderr, "On %s write: %s\n",
- NEtcttys, sys_errlist[errno]);
- exit(1);
- }
- }
-
- if (enable^resettty)
- (void) unlink(NEtcttys);
- else {
- struct stat statb;
- if (stat(Etcttys, &statb) == 0) {
- fchmod(fileno(nttysfile) ,statb.st_mode);
- fchown(fileno(nttysfile), statb.st_uid, statb.st_gid);
- }
- (void) rename(NEtcttys, Etcttys);
- }
- (void) fclose(nttysfile);
- (void) fclose(ttysfile);
- return enable^resettty;
-}
-
-#else !BSD4_3
-
-/* identify terminal line in ttys */
-opnttys(device)
-char *device;
-{
- register FILE *ttysfile;
- register int ndevice, lnsiz;
- register char *p;
- char *index();
- char linebuf[BUFSIZ];
-
- ttysfile = fopen(Etcttys, "r");
- if(ttysfile == NULL) {
- fprintf(stderr, "Cannot open %s: %s\n", Etcttys,
- sys_errlist[errno]);
- exit(1);
- }
-
- ndevice = strlen(device);
- ttyslnbeg = 0;
- utmploc = 0;
-
- while(fgets(linebuf, sizeof(linebuf) - 1, ttysfile) != NULL) {
- lnsiz = strlen(linebuf);
- if ((p = index(linebuf, '\n')) != NULL)
- *p = '\0';
- if(strncmp(device, &linebuf[2], ndevice) == 0) {
- (void)fclose(ttysfile);
-#ifdef sequent
- /* Why is the sequent off by one? */
- utmploc += sizeof(utmp);
-#endif sequent
- return;
- }
- ttyslnbeg += lnsiz;
- utmploc += sizeof(utmp);
- }
- fprintf(stderr, "%s not found in %s\n", device, Etcttys);
- exit(1);
-}
-
-/* modify appropriate line in _PATH_TTYS to turn on/off the device */
-settys(enable)
-int enable;
-{
- int ittysfil;
- char out, in;
-
- ittysfil = open(Etcttys, 2);
- if(ittysfil < 0) {
- fprintf(stderr, "Cannot open %s for output: %s\n",
- Etcttys, sys_errlist[errno]);
- exit(1);
- }
- (void)lseek(ittysfil, ttyslnbeg, 0);
- if(read(ittysfil, &in, 1)<0) {
- fprintf(stderr, "On %s write: %s\n",
- Etcttys, sys_errlist[errno]);
- exit(1);
- }
- resettty = (in == '1');
- out = enable ? '1' : '0';
- (void)lseek(ittysfil, ttyslnbeg, 0);
- if(write(ittysfil, &out, 1)<0) {
- fprintf(stderr, "On %s write: %s\n",
- Etcttys, sys_errlist[errno]);
- exit(1);
- }
- (void)close(ittysfil);
- return(in==out);
-}
-#endif !BSD4_3
-
-#ifdef sequent
-setmodem(ttyline, enable)
-char *ttyline; int enable;
-{
- char *sysbuf[BUFSIZ];
- sprintf(sysbuf,"/etc/ttyconfig /dev/%s -special %s", ttyline,
- enable ? "-carrier" : "-nocarrier");
- system(sysbuf);
-}
-#endif /* sequent */
-#ifdef vax
-/*
- * Excerpted from (June 8, 1983 W.Sebok)
- * > ttymodem.c - enable/disable modem control for tty lines.
- * >
- * > Knows about DZ11s and DH11/DM11s.
- * > 23.3.83 - TS
- * > modified to know about DMF's (hasn't been tested) Nov 8, 1984 - WLS
- */
-
-
-setmodem(ttyline, enable)
-char *ttyline; int enable;
-{
- dev_t dev;
- int kmem;
- int unit, line, nlines, addr, tflags;
- int devtype=0;
- char cflags; short sflags;
-#ifdef BSD4_2
- int flags;
-#else
- short flags;
-#endif
- struct uba_device *ubinfo;
- struct stat statb;
- struct cdevsw cdevsw;
-
- if(nl[CDEVSW].n_type == 0) {
- fprintf(stderr, "No namelist.\n");
- return(-1);
- }
-
- if((kmem = open(_PATH_KMEM, 2)) < 0) {
- fprintf(stderr, "%s open: %s\n", _PATH_KMEM,
- sys_errlist[errno]);
- return(-1);
- }
-
- if(stat(ttyline, &statb) < 0) {
- fprintf(stderr, "%s stat: %s\n", ttyline, sys_errlist[errno]);
- return(-1);
- }
-
- if((statb.st_mode&S_IFMT) != S_IFCHR) {
- fprintf(stderr, "%s is not a character device.\n",ttyline);
- return(-1);
- }
-
- dev = statb.st_rdev;
- (void)lseek(kmem,
- (off_t) &(((struct cdevsw *)NLVALUE(CDEVSW))[major(dev)]),0);
- (void)read(kmem, (char *) &cdevsw, sizeof cdevsw);
-
- if((int)(cdevsw.d_open) == NLVALUE(DZOPEN)) {
- devtype = DZ11;
- unit = minor(dev) / NDZLINE;
- line = minor(dev) % NDZLINE;
- addr = (int) &(((int *)NLVALUE(DZINFO))[unit]);
- (void)lseek(kmem, (off_t) NLVALUE(NDZ11), 0);
- } else if((int)(cdevsw.d_open) == NLVALUE(DHOPEN)) {
- devtype = DH11;
- unit = minor(dev) / NDHLINE;
- line = minor(dev) % NDHLINE;
- addr = (int) &(((int *)NLVALUE(DHINFO))[unit]);
- (void)lseek(kmem, (off_t) NLVALUE(NDH11), 0);
- } else if((int)(cdevsw.d_open) == NLVALUE(DMFOPEN)) {
- devtype = DMF;
- unit = minor(dev) / NDMFLINE;
- line = minor(dev) % NDMFLINE;
- addr = (int) &(((int *)NLVALUE(DMFINFO))[unit]);
- (void)lseek(kmem, (off_t) NLVALUE(NDMF), 0);
- } else {
- fprintf(stderr, "Device %s (%d/%d) unknown.\n", ttyline,
- major(dev), minor(dev));
- return(-1);
- }
-
- (void)read(kmem, (char *) &nlines, sizeof nlines);
- if(minor(dev) >= nlines) {
- fprintf(stderr, "Sub-device %d does not exist (only %d).\n",
- minor(dev), nlines);
- return(-1);
- }
-
- (void)lseek(kmem, (off_t)addr, 0);
- (void)read(kmem, (char *) &ubinfo, sizeof ubinfo);
- (void)lseek(kmem, (off_t) &(ubinfo->ui_flags), 0);
- (void)read(kmem, (char *) &flags, sizeof flags);
-
- tflags = 1<<line;
- resetmodem = ((flags&tflags) == 0);
- flags = enable ? (flags & ~tflags) : (flags | tflags);
- (void)lseek(kmem, (off_t) &(ubinfo->ui_flags), 0);
- (void)write(kmem, (char *) &flags, sizeof flags);
- switch(devtype) {
- case DZ11:
- if((addr = NLVALUE(DZSCAR)) == 0) {
- fprintf(stderr, "No dzsoftCAR.\n");
- return(-1);
- }
- cflags = flags;
- (void)lseek(kmem, (off_t) &(((char *)addr)[unit]), 0);
- (void)write(kmem, (char *) &cflags, sizeof cflags);
- break;
- case DH11:
- if((addr = NLVALUE(DHSCAR)) == 0) {
- fprintf(stderr, "No dhsoftCAR.\n");
- return(-1);
- }
- sflags = flags;
- (void)lseek(kmem, (off_t) &(((short *)addr)[unit]), 0);
- (void)write(kmem, (char *) &sflags, sizeof sflags);
- break;
- case DMF:
- if((addr = NLVALUE(DMFSCAR)) == 0) {
- fprintf(stderr, "No dmfsoftCAR.\n");
- return(-1);
- }
- cflags = flags;
- (void)lseek(kmem, (off_t) &(((char *)addr)[unit]), 0);
- (void)write(kmem, (char *) &cflags, sizeof cflags);
- break;
- default:
- fprintf(stderr, "Unknown device type\n");
- return(-1);
- }
- return(0);
-}
-#endif /* vax */
-
-prefix(s1, s2)
- register char *s1, *s2;
-{
- register char c;
-
- while ((c = *s1++) == *s2++)
- if (c == '\0')
- return (1);
- return (c == '\0');
-}
-#else /* !DIALINOUT */
-main()
-{
- fprintf(stderr,"acucntrl is not supported on this system\n");
-}
-#endif /* !DIALINOUT */
diff --git a/usr.bin/uucp/uupoll/uupoll.8 b/usr.bin/uucp/uupoll/uupoll.8
deleted file mode 100644
index f6ee49b..0000000
--- a/usr.bin/uucp/uupoll/uupoll.8
+++ /dev/null
@@ -1,111 +0,0 @@
-.\" Copyright (c) 1986, 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.
-.\"
-.\" @(#)uupoll.8 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt UUPOLL 8
-.Os BSD 4.3
-.Sh NAME
-.Nm uupoll
-.Nd poll a remote
-.Tn UUCP
-site
-.Sh SYNOPSIS
-.Nm uupoll
-.Op Fl g Ns Ar grade
-.Op Fl n
-.Ar system
-.Sh DESCRIPTION
-.Nm Uupoll
-is used to force a poll of a remote system. It queues a null job for the
-remote system and then invokes
-.Xr uucico 8 .
-.Pp
-The following options are available:
-.Bl -tag -width Fl
-.It Fl g Ns Ar grade
-Only send jobs of grade
-.Ar grade
-or higher on this call.
-.It Fl n
-Queue the null job, but do not invoke
-.Xr uucico .
-.El
-.Pp
-.Nm Uupoll
-is usually run by
-.Xr cron 5
-or by a user who wants to hurry a job along. A typical entry in
-.Em crontab
-could be:
-.Bd -literal
-0 0,8,16 * * * daemon /usr/bin/uupoll ihnp4
-0 4,12,20 * * * daemon /usr/bin/uupoll ucbvax
-.Ed
-.Pp
-This will poll
-.Em ihnp4
-at midnight, 0800, and 1600, and
-.Em ucbvax
-at 0400, noon, and 2000.
-.Pp
-If the local machine is already running
-.Xr uucico
-every
-hour and has a limited number of outgoing modems, a more elegant approach
-might be:
-.Bd -literal
-0 0,8,16 * * * daemon /usr/bin/uupoll -n ihnp4
-0 4,12,20 * * * daemon /usr/bin/uupoll -n ucbvax
-5 * * * * daemon /usr/lib/uucp/uucico -r1
-.Ed
-.Pp
-This will queue null jobs for the remote sites at the top of hour; they
-will be processed by
-.Xr uucico
-when it runs five minutes later.
-.Sh FILES
-.Bl -tag -width /usr/lib/uucp/UUCP -compact
-.It Pa /usr/lib/uucp/UUCP
-internal files/utilities
-.It Pa /var/spool/uucp/
-Spool directory
-.El
-.Sh SEE ALSO
-.Xr uucp 1 ,
-.Xr uux 1 ,
-.Xr uucico 8
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.3 .
diff --git a/usr.bin/uucp/uupoll/uupoll.c b/usr.bin/uucp/uupoll/uupoll.c
deleted file mode 100644
index 5d5e662..0000000
--- a/usr.bin/uucp/uupoll/uupoll.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * Copyright (c) 1986, 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1986, 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)uupoll.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * Poll named system(s).
- *
- * The poll occurs even if recent attempts have failed,
- * but not if L.sys prohibits the call (e.g. wrong time of day).
- *
- * Original Author: Tom Truscott (rti!trt)
- */
-
-#include "uucp.h"
-
-int TransferSucceeded = 1;
-struct timeb Now;
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- char wrkpre[MAXFULLNAME];
- char file[MAXFULLNAME];
- char grade = 'A';
- int nocall = 0;
- int c;
- char *sysname;
- extern char *optarg;
- extern int optind;
-
- if (argc < 2) {
- fprintf(stderr, "usage: uupoll [-gX] [-n] system ...\n");
- cleanup(1);
- }
-
- if (chdir(Spool) < 0) {
- syslog(LOG_WARNING, "chdir(%s) failed: %m", Spool);
- cleanup(1);
- }
- strcpy(Progname, "uupoll");
- uucpname(Myname);
-
- while ((c = getopt(argc, argv, "g:n")) != EOF)
- switch(c) {
- case 'g':
- grade = *optarg;
- break;
- case 'n':
- nocall++;
- break;
- case '?':
- default:
- fprintf(stderr, "unknown option %s\n",
- argv[optind-1]);
- }
-
- while(optind < argc) {
- sysname = argv[optind++];
- if (strcmp(sysname, Myname) == SAME) {
- fprintf(stderr, "This *is* %s!\n", Myname);
- continue;
- }
-
- if (versys(&sysname)) {
- fprintf(stderr, "%s: unknown system.\n", sysname);
- continue;
- }
- /* Remove any STST file that might stop the poll */
- sprintf(wrkpre, "%s/LCK..%.*s", LOCKDIR, MAXBASENAME, sysname);
- if (access(wrkpre, 0) < 0)
- rmstat(sysname);
- sprintf(wrkpre, "%c.%.*s", CMDPRE, SYSNSIZE, sysname);
- if (!iswrk(file, "chk", Spool, wrkpre)) {
- sprintf(file, "%s/%c.%.*s%cPOLL", subdir(Spool, CMDPRE),
- CMDPRE, SYSNSIZE, sysname, grade);
- close(creat(file, 0666));
- }
- /* Attempt the call */
- if (!nocall)
- xuucico(sysname);
- }
- cleanup(0);
-}
-
-cleanup(code)
-int code;
-{
- exit(code);
-}
diff --git a/usr.bin/uucp/uuq/Makefile b/usr.bin/uucp/uuq/Makefile
deleted file mode 100644
index 60dbe0b..0000000
--- a/usr.bin/uucp/uuq/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= uuq
-CFLAGS+=-I${.CURDIR}/../includes
-BINMODE=6555
-DPADD= ${LIBCOMPAT}
-LDADD= ${LIBUU} -lcompat
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/uucp/uuq/uuq.1 b/usr.bin/uucp/uuq/uuq.1
deleted file mode 100644
index 783d486..0000000
--- a/usr.bin/uucp/uuq/uuq.1
+++ /dev/null
@@ -1,126 +0,0 @@
-.\" Copyright (c) 1988, 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.
-.\"
-.\" @(#)uuq.1 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt UUQ 1
-.Os BSD 4.3
-.Sh NAME
-.Nm uuq
-.Nd examine or manipulate the uucp queue
-.Sh SYNOPSIS
-.Nm uuq
-.Op Fl l
-.Op Fl h
-.Op Fl s Ns Ar system
-.Op Fl u Ns Ar user
-.Op Fl d Ns Ar jobno
-.Op Fl r Ns Ar sdir
-.Op Fl b Ns Ar baud
-.Sh DESCRIPTION
-.Nm Uuq
-is used to examine (and possibly delete) entries in the uucp queue.
-.Pp
-When listing jobs,
-.Nm uuq
-uses a format reminiscent of
-.Xr ls .
-For the long format,
-information for each job listed includes
-job number, number of files to transfer, user who
-spooled the job, number of bytes to send, type of command requested
-(S for sending files, R for receiving files, X for remote uucp),
-and file or command desired.
-.Pp
-Several options are available:
-.Bl -tag -width Ar
-.It Fl h
-Print only the summary lines for each system. Summary lines give system
-name, number of jobs for the system, and total number of bytes to send.
-.It Fl l
-Specifies a long format listing. The default is to list only the
-job numbers sorted across the page.
-.It Fl s Ns Ar system
-Limit output to jobs for systems whose system names begin with
-.Ar system .
-.It Fl u Ns Ar user
-Limit output to jobs for users whose login names begin with
-.Ar user .
-.It Fl d Ns Ar jobno
-Delete job number
-.Ar jobno
-(as obtained from a previous
-.Nm uuq
-command)
-from the uucp queue.
-Only the
-.Tn UUCP
-Administrator is permitted to delete jobs.
-.It Fl r Ns Ar sdir
-Look for files in the spooling directory
-.Ar sdir
-instead of the default
-directory.
-.It Fl b Ns Ar baud
-Use
-.Ar baud
-to compute the transfer time instead of the default
-1200 baud.
-.El
-.Sh FILES
-.Bl -tag -width /usr/spool/uucp/Dhostname./D.x -compact
-.It Pa /usr/spool/uucp/
-Default spool directory
-.It Pa /usr/spool/uucp/C./C.*
-Control files
-.It Pa /usr/spool/uucp/D Ns Em hostname ./D.*
-Outgoing data files
-.It Pa /usr/spool/uucp/X./X.*
-Outgoing execution files
-.El
-.Sh SEE ALSO
-.Xr uucp 1 ,
-.Xr uux 1 ,
-.Xr uulog 1 ,
-.Xr uusnap 8
-.Sh BUGS
-No information is available on work requested by the remote machine.
-.Pp
-The user who requests a remote uucp command is unknown.
-.Pp
-.Dq Li uq \-l
-can be horrendously slow.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.3 .
diff --git a/usr.bin/uucp/uuq/uuq.c b/usr.bin/uucp/uuq/uuq.c
deleted file mode 100644
index 7abb25c..0000000
--- a/usr.bin/uucp/uuq/uuq.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*-
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)uuq.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * uuq - looks at uucp queues
- *
- * Lou Salkind
- * New York University
- *
- */
-
-#include "uucp.h"
-#include <stdio.h>
-
-#ifdef NDIR
-#include "libndir/ndir.h"
-#else !NDIR
-#include <sys/dir.h>
-#endif !NDIR
-#include <sys/stat.h>
-
-#define NOSYS (struct sys *)0
-
-#define W_TYPE wrkvec[0]
-#define W_FILE1 wrkvec[1]
-#define W_FILE2 wrkvec[2]
-#define W_USER wrkvec[3]
-#define W_OPTNS wrkvec[4]
-#define W_DFILE wrkvec[5]
-#define W_MODE wrkvec[6]
-#define WSUFSIZE 5 /* work file name suffix size */
-
-struct sys {
- char s_name[8];
- int s_njobs;
- off_t s_bytes;
- struct job *s_jobp;
- struct sys *s_sysp;
-};
-
-struct job {
- int j_files;
- int j_flags;
- char j_jobno[WSUFSIZE];
- char j_user[22];
- char j_fname[128];
- char j_grade;
- off_t j_bytes;
- time_t j_date;
- struct job *j_jobp;
-};
-
-struct sys *syshead;
-struct sys *getsys();
-int jcompare();
-char *sysname;
-char *user;
-char *rmjob;
-int hflag;
-int lflag;
-
-char *malloc(), *calloc();
-double atof();
-float baudrate = 2400.;
-char Username[BUFSIZ];
-char Filename[BUFSIZ];
-int Maxulen = 0;
-struct timeb Now;
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- register int i;
- register struct sys *sp;
- register struct job *jp;
- struct job **sortjob;
- int nsys;
- extern char *optarg;
- extern int optind;
-
- strcpy(Progname, "uuq");
- uucpname(Myname);
-
- while ((i = getopt(argc, argv, "r:S:s:u:d:b:hl")) != EOF)
- switch (i) {
- case 'r':
- case 'S':
- Spool = optarg;
- break;
- case 's':
- sysname = optarg;
- if (strlen(sysname) > SYSNSIZE)
- sysname[SYSNSIZE] = '\0';
- break;
- case 'u':
- user = optarg;
- break;
- case 'd':
- rmjob = optarg;
- break;
- case 'b':
- baudrate = atof(optarg);
- break;
- case 'h':
- hflag++;
- break;
- case 'l':
- lflag++;
- break;
- default:
- fprintf(stderr,
- "usage: uuq [-l] [-h] [-ssystem] [-uuser] [-djobno] [-rspool] [-bbaudrate]\n");
- exit(0);
- }
-
- subchdir(Spool);
- baudrate *= 0.7; /* reduce speed because of protocol overhead */
- baudrate *= 7.5; /* convert to chars/minute (60/8) */
- gather();
- nsys = 0;
- for (sp = syshead; sp; sp = sp->s_sysp) {
- if (sp->s_njobs == 0)
- continue;
- if (!hflag && nsys++ > 0)
- putchar('\n');
- printf("%s: %d %s", sp->s_name,
- sp->s_njobs, sp->s_njobs > 1 ? "jobs" : "job");
- if (lflag) {
- float minutes;
- int hours;
- /* The 80 * njobs is because of the uucp handshaking */
- minutes = (float)(sp->s_bytes + 80 * sp->s_njobs)/baudrate;
- hours = minutes/60;
- printf(", %ld bytes, ", sp->s_bytes);
- if (minutes > 60){
- printf("%d hour%s, ",hours,
- hours > 1 ? "s": "");
- minutes -= 60 * hours;
- }
- printf("%3.1f minutes (@ effective baudrate of %d)",
- minutes,(int)(baudrate/6));
- }
- putchar('\n');
- if (hflag)
- continue;
- /* sort them babies! */
- sortjob = (struct job **)calloc(sp->s_njobs, sizeof (struct job *));
- for (i=0, jp=sp->s_jobp; i < sp->s_njobs; i++, jp=jp->j_jobp)
- sortjob[i] = jp;
- qsort(sortjob, sp->s_njobs, sizeof (struct job *), jcompare);
- for (i = 0; i < sp->s_njobs; i++) {
- jp = sortjob[i];
- if (lflag) {
- printf("%s %2d %-*s%7ld%5.1f %-12.12s %c %.*s\n",
- jp->j_jobno, jp->j_files, Maxulen, jp->j_user, jp->j_bytes, jp->j_bytes/baudrate,
- ctime(&jp->j_date) + 4, jp->j_flags, sizeof (jp->j_fname), jp->j_fname
- );
- } else {
- printf("%s", jp->j_jobno);
- putchar((i+1)%10 ? '\t' : '\n');
- }
- /* There's no need to keep the force poll if jobs > 1*/
- if (sp->s_njobs > 1 && strcmp("POLL", jp->j_jobno)==0) {
- char pbuf[BUFSIZ];
- sprintf(pbuf,"%s/%c.%s%cPOLL",
- subdir(Spool, CMDPRE), CMDPRE,
- sp->s_name, jp->j_grade);
- (void) unlink(pbuf);
- }
- }
- if (!lflag && (sp->s_njobs%10))
- putchar('\n');
- }
- exit(0);
-}
-
-jcompare(j1, j2)
-struct job **j1, **j2;
-{
- int delta;
-
- delta = (*j1)->j_grade - (*j2)->j_grade;
- if (delta)
- return delta;
- return(strcmp((*j1)->j_jobno,(*j2)->j_jobno));
-}
-
-/*
- * Get all the command file names
- */
-gather()
-{
- struct direct *d;
- DIR *df;
-
- /*
- * Find all the spool files in the spooling directory
- */
- if ((df = opendir(subdir(Spool, CMDPRE))) == NULL) {
- fprintf(stderr, "can't examine spooling area\n");
- exit(1);
- }
- for (;;) {
- if ((d = readdir(df)) == NULL)
- break;
- if (d->d_namlen <= 2 || d->d_name[0] != CMDPRE ||
- d->d_name[1] != '.')
- continue;
- if (analjob(d->d_name) < 0) {
- fprintf(stderr, "out of memory\n");
- break;
- }
- }
- closedir(df);
-}
-
-/*
- * analjob does the grunge work of verifying jobs
- */
-#include <pwd.h>
-analjob(filename)
-char *filename;
-{
- struct job *jp;
- struct sys *sp;
- char sbuf[MAXNAMLEN+1], str[256], nbuf[256];
- char *jptr, *wrkvec[20];
- char grade;
- FILE *fp, *df;
- struct stat statb;
- int files, gotname, i;
- off_t bytes;
-
- strncpy(sbuf, filename, MAXNAMLEN);
- sbuf[MAXNAMLEN] = '\0';
- jptr = sbuf + strlen(sbuf) - WSUFSIZE;
- grade = *jptr;
- *jptr++ = 0;
- /*
- * sbuf+2 now points to sysname name (null terminated)
- * jptr now points to job number (null terminated)
- */
- if (rmjob) {
- if (strcmp(rmjob, jptr))
- return(0);
- } else {
- if ((sp = getsys(sbuf+2)) == NOSYS)
- return(0);
- if (!lflag) {
- /* SHOULD USE A SMALLER STRUCTURE HERE */
- jp = (struct job *)malloc(sizeof(struct job));
- if (jp == (struct job *)0)
- return(-1);
- strcpy(jp->j_jobno, jptr);
- jp->j_jobp = sp->s_jobp;
- jp->j_grade = grade;
- sp->s_jobp = jp;
- sp->s_njobs++;
- return(1);
- }
- }
- if ((fp = fopen(subfile(filename), "r")) == NULL) {
- perror(subfile(filename));
- return(0);
- }
- files = 0;
- bytes = 0;
- gotname = 0;
- while (fgets(str, sizeof str, fp)) {
- if (getargs(str, wrkvec, 20) <= 0)
- continue;
- if (rmjob) {
- int myuid;
- struct passwd *pw;
- /*
- * Make sure person who is removing data files is
- * the person who created it or root.
- */
- myuid = getuid();
- pw = getpwnam(W_USER);
- if (myuid && (pw == NULL || myuid != pw->pw_uid)) {
- fprintf(stderr, "Permission denied.\n");
- exit(1);
- }
- if (W_TYPE[0] == 'S' && !index(W_OPTNS, 'c')) {
- unlink(subfile(W_DFILE));
- fprintf(stderr, "Removing data file %s\n", W_DFILE);
- }
- continue;
- }
- if (user && (W_TYPE[0] == 'X' || !prefix(user, W_USER))) {
- fclose(fp);
- return(0);
- }
- files++;
- if (W_TYPE[0] == 'S') {
- if (strcmp(W_DFILE, "D.0") &&
- stat(subfile(W_DFILE), &statb) >= 0)
- bytes += statb.st_size;
- else if (stat(subfile(W_FILE1), &statb) >= 0)
- bytes += statb.st_size;
- }
- /* amusing heuristic */
-#define isXfile(s) (s[0]=='D' && s[strlen(s)-WSUFSIZE]=='X')
- if (gotname == 0 && isXfile(W_FILE1)) {
- if ((df = fopen(subfile(W_FILE1), "r")) == NULL)
- continue;
- while (fgets(nbuf, sizeof nbuf, df)) {
- nbuf[strlen(nbuf) - 1] = '\0';
- if (nbuf[0] == 'C' && nbuf[1] == ' ') {
- strcpy(Filename, nbuf+2);
- gotname++;
- } else if (nbuf[0] == 'R' && nbuf[1] == ' ') {
- register char *p, *q, *r;
- r = q = p = nbuf+2;
- do {
- if (*p == '!' || *p == '@'){
- r = q;
- q = p+1;
- }
- } while (*p++);
-
- strcpy(Username, r);
- W_USER = Username;
- }
- }
- fclose(df);
- }
- }
- fclose(fp);
- if (rmjob) {
- unlink(subfile(filename));
- fprintf(stderr, "Removing command file %s\n", filename);
- exit(0);
- }
- if (files == 0) {
- static char *wtype = "X";
- static char *wfile = "forced poll";
- if (strcmp("POLL", &filename[strlen(filename)-4])) {
- fprintf(stderr, "%.14s: empty command file\n", filename);
- return(0);
- }
- W_TYPE = wtype;
- W_FILE1 = wfile;
- }
- jp = (struct job *)malloc(sizeof(struct job));
- if (jp == (struct job *)0)
- return(-1);
- strcpy(jp->j_jobno, jptr);
- jp->j_files = files;
- jp->j_bytes = bytes;
- jp->j_grade = grade;
- jp->j_flags = W_TYPE[0];
- strncpy(jp->j_user, W_TYPE[0]=='X' ? "---" : W_USER, 20 );
- jp->j_user[20] = '\0';
- i = strlen(jp->j_user);
- if (i > Maxulen)
- Maxulen = i;
- /* SHOULD ADD ALL INFORMATION IN THE WHILE LOOP */
- if (gotname)
- strncpy(jp->j_fname, Filename, sizeof jp->j_fname);
- else
- strncpy(jp->j_fname, W_FILE1, sizeof jp->j_fname);
- stat(subfile(filename), &statb);
- jp->j_date = statb.st_mtime;
- jp->j_jobp = sp->s_jobp;
- sp->s_jobp = jp;
- sp->s_njobs++;
- sp->s_bytes += jp->j_bytes;
- return(1);
-}
-
-struct sys *
-getsys(s)
-register char *s;
-{
- register struct sys *sp;
-
- for (sp = syshead; sp; sp = sp->s_sysp)
- if (strcmp(s, sp->s_name) == 0)
- return(sp);
- if (sysname && !prefix(sysname, s))
- return(NOSYS);
- sp = (struct sys *)malloc(sizeof(struct sys));
- if (sp == NOSYS)
- return(NOSYS);
- strcpy(sp->s_name, s);
- sp->s_njobs = 0;
- sp->s_jobp = (struct job *)0;
- sp->s_sysp = syshead;
- sp->s_bytes = 0;
- syshead = sp;
- return(sp);
-}
diff --git a/usr.bin/uucp/uusend/Makefile b/usr.bin/uucp/uusend/Makefile
deleted file mode 100644
index 6c13fb4..0000000
--- a/usr.bin/uucp/uusend/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= uusend
-LINKS= ${BINDIR}/uusend ${BINDIR}/ruusend
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/uucp/uusend/uusend.1 b/usr.bin/uucp/uusend/uusend.1
deleted file mode 100644
index 9379307..0000000
--- a/usr.bin/uucp/uusend/uusend.1
+++ /dev/null
@@ -1,96 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)uusend.1 8.3 (Berkeley) 2/16/94
-.\"
-.Dd February 16, 1994
-.Dt UUSEND 1
-.Os BSD 4
-.Sh NAME
-.Nm uusend
-.Nd send a file to a remote host
-.Sh SYNOPSIS
-.Nm uusend
-.Op Fl m Ar mode
-.Ar sourcefile
-.Ar sys1!sys2!..!remotefile
-.Sh DESCRIPTION
-.Nm Uusend
-sends a file to a given location on a remote system.
-The system need not be directly connected to the local
-system, but a chain of
-.Xr uucp 1
-links must to connect the two systems.
-.Pp
-Available option:
-.Bl -tag -width Fl
-.It Fl m Ar mode
-The mode of the file on the remote
-end is taken from the octal number given.
-Otherwise, the mode of the input file will be used.
-.El
-.Pp
-The sourcefile
-can be
-.Ql Fl ,
-meaning to use the standard input.
-Both of these options are primarily intended for internal use of
-.Nm uusend .
-.Pp
-The remotefile can include the
-.Em ~userid
-syntax.
-.Sh DIAGNOSTICS
-If anything goes wrong any further away than the first system down
-the line, you will never hear about it.
-.Sh SEE ALSO
-.Xr uux 1 ,
-.Xr uucp 1 ,
-.Xr uuencode 1
-.Sh BUGS
-This command should not exist, since
-.Xr uucp
-should handle it.
-.Pp
-All systems along the line must have the
-.Nm uusend
-command available and allow remote execution of it.
-.Pp
-Some uucp systems have a bug where binary files cannot be the
-input to a
-.Xr uux 1
-command. If this bug exists in any system along the line,
-the file will show up severely munged.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.0 .
diff --git a/usr.bin/uucp/uusend/uusend.c b/usr.bin/uucp/uusend/uusend.c
deleted file mode 100644
index 207108e..0000000
--- a/usr.bin/uucp/uusend/uusend.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*-
- * Copyright (c) 1980, 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1980, 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)uusend.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-/*
- * uusend: primitive operation to allow uucp like copy of binary files
- * but handle indirection over systems.
- *
- * usage: uusend [-r] [-m ooo] localfile sysname1!sysname2!...!destfile
- * uusend [-r] [-m ooo] - sysname1!sysname2!...!destfile
- *
- * Author: Mark Horton, May 1980.
- *
- * "-r" switch added. Has same effect as "-r" in uux. 11/82 CCW
- *
- * Error recovery (a la uucp) added & ifdefs for ruusend (as in rmail).
- * Checks for illegal access to /usr/lib/uucp.
- * February 1983 Christopher Woodbury
- * Fixed mode set[ug]id loophole. 4/8/83 CCW
- *
- * Add '-f' to make uusend syntax more similar to UUCP. "destname"
- * can now be a directory. June 1983 CCW
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <pwd.h>
-
-/*
- * define RECOVER to permit requests like 'uusend file sys1!sys2!~uucp'
- * (abbreviation for 'uusend file sys1!sys2!~uucp/file').
- * define DEBUG to keep log of uusend uusage.
- * define RUUSEND if neighboring sites permit 'ruusend',
- * which they certainly should to avoid security holes
- */
-#define RECOVER
-/*#define DEBUG "/usr/spool/uucp/uusend.log"/**/
-
-FILE *in, *out;
-FILE *dout;
-
-extern FILE *popen();
-extern char *index(), *strcpy(), *strcat(), *ctime();
-
-#ifdef RUUSEND
-int rsend;
-#endif RUUSEND
-int mode = -1; /* mode to chmod new file to */
-char *nextsys; /* next system in the chain */
-char dnbuf[200]; /* buffer for result of ~user/file */
-char cmdbuf[256]; /* buffer to build uux command in */
-char *rflg = ""; /* default value of rflg ccw -- 1 Nov '82 */
-
-struct passwd *user; /* entry in /etc/passwd for ~user */
-struct passwd *getpwnam();
-struct stat stbuf;
-
-char *excl; /* location of first ! in destname */
-char *sl; /* location of first / in destname */
-char *sourcename; /* argv[1] */
-char *destname; /* argv[2] */
-char *UULIB = "/usr/lib/uucp"; /* UUCP lib directory */
-
-#ifdef RECOVER
-char *UUPUB = "/usr/spool/uucppublic/"; /* public UUCP directory */
-char *filename; /* file name from end of destname */
-char *getfname(); /* routine to get filename from destname */
-int fflg;
-char f[100]; /* name of default output file */
-#else !RECOVER
-char *f = ""; /* so we waste a little space */
-#endif !RECOVER
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- register int c;
- long count;
- extern char **environ;
-
-#ifdef DEBUG
- long t;
- umask(022);
- dout = fopen(DEBUG, "a");
- if (dout == NULL) {
- printf("Cannot append to %s\n", DEBUG);
- exit(1);
- }
- freopen(DEBUG, "a", stdout);
- fprintf(dout, "\nuusend run: ");
- for (c=0; c<argc; c++)
- fprintf(dout, "%s ", argv[c]);
- time(&t);
- fprintf(dout, "%s", ctime(&t));
-#endif DEBUG
-
-#ifdef RUUSEND
- if(argv[0][0] == 'r')
- rsend++;
-#endif RUUSEND
- while (argc > 1 && argv[1][0] == '-' && argv[1][1]) {
- switch(argv[1][1]) {
- case 'm':
- sscanf(argv[2], "%o", &mode);
- mode &= 0777; /* fix set[ug]id loophole */
- argc--; argv++;
- break;
- case 'r': /* -r flag for uux */
- rflg = "-r ";
- break;
-#ifdef RECOVER
- case 'f':
- fflg++;
- strcpy(f, argv[1]);
- break;
-#endif RECOVER
- default:
- fprintf(stderr, "Bad flag: %s\n", argv[1]);
- break;
- }
- argc--; argv++;
- }
-
- if (argc != 3) {
- fprintf(stderr, "Usage: uusend [-m ooo] [-r] -/file sys!sys!..!rfile\n");
- exit(1);
- }
-
- sourcename = argv[1];
- destname = argv[2];
-
- if (sourcename[0] == '-')
- in = stdin;
- else {
-#ifdef RUUSEND
- if (rsend) {
- fprintf(stderr, "illegal input\n");
- exit(2);
- }
-#endif RUUSEND
- in = fopen(sourcename, "r");
- if (in == NULL) {
- perror(argv[1]);
- exit(2);
- }
- if (!fflg || f[2] == '\0') {
- strcpy(f, "-f");
- strcat(f, getfname(sourcename));
- fflg++;
- }
- }
-
- excl = index(destname, '!');
- if (excl) {
- /*
- * destname is on a remote system.
- */
- nextsys = destname;
- *excl++ = 0;
- destname = excl;
- if (mode < 0) {
- fstat(fileno(in), &stbuf);
- mode = stbuf.st_mode & 0777;
- }
-#ifdef RUUSEND
- sprintf(cmdbuf,"uux -gn -z %s- \"%s!ruusend %s -m %o - (%s)\"",
-#else !RUUSEND
- sprintf(cmdbuf, "uux -gn -z %s- \"%s!uusend %s -m %o - (%s)\"",
-#endif !RUUSEND
- rflg, nextsys, f, mode, destname);
-#ifdef DEBUG
- fprintf(dout, "remote: nextsys='%s', destname='%s', cmd='%s'\n", nextsys, destname, cmdbuf);
-#endif DEBUG
- out = popen(cmdbuf, "w");
- } else {
- /*
- * destname is local.
- */
- if (destname[0] == '~') {
-#ifdef DEBUG
- fprintf(dout, "before ~: '%s'\n", destname);
-fflush(dout);
-#endif DEBUG
- sl = index(destname, '/');
-#ifdef RECOVER
- if (sl == NULL && !fflg) {
- fprintf(stderr, "Illegal ~user\n");
- exit(3);
- }
- for (sl = destname; *sl != '\0'; sl++)
- ; /* boy, is this a hack! */
-#else !RECOVER
- if (sl == NULL) {
- fprintf(stderr, "Illegal ~user\n");
- exit(3);
- }
- *sl++ = 0;
-#endif !RECOVER
- user = getpwnam(destname+1);
- if (user == NULL) {
- fprintf(stderr, "No such user as %s\n",
- destname);
-#ifdef RECOVER
- if ((filename =getfname(sl)) == NULL &&
- !fflg)
- exit(4);
- strcpy(dnbuf, UUPUB);
- if (fflg)
- strcat(dnbuf, &f[2]);
- else
- strcat(dnbuf, filename);
- }
- else {
- strcpy(dnbuf, user->pw_dir);
- strcat(dnbuf, "/");
- strcat(dnbuf, sl);
- }
-#else !RECOVER
- exit(4);
- }
- strcpy(dnbuf, user->pw_dir);
- strcat(dnbuf, "/");
- strcat(dnbuf, sl);
-#endif !RECOVER
- destname = dnbuf;
- }
-#ifdef RECOVER
- else
- destname = strcpy(dnbuf, destname);
-#endif !RECOVER
- if(strncmp(UULIB, destname, strlen(UULIB)) == 0) {
- fprintf(stderr, "illegal file: %s", destname);
- exit(4);
- }
-#ifdef RECOVER
- if (stat(destname, &stbuf) == 0 &&
- (stbuf.st_mode & S_IFMT) == S_IFDIR &&
- fflg) {
- strcat(destname, "/");
- strcat(destname, &f[2]);
- }
-#endif RECOVER
- out = fopen(destname, "w");
-#ifdef DEBUG
- fprintf(dout, "local, file='%s'\n", destname);
-#endif DEBUG
- if (out == NULL) {
- perror(destname);
-#ifdef RECOVER
- if (strncmp(destname,UUPUB,strlen(UUPUB)) == 0)
- exit(5); /* forget it! */
- filename = getfname(destname);
- if (destname == dnbuf) /* cmdbuf is scratch */
- filename = strcpy(cmdbuf, filename);
- destname = strcpy(dnbuf, UUPUB);
- if (user != NULL) {
- strcat(destname, user->pw_name);
- if (stat(destname, &stbuf) == -1) {
- mkdir(destname, 0777);
- }
- strcat(destname, "/");
- }
- if (fflg)
- strcat(destname, &f[2]);
- else
- strcat(destname, filename);
- if ((out = fopen(destname, "w")) == NULL)
- exit(5); /* all for naught! */
-#else !RECOVER
- exit(5);
-#endif !RECOVER
- }
- if (mode > 0)
- chmod(destname, mode); /* don't bother to check it */
- }
-
- /*
- * Now, in any case, copy from in to out.
- */
-
- count = 0;
- while ((c=getc(in)) != EOF) {
- putc(c, out);
- count++;
- }
-#ifdef DEBUG
- fprintf(dout, "count %ld bytes\n", count);
- fclose(dout);
-#endif DEBUG
-
- fclose(in);
- fclose(out); /* really should pclose in that case */
- exit(0);
-}
-
-/*
- * Return the ptr in sp at which the character c appears;
- * NULL if not found. Included so I don't have to fight the
- * index/strchr battle.
- */
-
-#define NULL 0
-
-char *
-index(sp, c)
-register char *sp, c;
-{
- do {
- if (*sp == c)
- return(sp);
- } while (*sp++);
- return(NULL);
-}
-
-#ifdef RECOVER
-char *
-getfname(p)
-register char *p;
-{
- register char *s;
- s = p;
- while (*p != '\0')
- p++;
- if (p == s)
- return (NULL);
- for (;p != s; p--)
- if (*p == '/') {
- p++;
- break;
- }
- return (p);
-}
-
-#ifndef BSD4_2
-makedir(dirname, mode)
-char *dirname;
-int mode;
-{
- register int pid;
- int retcode, status;
- switch ((pid = fork())) {
- case -1: /* error */
- return (-1);
- case 0: /* child */
- umask(0);
- execl("/bin/mkdir", "mkdir", dirname, (char *)0);
- exit(1);
- /* NOTREACHED */
- default: /* parent */
- while ((retcode=wait(&status)) != pid && retcode != -1)
- ;
- if (retcode == -1)
- return -1;
- else {
- chmod(dirname, mode);
- return status;
- }
- }
- /* NOTREACHED */
-}
-#endif !BSD4_2
-#endif RECOVER
diff --git a/usr.bin/uucp/uusnap/uusnap.8 b/usr.bin/uucp/uusnap/uusnap.8
deleted file mode 100644
index 92f0e330..0000000
--- a/usr.bin/uucp/uusnap/uusnap.8
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" Copyright (c) 1983, 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.
-.\"
-.\" @(#)uusnap.8 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt UUSNAP 8
-.Os BSD 4.2
-.Sh NAME
-.Nm uusnap
-.Nd show snapshot of the
-.Tn UUCP
-system
-.Sh SYNOPSIS
-.Nm uusnap
-.Sh DESCRIPTION
-.Nm Uusnap
-displays in tabular format a synopsis of the current
-.Tn UUCP
-situation. The format of each line is as follows:
-.Bd -literal -offset indent -compact
-
-site N Cmds N Data N Xqts Message
-
-.Ed
-Where "site" is the name of the site with work, "N" is a count of
-each of the three possible types of work (command, data, or remote execute),
-and "Message" is the current status message for that
-site as found in the
-.Tn STST
-file.
-.Pp
-Included in "Message" may be the time left before
-.Tn UUCP
-can re-try the
-call, and the count of the number of times that
-.Tn UUCP
-has tried
-(unsuccessfully) to reach the site.
-.Sh SEE ALSO
-.Xr uucp 1 ,
-.Xr uux 1 ,
-.Xr uuq 1 ,
-.Xr uucico 8
-.Rs
-.%T "UUCP Implementation Guide"
-.Re
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
diff --git a/usr.bin/uucp/uusnap/uusnap.c b/usr.bin/uucp/uusnap/uusnap.c
deleted file mode 100644
index 565c52a..0000000
--- a/usr.bin/uucp/uusnap/uusnap.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*-
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Rick Adams. Originally by RJKing WECo-MG6565 May 83.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)uusnap.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include "uucp.h"
-#include <sys/stat.h>
-#ifdef NDIR
-#include "ndir.h"
-#else
-#include <sys/dir.h>
-#endif
-#include <ctype.h>
-
-#define NSYSTEM 300 /* max # of systems queued */
-
-#define CMDSLEN 5 /* Length of trailer */
-#define DATALEN 5 /* Length of trailer */
-#define XEQTLEN 5 /* Length of trailer */
-#define NUMCTRS 3 /* # file types to count */
-#define CMDTYPE 0 /* Index into scnt.cntr */
-#define DATTYPE 1 /* Index into scnt.cntr */
-#define XEQTYPE 2 /* Index into scnt.cntr */
-
-struct scnt { /* System count structure */
- char name[MAXBASENAME+1]; /* Name of system */
- short cntr[NUMCTRS]; /* Count */
- char stst[32]; /* STST Message */
- time_t locked; /* If LCK..sys present */
- int st_type; /* STST Type */
- int st_count; /* STST Count */
- time_t st_lastime; /* STST Last time tried */
- time_t st_retry; /* STST Secs to retry */
- };
-
-int sndx; /* Number of systems */
-struct scnt sys[NSYSTEM]; /* Systems queued */
-int xqtisrunning = 0;
-
-main()
-{
- register int i, j, nlen = 0;
- time_t curtime, t;
-
- dodir(CMDSDIR, "C.", CMDSLEN, '\0', CMDTYPE);
- dodir(DATADIR, "D.", DATALEN, '\0', DATTYPE);
- dodir(XEQTDIR, "X.", XEQTLEN, 'X', XEQTYPE);
- getstst(SPOOL);
- time(&curtime);
- for(i=0; i<sndx; ++i)
- if((j = strlen(sys[i].name)) > nlen)
- nlen = j;
- for(i=0; i<sndx; ++i) {
- t = (sys[i].st_lastime +sys[i].st_retry) - curtime;
-
- /* decide if STST text is worth printing */
- if (-t < ONEDAY*2 && sys[i].st_type == SS_WRONGTIME) {
- sys[i].stst[0] = '\0';
- if (sys[i].cntr[0]+sys[i].cntr[1]+sys[i].cntr[2] == 0)
- continue; /* ignore entire line */
- }
-
- printf("%-*.*s ", nlen, nlen, sys[i].name);
- if(sys[i].cntr[CMDTYPE])
- printf("%3.d Cmd%s ", sys[i].cntr[CMDTYPE],
- sys[i].cntr[CMDTYPE]>1?"s":" ");
- else
- printf(" --- ");
- if(sys[i].cntr[DATTYPE])
- printf("%3.d Data ", sys[i].cntr[DATTYPE]);
- else
- printf(" --- ");
- if(sys[i].cntr[XEQTYPE])
- printf("%3.d Xqt%s ", sys[i].cntr[XEQTYPE],
- sys[i].cntr[XEQTYPE]>1?"s":" ");
- else
- printf(" --- ");
- if(*sys[i].stst == '\0' || sys[i].locked > sys[i].st_lastime) {
- if(sys[i].locked)
- printf("LOCKED\n");
- else
- printf("\n");
- continue;
- }
- printf("%s ", sys[i].stst);
- /* decide if STST info is worth pursuing */
- if (-t < ONEDAY*2 && (sys[i].st_count == 0
- || sys[i].st_type == SS_WRONGTIME
- || (sys[i].st_type == SS_INPROGRESS && sys[i].locked))) {
- printf("\n");
- continue;
- }
- t = (sys[i].st_lastime +sys[i].st_retry) - curtime;
- if (-t < ONEDAY*2 && sys[i].st_type != SS_FAIL)
- t = 0;
-
- if (sys[i].st_count > MAXRECALLS)
- printf("at MAX RECALLS");
- else if (-t >= ONEDAY*2)
- printf("%ld days ago", (long)-t/ONEDAY);
- else if (t <= 0)
- printf("Retry time reached");
- else if (t < 60)
- printf("Retry time %ld sec%s", (long)(t%60),
- (t%60)!=1? "s": "");
- else
- printf("Retry time %ld min%s", (long)(t/60),
- (t/60)!=1? "s": "");
- if(sys[i].st_count > 1)
- printf(" Count: %d\n", sys[i].st_count);
- else
- printf("\n");
- }
- if (xqtisrunning)
- printf("\nUuxqt is running\n");
- exit(0);
-}
-
-dodir(dnam, prfx, flen, fchr, type)
-char *dnam, *prfx;
-int flen;
-char fchr;
-int type;
-{
- register struct direct *dentp;
- register DIR *dirp;
- register int i, fnamlen, plen;
- char fnam[MAXNAMLEN+1];
-
- plen = strlen(prfx);
- if(chdir(dnam) < 0) {
- perror(dnam);
- exit(1);
- }
- if ((dirp = opendir(".")) == NULL) {
- perror(dnam);
- exit(1);
- }
- while((dentp = readdir(dirp)) != NULL) {
- if(*dentp->d_name == '.')
- continue;
- if(strncmp(dentp->d_name, prfx, plen) != SAME) {
- fprintf(stderr, "strange file (%s) in %s\n",
- dentp->d_name, dnam);
- continue;
- }
- strcpy(fnam, &dentp->d_name[plen]);
- fnamlen = strlen(fnam);
- if(flen > 0) {
- fnamlen -= flen;
- fnam[fnamlen] = '\0';
- fnamlen = MAXBASENAME; /* yes, after = '\0'*/
- } else {
- for(; fnamlen>0; --fnamlen) {
- if(fnam[fnamlen] == fchr) {
- fnam[fnamlen] = '\0';
- break;
- }
- }
- fnamlen = MAXBASENAME;
- }
- for(i=0; i<sndx; ++i) {
- if(strncmp(fnam, sys[i].name, fnamlen) == SAME) {
- ++sys[i].cntr[type];
- break;
- }
- }
- if(i == sndx) {
- strcpy(sys[i].name, fnam);
- ++sys[i].cntr[type];
- if(++sndx >= NSYSTEM) {
- sndx = NSYSTEM-1;
- fprintf(stderr,"Too many system names.\n");
- }
- }
- }
- closedir(dirp);
-}
-
-getstst(sdir)
-char *sdir;
-{
- register int i, csys;
- register char *tp;
- char fnam[MAXNAMLEN+1], buff[128];
- register struct direct *dentp;
- register DIR *dirp;
- register FILE *st;
- struct stat stbuf;
- long atol();
-
- if (chdir(sdir) < 0) {
- perror(sdir);
- exit(1);
- }
- if ((dirp = opendir(LOCKDIR)) == NULL) {
- perror(sdir);
- exit(1);
- }
- while ((dentp = readdir(dirp)) != NULL) {
- if (strcmp(&dentp->d_name[5], X_LOCK) == SAME) {
- xqtisrunning++;
- continue;
- }
- if(strncmp(dentp->d_name, "LCK..", 5) == SAME) {
- if(strncmp(&dentp->d_name[5], "tty", 3) == SAME ||
- strncmp(&dentp->d_name[5], "cul", 3) == SAME)
- continue;
- strcpy(fnam, dentp->d_name);
- for(csys=0; csys<sndx; ++csys) {
- if(strncmp(&fnam[5], sys[csys].name, SYSNSIZE)
- == SAME)
- break;
- }
- strcpy(sys[csys].name, &fnam[5]);
- if(csys == sndx) {
- ++sndx;
- }
- if (stat(fnam, &stbuf) < 0)
- sys[csys].locked = 1;
- else
- sys[csys].locked = stbuf.st_mtime;
- continue;
- }
- }
- closedir(dirp);
- if (chdir("STST") < 0) {
- perror("STST");
- exit(1);
- }
- if ((dirp = opendir(".")) == NULL) {
- perror("STST");
- exit(1);
- }
- while ((dentp = readdir(dirp)) != NULL) {
- if(*dentp->d_name == '.')
- continue;
- strcpy(fnam, dentp->d_name);
- for(csys=0; csys<sndx; ++csys) {
- if(strncmp(fnam, sys[csys].name, SYSNSIZE) == SAME)
- break;
- }
- strcpy(sys[csys].name, fnam);
- if(csys == sndx) {
- ++sndx;
- }
- if((st = fopen(fnam, "r")) == NULL) {
- sys[csys].stst[0] = '\0';
- continue;
- }
- buff[0] = '\0';
- fgets(buff, sizeof(buff), st);
- fclose(st);
- if(tp = rindex(buff, ' '))
- *tp = '\0'; /* drop system name */
- else
- continue;
- for(i=0, tp=buff; i<4; ++i, ++tp)
- if((tp = index(tp, ' ')) == NULL)
- break;
- if(i != 4)
- continue;
- strncpy(sys[csys].stst, tp, sizeof(sys[csys].stst));
- tp = buff;
- sys[csys].st_type = atoi(tp);
- tp = index(tp+1, ' ');
- sys[csys].st_count = atoi(tp+1);
- tp = index(tp+1, ' ');
- sys[csys].st_lastime = atol(tp+1);
- tp = index(tp+1, ' ');
- sys[csys].st_retry = atol(tp+1);
- }
-}
-/*
- * Return the ptr in sp at which the character c appears;
- * NULL if not found
- */
-
-char *
-index(sp, c)
-register char *sp, c;
-{
- do {
- if (*sp == c)
- return sp;
- } while (*sp++);
- return NULL;
-}
-
-/*
- * Return the ptr in sp at which the character c last
- * appears; NULL if not found
-*/
-
-char *
-rindex(sp, c)
-register char *sp, c;
-{
- register char *r;
-
- r = NULL;
- do {
- if (*sp == c)
- r = sp;
- } while (*sp++);
- return r;
-}
diff --git a/usr.bin/whatis/Makefile b/usr.bin/whatis/Makefile
deleted file mode 100644
index 8655a7c..0000000
--- a/usr.bin/whatis/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= whatis
-SRCS= whatis.c config.c
-.PATH: ${.CURDIR}/../man
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/whatis/whatis.1 b/usr.bin/whatis/whatis.1
deleted file mode 100644
index 0f1b0a1..0000000
--- a/usr.bin/whatis/whatis.1
+++ /dev/null
@@ -1,105 +0,0 @@
-.\" Copyright (c) 1989, 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.
-.\"
-.\" @(#)whatis.1 8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt WHATIS 1
-.Os BSD 4
-.Sh NAME
-.Nm whatis
-.Nd describe what a command is
-.Sh SYNOPSIS
-.Nm whatis
-.Op Fl M Ar path
-.Op Fl m Ar path
-.Ar command Ar ...
-.Sh DESCRIPTION
-.Nm Whatis
-looks up a given command and gives the header line from the manual page.
-You can then use the
-.Xr man 1
-command to get more information.
-.Pp
-The options are as follows:
-.Bl -tag -width Fl
-.It Fl M Ar path
-Override the list of standard directories
-.Nm whatis
-searches for its database named
-.Dq Pa whatis.db .
-The supplied
-.Ar path
-must be a colon
-.Dq \&:
-separated list of directories.
-This search path may also be set using the environment variable
-.Ev MANPATH .
-.It Fl m Ar path
-Augment the list of standard directories
-.Nm whatis
-searches for its database named
-.Dq Pa whatis.db .
-The supplied
-.Ar path
-must be a colon
-.Dq \&:
-separated list of directories.
-These directories will be searched before the standard directories
-or the directories supplied with the
-.Fl M
-option or the
-.Ev MANPATH
-environment variable are searched.
-.El
-.Sh ENVIRONMENT
-.Bl -tag -width MANPATH
-.It Ev MANPATH
-The standard search path used by
-.Xr man 1
-may be overridden by specifying a path in the
-.Ev MANPATH
-environment variable.
-.El
-.Sh FILES
-.Bl -tag -width whatis.db
-.It Pa whatis.db
-name of the whatis database
-.El
-.Sh SEE ALSO
-.Xr apropos 1 ,
-.Xr man 1 ,
-.Xr whereis 1
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 3.0 .
diff --git a/usr.bin/whatis/whatis.c b/usr.bin/whatis/whatis.c
deleted file mode 100644
index 904f0e4..0000000
--- a/usr.bin/whatis/whatis.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1987, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)whatis.c 8.5 (Berkeley) 1/2/94";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/queue.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../man/config.h"
-#include "../man/pathnames.h"
-
-#define MAXLINELEN 256 /* max line handled */
-
-static int *found, foundman;
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- extern char *optarg;
- extern int optind;
- ENTRY *ep;
- TAG *tp;
- int ch, rv;
- char *beg, *conffile, **p, *p_augment, *p_path;
-
- conffile = NULL;
- p_augment = p_path = NULL;
- while ((ch = getopt(argc, argv, "C:M:m:P:")) != EOF)
- switch (ch) {
- case 'C':
- conffile = optarg;
- break;
- case 'M':
- case 'P': /* backward compatible */
- p_path = optarg;
- break;
- case 'm':
- p_augment = optarg;
- break;
- case '?':
- default:
- usage();
- }
- argv += optind;
- argc -= optind;
-
- if (argc < 1)
- usage();
-
- if ((found = malloc((u_int)argc * sizeof(int))) == NULL)
- err(1, NULL);
- memset(found, 0, argc * sizeof(int));
-
- for (p = argv; *p; ++p) /* trim full paths */
- if (beg = rindex(*p, '/'))
- *p = beg + 1;
-
- if (p_augment)
- whatis(argv, p_augment, 1);
- if (p_path || (p_path = getenv("MANPATH")))
- whatis(argv, p_path, 1);
- else {
- config(conffile);
- ep = (tp = getlist("_whatdb")) == NULL ?
- NULL : tp->list.tqh_first;
- for (; ep != NULL; ep = ep->q.tqe_next)
- whatis(argv, ep->s, 0);
- }
-
- if (!foundman) {
- fprintf(stderr, "whatis: no %s file found.\n", _PATH_WHATIS);
- exit(1);
- }
- rv = 1;
- for (p = argv; *p; ++p)
- if (found[p - argv])
- rv = 0;
- else
- printf("%s: not found\n", *p);
- exit(rv);
-}
-
-whatis(argv, path, buildpath)
- char **argv, *path;
- int buildpath;
-{
- register char *end, *name, **p;
- char buf[MAXLINELEN + 1], wbuf[MAXLINELEN + 1];
-
- for (name = path; name; name = end) { /* through name list */
- if (end = index(name, ':'))
- *end++ = '\0';
-
- if (buildpath) {
- char hold[MAXPATHLEN + 1];
-
- (void)sprintf(hold, "%s/%s", name, _PATH_WHATIS);
- name = hold;
- }
-
- if (!freopen(name, "r", stdin))
- continue;
-
- foundman = 1;
-
- /* for each file found */
- while (fgets(buf, sizeof(buf), stdin)) {
- dashtrunc(buf, wbuf);
- for (p = argv; *p; ++p)
- if (match(wbuf, *p)) {
- printf("%s", buf);
- found[p - argv] = 1;
-
- /* only print line once */
- while (*++p)
- if (match(wbuf, *p))
- found[p - argv] = 1;
- break;
- }
- }
- }
-}
-
-/*
- * match --
- * match a full word
- */
-match(bp, str)
- register char *bp, *str;
-{
- register int len;
- register char *start;
-
- if (!*str || !*bp)
- return(0);
- for (len = strlen(str);;) {
- for (; *bp && !isdigit(*bp) && !isalpha(*bp); ++bp);
- if (!*bp)
- break;
- for (start = bp++;
- *bp && (*bp == '_' || isdigit(*bp) || isalpha(*bp)); ++bp);
- if (bp - start == len && !strncasecmp(start, str, len))
- return(1);
- }
- return(0);
-}
-
-/*
- * dashtrunc --
- * truncate a string at " - "
- */
-dashtrunc(from, to)
- register char *from, *to;
-{
- register int ch;
-
- for (; (ch = *from) && ch != '\n' &&
- (ch != ' ' || from[1] != '-' || from[2] != ' '); ++from)
- *to++ = ch;
- *to = '\0';
-}
-
-/*
- * usage --
- * print usage message and die
- */
-usage()
-{
- (void)fprintf(stderr,
- "usage: whatis [-C file] [-M path] [-m path] command ...\n");
- exit(1);
-}
diff --git a/usr.sbin/arp/arp4.4 b/usr.sbin/arp/arp4.4
deleted file mode 100644
index 0cd7161..0000000
--- a/usr.sbin/arp/arp4.4
+++ /dev/null
@@ -1,124 +0,0 @@
-.\" Copyright (c) 1985, 1986, 1988, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)arp4.4 6.5 (Berkeley) 4/18/94
-.\"
-.Dd April 18, 1994
-.Dt ARP 4
-.Os BSD 4
-.Sh NAME
-.Nm arp
-.Nd Address Resolution Protocol
-.Sh SYNOPSIS
-.Em "pseudo-device ether"
-.Sh DESCRIPTION
-The Address Resolution Protocol (ARP) is a protocol used to dynamically
-map between Internet host addresses and 10Mb/s Ethernet addresses.
-It is used by all the 10Mb/s Ethernet interface drivers.
-It is not specific to Internet protocols or to 10Mb/s Ethernet,
-but this implementation currently supports only that combination.
-.Pp
-ARP caches Internet-Ethernet address mappings.
-When an interface requests a mapping for an address not in the cache,
-ARP queues the message which requires the mapping and broadcasts
-a message on the associated network requesting the address mapping.
-If a response is provided, the new mapping is cached and any pending
-message is transmitted.
-ARP will queue at most one packet while waiting for a response to a
-mapping request;
-only the most recently ``transmitted'' packet is kept.
-If the target host does not respond after several requests,
-the host is considered to be down for a short period (normally 20 seconds),
-allowing an error to be returned to transmission attempts during this
-interval.
-The error is
-.Li EHOSTDOWN
-for a non-responding destination host, and
-.Li EHOSTUNREACH
-for a non-responding router.
-.Pp
-The ARP cache is stored in the system routing table as
-dynamically-created host routes.
-The route to a directly-attached Ethernet network is installed as a
-.Dq cloning
-route (one with the
-.Li RTF_CLONING
-flag set),
-causing routes to individual hosts on that network to be created on
-demand.
-These routes time out periodically (normally 20 minutes after validated;
-entries are not validated when not in use).
-An entry for a host which is not responding is a
-.Dq reject
-route (one with the
-.Li RTF_REJECT
-flag set).
-.Pp
-ARP entries may be added, deleted or changed with the
-.Xr arp 8
-utility.
-Manually-added entries may be temporary or permanent,
-and may be
-.Dq published ,
-in which case the system will respond to ARP requests for that host
-as if it were the target of the request.
-.Pp
-In the past,
-ARP was used to negotiate the use of a trailer encapsulation.
-This is no longer supported.
-.Pp
-ARP watches passively for hosts impersonating the local host (i.e. a host
-which responds to an ARP mapping request for the local host's address).
-.Sh DIAGNOSTICS
-.Em "duplicate IP address %x!! sent from ethernet address: %x:%x:%x:%x:%x:%x."
-ARP has discovered another host on the local network which responds to
-mapping requests for its own Internet address with a different Ethernet
-address, generally indicating that two hosts are attempting to use the
-same Internet address.
-.Sh SEE ALSO
-.Xr inet 4 ,
-.Xr route 4 ,
-.Xr arp 8 ,
-.Xr ifconfig 8 ,
-.Xr route 8
-.sp
-.Rs
-.%A Plummer, D.
-.%B "An Ethernet Address Resolution Protocol"
-.%T RFC826
-.Re
-.Rs
-.%A Leffler, S.J.
-.%A Karels, M.J.
-.%B "Trailer Encapsulations
-.%T RFC893
-.Re
-
diff --git a/usr.sbin/sliplogin/slip.hosts b/usr.sbin/sliplogin/slip.hosts
deleted file mode 100644
index f6ebf40..0000000
--- a/usr.sbin/sliplogin/slip.hosts
+++ /dev/null
@@ -1,11 +0,0 @@
-# @(#)slip.hosts 8.1 (Berkeley) 6/6/93
-#
-# login local-addr remote-addr mask opt1 opt2
-# (normal,compress,noicmp)
-#
-Schez vangogh chez 0xffffff00 compress
-Sjun vangogh 128.32.130.36 0xffffff00 normal
-Sleconte vangogh leconte 0xffffff00 compress
-Sleeb vangogh leeb 0xffffff00 compress
-Smjk vangogh pissaro-sl 0xffffff00 compress
-Soxford vangogh oxford 0xffffff00 compress
diff --git a/usr.sbin/sliplogin/slip.login b/usr.sbin/sliplogin/slip.login
deleted file mode 100644
index 3c70095..0000000
--- a/usr.sbin/sliplogin/slip.login
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh -
-#
-# @(#)slip.login 8.1 (Berkeley) 6/6/93
-
-#
-# generic login file for a slip line. sliplogin invokes this with
-# the parameters:
-# 1 2 3 4 5 6 7-n
-# slipunit ttyspeed loginname local-addr remote-addr mask opt-args
-#
-/sbin/ifconfig sl$1 inet $4 $5 netmask $6
-exit
diff --git a/usr.sbin/update/Makefile b/usr.sbin/update/Makefile
deleted file mode 100644
index ea20d05..0000000
--- a/usr.sbin/update/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-
-PROG= update
-MAN8= update.0
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/update/update.8 b/usr.sbin/update/update.8
deleted file mode 100644
index 78665fa..0000000
--- a/usr.sbin/update/update.8
+++ /dev/null
@@ -1,74 +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.
-.\"
-.\" @(#)update.8 8.3 (Berkeley) 4/19/94
-.\"
-.Dd April 19, 1994
-.Dt UPDATE 8
-.Os
-.Sh NAME
-.Nm update
-.Nd flush internal filesystem caches to disk frequently
-.Sh SYNOPSIS
-.Nm update
-.Sh DESCRIPTION
-The
-.Nm update
-command helps protect the integrity of disk volumes
-by flushing
-volatile cached filesystem data
-to disk at thirty second intervals.
-.Nm Update
-uses the
-.Xr sync 2
-function call to do the task.
-.Pp
-.Nm Update
-is commonly invoked at startup time by
-.Xr rc 8
-when the system goes multi-user.
-.Sh SEE ALSO
-.Xr sync 2 ,
-.Xr fsck 8 ,
-.Xr init 8 ,
-.Xr rc 8 ,
-.Xr sync 8
-.Sh BUGS
-It is possible on some systems that a
-.Xr sync
-occurring simultaneously with a crash may cause
-file system damage. See
-.Xr fsck 8 .
-.Sh HISTORY
-An
-.Nm update
-command appeared in
-.At v6 .
diff --git a/usr.sbin/update/update.c b/usr.sbin/update/update.c
deleted file mode 100644
index ae83ad1..0000000
--- a/usr.sbin/update/update.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright (c) 1987, 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.
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1987, 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <sys/time.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-main()
-{
- struct itimerval value;
- void mysync();
-
- daemon(0, 0);
-
- (void)signal(SIGALRM, mysync);
-
- value.it_interval.tv_sec = 30;
- value.it_interval.tv_usec = 0;
- value.it_value = value.it_interval;
- if (setitimer(ITIMER_REAL, &value, NULL)) {
- perror("update: setitimer");
- exit(1);
- }
- for (;;)
- sigpause(sigblock(0L));
- /* NOTREACHED */
-}
-
-void
-mysync()
-{
- (void)sync();
-}
OpenPOWER on IntegriCloud